Skip to Content
Connection

Authenticate

Send
/
Serverwss://streams.fast.onetrading.com

All private channels (TRADING, ACCOUNT) require authentication before subscription. Send AUTHENTICATE with your API token; if it is valid, it authorises subscriptions and requests for all private channels on this connection. Generate a token in the One Trading UI, with the Trade permission. If the token is rejected, the server sends AUTH_ERROR or ACCOUNT_RESTRICTED and then closes the connection with close code 3000.

Connection-level messages on the shared socket: authentication, generic subscribe and unsubscribe, heartbeats and errors.

Code Sample
const payload = {  "type": "AUTHENTICATE",  "api_token": "eyJ..."};const socket = new WebSocket("wss://streams.fast.onetrading.com/");socket.addEventListener("open", () => {  socket.send(JSON.stringify(payload));});

Messages

Send before subscribing to any private channel (TRADING, ACCOUNT). If the token is valid it authorises subscriptions and requests for all private channels on this connection. The token must have the Trade permission.

application/json
  1. payload
type*string
api_token*string

API token generated on the UI with Trade permissions

authenticate

Authentication request

{  "type": "AUTHENTICATE",  "api_token": "eyJ..."}

Reply

Receive

Sent back on the same channel.