Skip to main content
All Realtime WebSocket traffic enters the API gateway at the same host as REST. There is no separate ingress, and direct connections to the internal firm-ws service port are not supported.

Endpoint

Optional query parameter:

Firm API key (primary)

Send the firm key as a header on the upgrade request. The gateway validates it, resolves the firm, and injects X-Firm-ID before forwarding to firm-ws.
Or equivalently:
/v1/firm-ws is on the gateway firm-key allowlist.

Staff session (secondary)

Browser-based staff users authenticate through /v1/auth/* and present a session cookie or bearer token. Staff sessions must also send the firm header so the gateway can resolve RBAC:

After the upgrade

Once the WebSocket is established, the server sends a single control frame. seq here echoes the last_seq you sent, or 0 when you omitted it. It is not the head of the stream. The stream head arrives later as stream_seq on scope.confirmed.
No trading or user events are delivered until the client sends scope.set. The connected frame is the only thing you will receive otherwise.

Close codes

In addition to application-level ping/pong, the server sends standard WebSocket control ping frames roughly every 30 seconds. Most client libraries respond to these automatically.

Hydration vs replay

  • Replay: reconnect with ?last_seq= and read scope.confirmed.resume. replayed means the server continued from last_seq + 1.
  • Hydration: when resume is gap, or on a first connect, fetch current state via HTTP — /v1/firm-control/users, /v1/firm-control/relationships, positions, balances, and open trades — then follow the live tail. A gap is expected after a few minutes offline, not only after a day.