Connection
WebSocket endpoint:wss://api.whitebit.com/ws
The API is based on JSON RPC over the WebSocket protocol.
The API returns time in Unix-time format.
Quickstart
Prerequisites
- A WebSocket client (browser, Node.js, Python, or similar)
No API key is required for public channels.
Step 1: Establish a connection
Open a WebSocket connection to the endpoint.Step 2: Keep the connection alive
The server closes the connection after 60 seconds of inactivity. Send a ping message every 50 seconds to keep the connection alive. Add the following to the connection established in Step 1:Step 3: Subscribe to last price updates
Subscribe to the Last Price channel to receive real-time price updates for one or more markets. Send the subscription message using the connection from Step 1:Step 4: Receive update events
After a successful subscription, the server sends update events every second. Each event contains the market name and the latest price. Example update event:params array contains [market_name, last_price]. Parse each lastprice_update event to display real-time prices.
Message Format
Request message
Types of request messages:
- Query — one-time requests (
ping,candles_request,balanceSpot_request, etc.) - Subscription — streaming updates (
candles_subscribe,lastprice_subscribe,balanceSpot_subscribe, etc.). Repeating a subscription cancels the previous one for the same data type.
Response message
Types of response messages:
- Query result — direct response to a query request
- Subscription status — success or failure of a subscription request
- Update events — pushed by the server when subscribed data changes
Examples
Query — ping/pong:For connection limits, request limits, and error codes, see WebSocket Rate Limits & Error Codes. Private channels require authorization. See WebSocket Authentication for the full setup flow.
Channels
Market Streams
Public channels for market data — kline, last price, trades, depth, book ticker, and more. See Markets & Trading Pairs for pair notation.
Account Streams
Private channels for account data — balances, orders, deals, positions, and borrows. Requires authorization. See Balances & Transfers for account types.
Order Management
Private methods that place, modify, and cancel orders on spot, margin, and futures markets, from September 2, 2026 (global platform only). Requires authorization. See Order Types for the available types.
Who uses this
- Market makers stream the real-time order book and fills — the public Depth and Book Ticker channels plus the private Deals account stream. See Market Maker integration.
- Any integration reading private account events (balances, orders, deals, positions) authorizes first — see WebSocket Authentication.
Connection best practices
Reuse a single WebSocket connection for multiple subscriptions instead of opening a new connection per channel. See WebSocket Rate Limits & Error Codes for connection and request limits, timeout behavior, and reconnection guidance.Related resources
- WebSocket Authentication — Authorization flow for private Account Stream channels
- WebSocket Rate Limits & Error Codes — Connection limits, request limits, and error codes
- API Reference Overview — Base URL, quickstart, and endpoint groups
- Market Streams — All public channels (kline, trades, depth, book ticker)
- Account Streams — Private channels for balances, orders, and positions
Used in these guides
- Partner Solutions — the partner router that maps use cases to programs.