WebSocket API
Authenticated snapshots for positions, orders, account balances, and market state.
Connect to wss://api.paperterminal.xyz/v1/stream.
Send this first message within ten seconds:
{"type":"subscribe","walletId":"YOUR_WALLET_UUID","token":"YOUR_API_KEY_OR_SUPABASE_ACCESS_TOKEN"}A subscription must belong to the authenticated user/key. Each connection subscribes to one wallet. The server rechecks authorization when fetching snapshots, so revoked keys and expired sessions are disconnected.
The server emits subscribed, snapshot, error, and pong messages. A snapshot includes sequence, at, walletId, and full data containing account and market state. Updates occur at most every three seconds. This is not a tick feed or a durable event stream.
Send {"type":"ping"} for a pong. Use your client's heartbeat timeout to reconnect. Sequence numbers restart on reconnection; refresh REST state and history after a gap. Slow consumers are disconnected rather than building an unbounded buffer. Back off on errors and never resubmit trades based only on a WebSocket disconnect.
The AsyncAPI document is at /api/asyncapi.json and is included in Scalar.