Subscribe to one or more channels using the public/subscribe method. All WebSocket subscriptions share this format.
Before subscribing, connect to the endpoint family that matches your channels:
- Use a
book connection (/ws) for BLOCK_BOOK_SNAPSHOT
- Use a
nonbook connection (/nonbook/ws) for every other channel
If you need both channel families, maintain one connection to each.
Subscribe
{
"jsonrpc": "2.0",
"id": 0,
"method": "public/subscribe",
"params": {
"channels": [
{
"type": "TRADE_AGG",
"exchange": "BINANCE_FUTURES",
"symbol": "BTCUSDT",
"category": "*",
"batchInterval": "200ms"
}
],
"compression": "brotli",
"version": "v2",
}
}
Request parameters
| Field | Type | Required | Description |
|---|
jsonrpc | string | Yes | JSON-RPC version. Always "2.0". |
id | int | Yes | Request ID. Must be unique across the lifetime of the connection. Echoed back in responses for correlation. |
method | string | Yes | public/subscribe, public/unsubscribe, or public/unsubscribe_all. |
params.channels | Channel[] | Yes | Channels to subscribe to. |
params.compression | string | No | Message compression. Use brotli for compressed JSON payloads. |
params.version | string | No | Protocol version. Use v2 for metadata support. |
Channel parameters
Every channel object requires these fields. Individual channel types accept additional type-specific parameters — see their respective pages.
| Parameter | Type | Required | Description |
|---|
type | string | Yes | Data type (e.g., TRADE, TRADE_AGG, BLOCK_BOOK_SNAPSHOT). See available channels. |
exchange | Exchange | Yes | Exchange to subscribe to. Use * for all exchanges. |
symbol | string | Yes | Symbol selector. For per-symbol subscriptions, use the exchange-native rawSymbol such as BTCUSDT. For coin-aggregated subscriptions on supported channels, keep the symbol field and pass the coin identifier such as BTC. |
category | Category | No | Market class filter. Use SPOT for spot markets or PERPETUAL for perpetual derivatives. Default: * (all categories). |
quote | string | No | Quote denomination: USD, COIN, or DEFAULT. |
Unsubscribe
Unsubscribe from specific channels:
{
"jsonrpc": "2.0",
"method": "public/unsubscribe",
"params": {
"channels": [
{
"type": "TRADE_AGG",
"exchange": "BINANCE_FUTURES",
"symbol": "BTCUSDT"
}
]
}
}
Or unsubscribe from everything:
{
"jsonrpc": "2.0",
"method": "public/unsubscribe_all",
"params": {}
}
Compression
When you set compression to brotli in your subscription, the server compresses all data messages. Your client must decompress incoming messages before parsing them.
Compression applies to data messages only — heartbeat pong responses are not compressed.