Commands and streams
Open a scoped state stream
Upgrade with a Bearer header, subscribe within one exact link and decode versioned binary data.
GET
Upgrade scoped canonical unified WebSocket
Examples use illustrative identities and UTC times; the documentation cannot submit requests.
Authorization and upgrade
Connect towss://api.liftx.io/v1/stream with a client that supports Authorization: Bearer ... in its WebSocket upgrade. read permission and current Pro/trial entitlement are required. There is no key query parameter or key-bearing WebSocket subprotocol.
A library generates the nonce and validates the server’s accept value. This illustrative handshake uses the standard example nonce; a real client generates a fresh one.
HTTP 101
Subscribe to an authorized account
For a key permitting all instruments on the illustrative link17:
Field names are exact, case-sensitive and unique. Send only the keys allowed for the operation and channel. Instrument-restricted keys cannot subscribe to link-wide balances, positions pages, private indexes or the history-hint channel; use permitted exact-instrument tickers and authorized exact-position HTTP reads instead.
For an instrument-restricted key permitting the catalog’s illustrative
BTC-USDT-SWAP:
Server message example
An account positions-index response is a binary message with a seven-byte header: message type, little-endian payload length, protocol version and channel. For channel4, version 1, its decoded JSON payload can be:
snapshot_required control invalidates dependent cached state.
The stream guide specifies every channel, the seven-byte frame layout, balance/ticker binary codecs, JSON payload shapes, history correlation and bounded decoder example. Do not feed an entire binary WebSocket message directly to a JSON parser.
Resync and unsubscribe
Request a fresh index after detecting a gap:resync; rebuild them with the channel’s documented subscription/read flow. Keep bounded receive queues and reconstruct complete state before resuming decisions after reconnect.
Errors and connection end
Withoutread, the upgrade is refused with HTTP 403 and JSON:
101, malformed/unauthorized controls or a slow consumer can close the stream generation; there is no new HTTP JSON error response inside the upgraded connection.
Credential/entitlement expiry ends authorization at its deadline. Local revocation cancels the registered stream; periodic authority checks detect out-of-process changes. A disconnect is not evidence that trading positions were canceled or closed.
Trading mutations still use POST /v1/commands. This stream carries canonical state, not a separate command execution path or a receipt subscription. Read command receipts for command progress and reconcile the affected position for actual effects.