Skip to main content

Snapshot

Levels are aggregated — one entry per unique price, summed across all resting orders at that price. Prices and quantities are decimal strings. depth defaults to 50 (accepts digits-only integers 1 to 1000; non-digit or out-of-range values return 400 invalid_depth, and non-digit outcome values return 400 invalid_outcome). Note that the response holds at most depth levels per side (up to 1,000), so a side can have more levels than a capped read shows. Levels whose total size is below a small dust threshold are left out, the same as on the WebSocket book frames. On a binary market both outcomes share one book. outcome=0 (the default) returns the YES view, where a NO bid at price p appears as a YES ask at 1 − p; outcome=1 returns the mirrored NO view.

Executable price for a size

Public, no authentication; counts against the shared markets-ip bucket (1200 requests / 60 s per IP). Cache-Control: no-store. Indicative only: the book can change before you place an order. The endpoint walks the visible book for one outcome: a BUY takes the asks from the lowest price up, a SELL takes the bids from the highest price down, until size is filled or the next level is beyond limitPrice.
The walk is exact over the levels as /orderbook serves them (quantities on 8 decimal places), with the same dust filtering. A market the matching engine does not run answers an empty book (bookEmpty: true). Errors: 400 invalid_side, 400 invalid_size, 400 invalid_limit_price, 400 invalid_outcome (not digits, or an index the market does not have), 400 outcome_required (no outcome on a market with more than two outcomes), 404 market_not_found, and 503 orderbook_unavailable when the book cannot be read (retry).

Live updates

For real-time book updates use the WebSocket token_book channel. See WebSocket messages. The REST snapshot carries seq — the matching engine’s per-outcome native sequence number (comparable to data.nativeSeq on WebSocket book_snapshot / book_update frames, whereas the top-level WebSocket seq / prevSeq is the per-token WS broadcast cursor; seq is 0 before the first book event after engine start/restart or on aggregate multi-outcome views). On legacy non-binary mirror-eligible 2-outcome markets where complement levels from the opposite outcome are merged into the book view, the response also includes mirrorSeq (the opposite outcome’s matcher sequence number). Align REST and WebSocket views with seq / data.nativeSeq (when seq > 0) and the canonical hash field (below); if your local copy drifts, request a fresh snapshot.

Reconciliation with the WebSocket feed

The hash field is a canonical 16-hex SHA-256 prefix over the (bids, asks) pair — price + quantity only, computed identically on this response and on the WebSocket book_snapshot and book_update envelopes. For the same logical book state both produce identical hashes. Typical reconciliation flow:
  1. Open the WebSocket and subscribe to token_book for the tokenId you care about.
  2. Buffer incoming book_snapshot / book_update frames keyed by their envelope seq.
  3. Call GET /api/markets/{symbol}/orderbook?outcome=<the token's outcomeIndex>&depth=1000 and read the response hash. The hash covers only the levels returned, so the default depth=50 can’t match a deeper WebSocket book, and the other outcome’s view never matches.
  4. Walk the buffered WS frames to find one with a matching hash — that seq is your alignment point; drop earlier frames, apply later ones onto the REST snapshot.
  5. From there each book_update you apply must produce the same hash as the envelope. If they ever diverge, issue get_book_snapshot to force a fresh server-side snapshot and restart alignment.
The hash domain is identical between REST and WS by construction — count is excluded from the hash on both sides, so an aggregated REST response (no count) and a book_snapshot.data (with count) produce the same hash for the same (bids, asks).

Cross-reference

The orderbook is the aggregated view of resting orders. For your own orders, always cross-reference with GET /api/orders/open, which lists your own open orders on tradeable markets.