Authenticate
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.
const payload = { "type": "AUTHENTICATE", "api_token": "eyJ..."};const socket = new WebSocket("wss://streams.fast.onetrading.com/");socket.addEventListener("open", () => { socket.send(JSON.stringify(payload));});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.
- payload
type*stringapi_token*stringAPI token generated on the UI with Trade permissions
Authentication request
{ "type": "AUTHENTICATE", "api_token": "eyJ..."}Reply
Sent back on the same channel.