Skip to main content

Client messages

Subscribe

Subscribe to orderbook updates. You can subscribe to specific markets by slug, condition ID, or token ID, or subscribe to the full firehose (full data stream) with "*".
Subscribes to every active Polymarket market (100,000+ tokens). Live updates start flowing immediately while snapshots stream in the background.
How identifiers are detected:
  • "*" → firehose (all active markets)
  • Starts with 0x → condition ID
  • All digits and longer than 10 characters → CLOB token ID
  • Everything else → slug
Subscribing again replaces your current subscription. To add markets, send a new subscribe with the full list.

Unsubscribe

Remove all subscriptions on this connection.
Pass markets to remove only a subset. Identifiers use the same slug, condition ID, and token ID resolver as subscribe.

Resync (PN1)

Request a new ordered integrity anchor without reconnecting:
This action is available on connections opened with integrity=1. Every requested market must already be subscribed. Omit markets or pass an empty array to resync the full current subscription. After resyncing, expect a new ordered anchor and a matching completion marker. If that cannot complete, the socket fails closed with a terminal integrity error. If an anchor for any requested token is already in flight, the server returns resync_in_progress; keep that token gated and retry after the supplied delay.

Ping

Client-initiated keepalive.
Response: {"type": "pong"}

Server messages

subscribed

Acknowledgment after a successful subscribe. The response format differs slightly depending on whether you subscribed to specific markets or the firehose.
If you subscribe with a slug and markets comes back as 0, the slug didn’t match any known event. Use the search API to find the correct slug.

snapshot_batch

Orderbook snapshots delivered in batches after subscribing. For small subscriptions (under 100 tokens), snapshots arrive in a single batch almost instantly. For large subscriptions (firehose), snapshots are streamed in batches of 50 every 200ms to avoid flooding your connection. PN1 integrity connections instead receive one standalone book_snapshot anchor for every subscribed token, including empty books.
Once all snapshots have been delivered, you’ll receive a completion marker:
Only tokens with active orderbook data are included in snapshots. Empty books are skipped. You’ll still receive live price_change and book_update events for all subscribed tokens via batched updates.

book_snapshot

Full orderbook state for a token. Sent inside snapshot_batch messages after subscribing, and occasionally in batch updates when the upstream source sends a full refresh.
Each PriceLevel is {"price": "0.55", "size": "1000.00"} where price is the probability (0 to 1) and size is the number of shares.
If bids and asks are both empty, the market exists but has no active orders. You’ll still receive price_change updates in batches when the price moves.

batch

Batched updates delivered every 250ms. Contains all changes for your subscribed tokens since the last batch. Multiple updates to the same price level within a batch window are coalesced into a single net change, reducing bandwidth without losing accuracy. With PN1, integrity metadata belongs to each depth update—not to this outer batch—because sequence continuity is per token.
Each update in the updates array is one of:

price_change

A market’s price level changed due to an order placement, cancellation, or fill. Each entry in assets describes a single level change. size is the absolute new size at that level — "0" means the level was removed. You can apply price_change events directly to your local book to maintain tick-accurate state without polling. Each entry in assets:
Multiple levels on the same asset_id may appear in one batch — each represents a distinct level change. The 250ms coalescer merges repeat hits on the same (asset_id, price, side) to last-write-wins, so you always get the most recent size for each level.
In PN1 mode, a depth-mutating price_change is split into token-scoped messages with exactly one assets row so each row has one unambiguous sequence and checksum. The default stream keeps the existing multi-row shape.

book_update

Incremental change to the orderbook. Apply these to the last snapshot.
book_update messages are incremental deltas, not full replacements. To maintain an accurate orderbook:
  • If a level’s size is "0", remove that price level
  • Otherwise, upsert the level (add or update)

book_snapshot

Occasional full orderbook replacement (sent when the upstream source resets). Same schema as the initial book_snapshot message above.

last_trade_price

A trade executed on Polymarket. Delivered for every fill, not coalesced — each trade in a batch window is its own event. last_trade_price does not mutate bid/ask depth, so it never advances PN1 sequence and never carries an integrity checksum.
Use last_trade_price events to build trade tapes, calculate VWAP, detect large fills, or trigger alerts on execution activity. Unlike price_change events which fire on order placement/cancellation, these fire only when an order is actually filled.
Need sub-millisecond granularity? Enterprise plans can be configured with a dedicated stream that delivers every individual orderbook event without batching, including per-event timestamps. Contact us if your strategy requires tick-by-tick data.

unsubscribed

Acknowledgment after unsubscribe.

pong

Response to a client ping.

Error messages