Skip to main content
All messages are JSON text frames.

Subscribe

Subscribe to the event stream. Omit filters to receive all events (firehose). Request:
{
  "action": "subscribe",
  "id": "my-subscription",
  "filters": {
    "action_types": ["order", "cancel"],
    "addresses": ["0x1234..."],
    "assets": ["BTC", "ETH"],
    "asset_ids": [0, 1]
  }
}
FieldRequiredDescription
actionYesMust be "subscribe"
idNoClient-chosen identifier. Defaults to "default". Used for unsubscribing.
filtersNoFilter object. Omit for firehose. See Filters.
Response:
{
  "action": "subscribed",
  "id": "my-subscription",
  "sub_id": 1,
  "total_subs": 50000
}

Unsubscribe

Request:
{
  "action": "unsubscribe",
  "id": "my-subscription"
}
Response:
{
  "action": "unsubscribed",
  "id": "my-subscription"
}

Multiple subscriptions

You can create multiple subscriptions on a single connection, each with different filters. Each gets its own sub_id. Use the id field to manage them.
{"action": "subscribe", "id": "btc-orders", "filters": {"assets": ["BTC"], "action_types": ["order"]}}
{"action": "subscribe", "id": "whale-tracker", "filters": {"addresses": ["0xd071d6d6..."]}}
Events from all active subscriptions are delivered on the same connection. To stop one stream without disconnecting, unsubscribe by its id.

Error handling

Unknown actions return:
{"error": "unknown action"}