OpsionDocs
ConsoleWebsiteSign in

API — Alerts

Alert rules define the conditions that trigger notifications. Alert events are the individual matches that occur when a rule fires.

List rules

bash
GET /api/alerts/rules

curl https://api.opsion.xyz/api/alerts/rules \
  -H "Authorization: Bearer opsk_your_key_here"

Create a rule

bash
POST /api/alerts/rules

curl -X POST https://api.opsion.xyz/api/alerts/rules \
  -H "Authorization: Bearer opsk_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Large outbound transfer",
    "ruleType": "large_transfer",
    "severity": "critical",
    "walletIds": ["550e8400-e29b-41d4-a716-446655440000"],
    "conditions": {
      "direction": "outbound",
      "value_usd": { "gte": 50000 }
    },
    "notifyEmail": true,
    "cooldownMinutes": 5
  }'
FieldTypeRequiredDescription
namestringYesRule name (max 64 chars)
ruleTypestringYesSee rule types below
severitystringNoinfo | warning | critical (default: warning)
walletIdsuuid[]NoTarget wallets (omit for all wallets)
conditionsobjectNoRule-type-specific condition parameters
notifyEmailbooleanNoSend email alert (default: true)
notifySlackbooleanNoSend Slack alert (default: false)
notifyWebhookbooleanNoTrigger custom webhook (default: false)
customWebhookUrlstringNoPublic HTTPS URL for webhook delivery
cooldownMinutesnumberNoSuppress repeat alerts, 0–1440 min (default: 5)

Rule types

TypeDescription
any_transferFires on any transfer involving the wallet
large_transferFires when transfer value exceeds a USD threshold
token_transferFires on transfers of a specific token
inbound_onlyFires only on incoming transfers
outbound_onlyFires only on outgoing transfers
contract_callFires on any contract interaction
method_callFires when a specific method signature is called
address_blacklistFires when a transaction involves a flagged address
gas_spikeFires when gas price exceeds a threshold
frequencyFires when transaction frequency exceeds a threshold

Update / toggle a rule

bash
PATCH /api/alerts/rules/:id

# Disable a rule
curl -X PATCH https://api.opsion.xyz/api/alerts/rules/rule-id-here \
  -H "Authorization: Bearer opsk_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{ "isActive": false }'

# Delete a rule
curl -X DELETE https://api.opsion.xyz/api/alerts/rules/rule-id-here \
  -H "Authorization: Bearer opsk_your_key_here"

Alert events

Events are immutable records created each time a rule fires.

bash
GET /api/alerts/events

# Filter by status: open | acknowledged | resolved
curl "https://api.opsion.xyz/api/alerts/events?status=open" \
  -H "Authorization: Bearer opsk_your_key_here"

Acknowledge / resolve

bash
# Acknowledge a single event
curl -X PATCH https://api.opsion.xyz/api/alerts/events/:id/acknowledge \
  -H "Authorization: Bearer opsk_your_key_here"

# Resolve a single event with a note
curl -X PATCH https://api.opsion.xyz/api/alerts/events/:id/resolve \
  -H "Authorization: Bearer opsk_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{ "note": "Confirmed legitimate transaction" }'

# Bulk acknowledge (up to 100 events)
curl -X PATCH https://api.opsion.xyz/api/alerts/events/bulk-acknowledge \
  -H "Authorization: Bearer opsk_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{ "ids": ["event-id-1", "event-id-2"] }'

# Bulk resolve
curl -X PATCH https://api.opsion.xyz/api/alerts/events/bulk-resolve \
  -H "Authorization: Bearer opsk_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{ "ids": ["event-id-1", "event-id-2"], "note": "Reviewed by compliance team" }'
TransactionsScreening