Messages
{
"message": "ping",
"content": {
"clientRequestId": "4cc68b60-ed2d-42aa-a21e-cb5486f8fd1a"
}
}{
"message": "subscribe",
"content": {
"clientRequestId": "cfff0f58-8780-4cf2-b3d3-6439fed37304",
"subscriptions": [
"trades",
"publicTrades",
"publicOrderBook"
]
}
}{
"message": "unsubscribe",
"content": {
"clientRequestId": "245867a5-0de9-4542-a9da-724577ab4102",
"subscriptions": [
"trades",
"publicTrades",
"publicOrderBook"
]
}
}{
"resultType": "pong",
"data": {
"clientRequestId": "4cc68b60-ed2d-42aa-a21e-cb5486f8fd1a",
"statusCode": 200
}
}{
"resultType": "subscribed",
"data": {
"activeSubscriptions": [
"orders",
"trades",
"publicTrades",
"publicOrderBook"
],
"clientRequestId": "cfff0f58-8780-4cf2-b3d3-6439fed37304",
"requestedSubscriptions": [
"trades",
"publicTrades",
"publicOrderBook"
]
}
}{
"resultType": "unsubscribed",
"data": {
"activeSubscriptions": [
"orders"
],
"clientRequestId": "245867a5-0de9-4542-a9da-724577ab4102",
"requestedUnsubscriptions": [
"trades",
"publicTrades",
"publicOrderBook"
]
}
}{
"resultType": "connectionShutdown",
"data": {
"forceCloseInMs": 60000,
"statusCode": 200,
"ts": 1785258083038
}
}WS Reference
Common Requests
Available on every connection: ping, subscribe, and unsubscribe, plus the connection shutdown notice.
WSS
?product=perpetuals&market=
{market}
Prefer the application-level
ping message over WebSocket control frames when validating connectivity. Because it is handled as a normal data message, it confirms end-to-end reachability across the same path used by your subscriptions and requests. Control frames are processed separately by WebSocket infrastructure and can still succeed when application data is not flowing reliably.Allowed Subscription Values
| Subscription Value | Description |
|---|---|
orders | Order creation and cancellation requests and notifications |
trades | Real-time trade updates for your account |
publicTrades | Real-time trade updates and snapshots for subscribed markets |
publicOrderBook | Real-time order book updates and snapshots for subscribed markets |
Subscribe / Unsubscribe Behavior
- Only new (or currently active) subscriptions are added (or removed) — re-subscribing to an already active subscription, or unsubscribing from an inactive one, is a no-op
- Other subscriptions remain unaffected
- Changes apply immediately
- Safe to call repeatedly (idempotent)
- Does not affect other connections
- Does not require reconnecting
Connection Shutdown
A connection may receive an unpromptedconnectionShutdown message, carrying the deadline by which it must be re-established.
Reconnect at any point before the deadline. The existing connection stays fully active and keeps delivering messages until it elapses, so opening the new connection first and dropping the old one once it is subscribed avoids any gap in coverage. Read forceCloseInMs from the message rather than assuming a fixed value.
A connection still open when the deadline passes is closed with WebSocket close code 1012, and messages published between that point and your reconnect are missed. Supplying a sessionId recovers missed order events on the reconnect; see WebSocket Session.Messages
{
"message": "ping",
"content": {
"clientRequestId": "4cc68b60-ed2d-42aa-a21e-cb5486f8fd1a"
}
}{
"message": "subscribe",
"content": {
"clientRequestId": "cfff0f58-8780-4cf2-b3d3-6439fed37304",
"subscriptions": [
"trades",
"publicTrades",
"publicOrderBook"
]
}
}{
"message": "unsubscribe",
"content": {
"clientRequestId": "245867a5-0de9-4542-a9da-724577ab4102",
"subscriptions": [
"trades",
"publicTrades",
"publicOrderBook"
]
}
}{
"resultType": "pong",
"data": {
"clientRequestId": "4cc68b60-ed2d-42aa-a21e-cb5486f8fd1a",
"statusCode": 200
}
}{
"resultType": "subscribed",
"data": {
"activeSubscriptions": [
"orders",
"trades",
"publicTrades",
"publicOrderBook"
],
"clientRequestId": "cfff0f58-8780-4cf2-b3d3-6439fed37304",
"requestedSubscriptions": [
"trades",
"publicTrades",
"publicOrderBook"
]
}
}{
"resultType": "unsubscribed",
"data": {
"activeSubscriptions": [
"orders"
],
"clientRequestId": "245867a5-0de9-4542-a9da-724577ab4102",
"requestedUnsubscriptions": [
"trades",
"publicTrades",
"publicOrderBook"
]
}
}{
"resultType": "connectionShutdown",
"data": {
"forceCloseInMs": 60000,
"statusCode": 200,
"ts": 1785258083038
}
}market
type:string
required
A specific market (e.g. BTC-USDT) or ALL. When ALL is used, market must be supplied explicitly in the content of every request that accepts it.
Sec-WebSocket-Protocol
type:httpApiKey
Supply as authorization#<JWT> during the WebSocket handshake.
Ping
type:object
Connection health check.
Subscribe
type:object
Add one or more streams to the current connection.
Unsubscribe
type:object
Remove one or more streams from the current connection.
Pong
type:object
Subscribed
type:object
Unsubscribed
type:object
Connection Shutdown
type:object
Pushed before the connection is closed, carrying the deadline by which it must be re-established.