Connection
WebSocket endpoint:wss://wss.whitebit.com/ws
The API is based on JSON-RPC over the WebSocket protocol.
The API returns time in Unix-time format.
Host migration
The Global WebSocket host moved fromapi.whitebit.com to wss.whitebit.com on September 1, 2026. Both hosts serve the same channels over the same /ws path during a 6-month transition window.
Replace the host string in the WebSocket client and redeploy. Nothing in the application protocol changes:
- The
/wspath is unchanged. - The JSON-RPC request and response format is unchanged.
- Every subscription, query, and order-management method name is unchanged.
- The
authorizeflow and the token format are unchanged — see WebSocket Authentication. - Connection and request limits are unchanged — see WebSocket Rate Limits & Error Codes.
wss.whitebit.com before the switch.
The legacy host stays fully functional until March 1, 2027, so the switch does not need a coordinated cutover. An integration that resolves the host from configuration needs a configuration change only. An integration that hardcodes the host in more than one place — a reconnect helper, a failover list, a client default — must update every occurrence, because a missed entry keeps working until March 1, 2027 and fails then rather than at deploy time.
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.