Documentation Index
Fetch the complete documentation index at: https://whitebit-preview.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Service
Kline
Last price
Market statistics
Market statistics for current day UTC
Market trades
Market depth
Book Ticker
WebSocket Connection Management
WebSocket endpoint iswss://api.whitebit.com/ws
The API is based on JSON RPC of WebSocket protocol.
⚠️️ Connection Timeout ⚠️️
- Server closes websocket connection after 60 seconds of inactivity
- Inactivity is defined as no messages sent by the client
Maintaining Connection
To keep the websocket connection active:- Send periodic ping messages every 50 seconds
- Handle potential connection closures gracefully in your application logic
Example Implementation
⤴️ Request message
JSON Structure of request message:id- Integer. Should be unique to handle response for your request.method- String. Name of request.params- Array. Here you pass params for method.
Types of request messages
- Query (
ping,candles_request, etc) - Subscription (
candles_subscribe,lastprice_subscribe, etc). Repeated subscription will be cancelled for the same data type.
⤵️ Response message
JSON Structure of response message:id- Integer. Id of request.result- Null for failure, for success - look for responses belowerror- Null for success, JSON Object for failure:message- Detailed textcode- Error code
| Code | Message |
|---|---|
| 1 | invalid argument |
| 2 | internal error |
| 3 | service unavailable |
| 4 | method not found |
| 5 | service timeout |
Types of response messages
- Query result
- Subscription status (success/failed)
- Update events