WebSocket API
The WebSocket API provides real-time streaming data for market information and private user data.Endpoints
Connection
Connect to the WebSocket endpoints with your API key credentials:Authentication
WebSocket connections use the same API key authentication as the REST API. Include these headers in the WebSocket handshake:timestamp + "GET" + path where path is /v1/ws/private or /v1/ws/markets.
See Authentication for details on request signing.
Message Format
All WebSocket messages are JSON formatted with snake_case field names.Request Format
Subscription Types
Private WebSocket (/v1/ws/private):
Markets WebSocket (
/v1/ws/markets):
Response Format
Heartbeats
The server sends periodic heartbeat messages to keep the connection alive:Error Handling
If a subscription request fails, the response will include an error field:Unsubscribing
To unsubscribe from a stream:Best Practices
- Use unique request IDs - Track subscriptions with unique identifiers
- Handle reconnection - Implement automatic reconnection with exponential backoff
- Process messages in order - Messages are delivered in sequence
- Monitor heartbeats - Reconnect if heartbeats stop
- Limit subscriptions - Only subscribe to markets you need