Skip to main content

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:
The signature is constructed from: 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:
Clients should respond to heartbeats or implement their own keep-alive mechanism.

Error Handling

If a subscription request fails, the response will include an error field:

Unsubscribing

To unsubscribe from a stream:

Best Practices

  1. Use unique request IDs - Track subscriptions with unique identifiers
  2. Handle reconnection - Implement automatic reconnection with exponential backoff
  3. Process messages in order - Messages are delivered in sequence
  4. Monitor heartbeats - Reconnect if heartbeats stop
  5. Limit subscriptions - Only subscribe to markets you need