Overview
How to use the generated Spot Trading WebSocket reference on this site.
The WS reference documents every channel and command of the Spot Trading WebSocket, generated from its AsyncAPI specification. Each page is one channel or one command: how to subscribe, the updates it sends and how to unsubscribe, or the request and its responses, with the fields of every message and examples.
| Section | What it is |
|---|---|
| General | Authenticate a connection, and the errors the server may send at any time |
| Market Data | Order book and public trades of a market. No authentication needed |
| Trading | Create and cancel orders, one by one or in batch, and the kill switch, and follow your orders, trades and executions. Needs an authenticated connection |
| Funding | Your balance and working capital. Needs an authenticated connection |
Connection
URL: wss://ws.bit2me.com/v1/trading. Every message is a JSON text frame with an event (subscribe, add-order…).
The server pings the connection every 20 seconds and closes it when no pong arrives within 10 seconds. WebSocket clients answer pings on their own.
Authentication
Public channels need no authentication. For private channels and order commands, get a token with POST /v1/signin/apikey, signed with your API key, and send it on the socket with authenticate within 1 minute, the token's lifetime. The connection stays authenticated after the token expires.
Limits and errors
Connections and messages are limited per IP, and each command has its own limit per connection: reaching one closes the connection. See WebSocket rate limits. Order error codes are on Errors.
Samples
Official samples: trading-spot-samples (node/auth/ws.js, node/ws/{public,private}).
This socket is not the notification socket of the gateway. Notifications (wallet, KYC, teller) are on Wallet → Notifications.
Sign in with API key POST
Authenticates a user using an API key and returns a JWT access token. The API key must be sent via the `ApiKeyAuth` security scheme. The request body carries the `userId` that the key belongs to. On success the response contains an `accessToken` with its expiration timestamp.
Authenticate WSS
Authenticates the connection with a token from `POST /v1/signin/apikey`.