Authentication
URL — No public environment serves this socket yet.
Credentials
ticket
Sent as query parameter ticket
The browser’s credential. A browser cannot send an Authorization header on the
WebSocket handshake, so it first exchanges its bearer for a ticket with the REST
API’s POST /ws-tickets ({"stream": "trading"}, answered
{"ticket", "expiresAtNs", "stream"}), then opens the WebSocket with ?ticket=<ticket>
on its URL, the ticket unchanged: it is URL-safe as served. One of the two schemes,
never both.
- One ticket, one session, soon. A ticket opens one session, once, and only before
expiresAtNs: 10 seconds after it is created by default, or your token’s expiry if that comes first. Create a new ticket for every connection attempt, a reconnect included; a ticket you used, or one refused at the handshake, opens nothing. - It is a credential. It carries your identity, so treat it like your token: the
answer that carries it is
Cache-Control: no-store, and nothing should log the ticket or the URL that carries it. - The session lasts as long as your credential, not the ticket. The session a
ticket opens ends at your token’s expiry; renew the credential over the open socket
with
op: auth. A ticket an API key created opens a session that ends with the key — disabled, deleted or rotated — never with a clock. - Creating one is admitted like any other REST call. A credential that does not verify is 401 and a principal the platform refuses 403, so a refused principal never gets a ticket — and, unlike a refused handshake, a browser can read why: stop on either. A token with no expiry cannot create one (401): a ticket never opens a session that outlives its token. An API key, which states no expiry, can.
- Creating one is limited to 60 a minute per principal — a member or an API key.
Past it,
POST /ws-ticketsanswers 429RATE_LIMITEDwithRetry-After; a malformed request does not count. POST /ws-ticketsanswers 503TICKETS_UNAVAILABLEwhen the REST API member you reached holds no ticket signing key, so a retry there changes nothing — unlike the handshake’s 503, which is retried. A browser cannot open this socket until the REST API serves tickets; any other client sends its bearer token on the handshake instead.- No
Idempotency-Key. A replayed answer would hand a retry the same single-use ticket, so every call mints a new one. - From a browser on another origin, the call needs your origin on the REST API’s list: each deployment grants cross-origin access (CORS) to the exact origins it lists, and from any other origin the browser refuses the call — make it through your backend instead.
bearer
Sent as header Authorization: Bearer … (JWT, or an API key’s immix_<keyId>_<secret>)
Every other client’s credential on the handshake, as Authorization: Bearer …: a member’s access token, stating an expiry — or an API key’s immix_<keyId>_<secret>, which states none and whose session ends with the key. One of the two schemes, never both.
Create a WebSocket ticket
REST API POST /ws-tickets
Exchanges your bearer for a ticket that opens one WebSocket stream once — trading or market-data, as the body names it; the other refuses it. An API key’s opens trading alone (403 FORBIDDEN_PRINCIPAL). Pass it as ?ticket= on that URL before expiresAtNs. It carries your identity and never outlives a token; never cache or log it. No Idempotency-Key: every call mints a new one.
Request parameters
Response parameters
Refusals
The session is open and authenticated
The first frame of every session, sent before the client says anything — unless something changed between the handshake and this frame, when the first frame is sessionClosing instead: PRINCIPAL_REVOKED (4003, not retryable) when access was revoked, SESSION_EXPIRED (4001, retryable) when the API key was rotated (reconnect with the current secret) or the session was announced too late to be served. The session was authenticated on its handshake, so there is no auth to ack, and this carries what the ack carries — the grant, never the grantee. Subscribe straight away. To renew the credential before expiresAtNs, re-auth over the open socket with op: auth, for the same principal; its answer is authAck. On an API key’s session expiresAtNs is null: nothing to renew, and the session ends with the key.
Re-authenticate the session
Op auth
The in-band re-auth: a session is authenticated on its handshake (a ticket or a bearer token), and this op renews its credential over the open socket — answer the sessionExpiring hint with it, or schedule it off expiresAtNs. It is never the way in: from 1.4.0 a handshake without a credential is refused, so no session ever owes it. The answer carries the GRANT, not the grantee — what this session may do and until when, with no identifier in it, because the client presented the token and already knows who it is.
A session may re-auth with a fresh credential for the SAME principal, which renews its lease. A credential naming a different principal is refused FORBIDDEN_PRINCIPAL and the session keeps the one it was opened with: the identity is immutable for the life of the socket. An API key’s session owes no re-auth — nothing on it lapses — and one with the key’s own bearer is answered like any other.
Request parameters
Response parameters
The grant, never the grantee. capabilities are the register row’s bits — not token claims, so they reflect what an administrator has granted rather than what was true when the token was issued — read at admission and fixed for the session. An administrator clearing one does not change an open session’s grant: re-auth over the socket to pick up the new set. expiresAtNs is when the session closes; schedule a re-auth off it rather than decoding the token.
Refusal parameters
This session’s credential lapses soon
Sent once per credential, one lead time before the lapse. Re-auth over the open socket with a fresh credential for the same principal and keep your subscriptions; renewing re-arms the hint. It exists because a client that schedules its own refresh may simply not be running when its timer fires — a throttled background tab — where an inbound frame is something the browser will deliver.