Skip to main content
wss://api.parsecapi.com/ws Parsec WebSocket gives you one real-time connection for live orderbooks across supported exchanges, plus public trade and user fill events where the upstream exchange supports them. It also supports wallet address subscriptions that emit full wallet_activity snapshots for supported wallet-based venues.

When to Use WebSocket vs REST

  • Use WebSocket for live orderbook maintenance, trade feeds, and fill notifications.
  • Use REST when you need discovery, one-off reads, historical data, or exact pagination.
You still start with /markets when you need to discover a market first. Once you have the identifiers, WebSocket subscriptions accept either parsec_id or exchange + market_id.

Quickstart Flow

  1. Connect to wss://api.parsecapi.com/ws
  2. Authenticate within 15 seconds
  3. Subscribe to one or more markets and/or wallet addresses
  4. Maintain the book with snapshots, deltas, and resyncs when needed
const ws = new WebSocket('wss://api.parsecapi.com/ws');

ws.onopen = () => {
  ws.send(JSON.stringify({ type: 'auth', api_key: 'pk_live_YOUR_KEY' }));
};

End-to-End Example

This example connects, authenticates, subscribes to one market, applies incoming messages, and requests a resync if the server tells you to refresh:
const ws = new WebSocket('wss://api.parsecapi.com/ws');

ws.addEventListener('open', () => {
  ws.send(JSON.stringify({ type: 'auth', api_key: process.env.PARSEC_API_KEY }));
});

ws.addEventListener('message', (event) => {
  const msg = JSON.parse(event.data);

  switch (msg.type) {
    case 'auth_ok':
      ws.send(
        JSON.stringify({
          type: 'subscribe',
          markets: [
            {
              parsec_id: 'kalshi:KXBTC-26MAR10',
              outcome: 'Yes',
              depth: 10,
            },
          ],
          addresses: [{ exchange: 'polymarket', address: '0xabc...' }],
        }),
      );
      break;

    case 'orderbook':
      console.log('fresh snapshot', msg.parsec_id, msg.server_seq, msg.bids, msg.asks);
      break;

    case 'orderbook_delta':
      console.log('delta', msg.parsec_id, msg.server_seq, msg.changes);
      break;

    case 'activity':
      console.log('trade/fill', msg.kind, msg.parsec_id, msg.price, msg.size);
      break;

    case 'wallet_activity':
      console.log('wallet snapshot', msg.exchange, msg.address, msg.data);
      break;

    case 'resync_required':
      ws.send(
        JSON.stringify({
          type: 'resync',
          parsec_id: msg.parsec_id,
          outcome: msg.outcome,
        }),
      );
      break;

    case 'error':
      console.error('ws error', msg.code, msg.message);
      break;

    default:
      break;
  }
});

What You Receive

  • orderbook snapshots
  • orderbook_delta incremental updates
  • activity events for public trades and your own fills
  • wallet_activity snapshots for watched addresses
  • connection-level messages such as heartbeat, error, resync_required, and slow_reader

Connect & Authenticate

Auth message formats, success replies, and connection timeouts.

Subscribe to Markets

Subscribe, unsubscribe, and request a fresh snapshot.

Message Types

Orderbook snapshots, deltas, trades, fills, and system messages.

Reliability, Resync & Limits

Sequence handling, stale feeds, limits, and common recovery steps.