vike

Recipe 18 of 30

Polymarket order book at a past moment

Pass ts in epoch milliseconds to /orderbook; you get the nearest recorded book snapshot at or before that moment, up to 25 levels a side, and as_of_ts says which snapshot it was.

GET /v1/polymarket/orderbook with ts answers it in one call: the book of one outcome token as it stood at the moment you name, from the nearest recorded snapshot at or before ts, one row per price level. Asks come first, then bids, each from level 1 (the best price) outward, and every row repeats the as_of_ts of the snapshot used. The full parameter list is on Order-book snapshot.

Quick answer

Pass the token and the moment in epoch milliseconds.

cURL
# the Down token's book of a 5-minute BTC market at 14:26:40 UTC on 2026-10-23, 100 seconds into its window
curl -H "X-API-Key: $VIKE_API_KEY" \
  "https://data.vike.io/v1/polymarket/orderbook?token_id=2124295006397608207923779951408795040669109096087651269807278744579659839433&ts=1792765600000"

Example response

Captured from the live API on 2026-10-24 at 17:21 UTC, trimmed to 6 of 50 rows (levels 1 to 3 of each side). The snapshot used was taken 87 ms before the moment asked for. Prices are probabilities from 0 to 1 and sizes are shares: one share of Down could be bought at 0.46 and sold at 0.45, a one-cent spread.

Example response
[
  {"as_of_ts": 1792765599913, "level": 1, "price": 0.46, "side": "ask", "size": 437.56},
  {"as_of_ts": 1792765599913, "level": 2, "price": 0.47, "side": "ask", "size": 464.6},
  {"as_of_ts": 1792765599913, "level": 3, "price": 0.48, "side": "ask", "size": 675.6},
  {"as_of_ts": 1792765599913, "level": 1, "price": 0.45, "side": "bid", "size": 1668.49},
  {"as_of_ts": 1792765599913, "level": 2, "price": 0.44, "side": "bid", "size": 1796.66},
  {"as_of_ts": 1792765599913, "level": 3, "price": 0.43, "side": "bid", "size": 431.0}
]

Variations

Only the top of the book. depth counts levels per side, from 1 to 25.

cURL — top 5
# five levels a side at the same moment
curl -H "X-API-Key: $VIKE_API_KEY" \
  "https://data.vike.io/v1/polymarket/orderbook?token_id=2124295006397608207923779951408795040669109096087651269807278744579659839433&ts=1792765600000&depth=5"

A quiet token: read as_of_ts. Asked for 22:53:20 UTC on 2026-08-19, this token's nearest snapshot was from 22:52:15.5, 64 seconds earlier, and it held bids only, from 0.999 down.

cURL — quiet token
# a token near certainty: one-sided book, older snapshot
curl -H "X-API-Key: $VIKE_API_KEY" \
  "https://data.vike.io/v1/polymarket/orderbook?token_id=95532524407959903145510583684979049735028502452973932716346555811355282494630&ts=1787180000000&depth=5"

One row per level. Keep one row per (side, level) before you add sizes up.

cURL — de-duplicated
# the same book with any repeated level dropped
curl -s -H "X-API-Key: $VIKE_API_KEY" \
  "https://data.vike.io/v1/polymarket/orderbook?token_id=2124295006397608207923779951408795040669109096087651269807278744579659839433&ts=1792765600000" \
  | jq 'unique_by([.side, .level])'

Every snapshot in a window. /events with event_type=book returns each full snapshot in a window of up to 24 hours, with the whole ladder.

cURL — snapshots
# the full-book snapshots of the minute before
curl -H "X-API-Key: $VIKE_API_KEY" \
  "https://data.vike.io/v1/polymarket/events?token_id=2124295006397608207923779951408795040669109096087651269807278744579659839433&event_type=book&from_ms=1792765540000&to_ms=1792765600000&limit=100"

Before you rely on it

Levels can repeat, and the snapshot can be old

A response can hold the same (side, level) several times. The repeats are copies of one moment, not extra depth, so keep one row per level before adding sizes; this capture had none, and that varies by token and day. as_of_ts is the snapshot used: a quiet token's can be minutes old, a finished market's weeks. A ts before 2026-07-25 or before the token's first snapshot returns []. For many moments, download the archive's book_events file rather than calling once per moment.

A side can be missing

A book can be one-sided, so depth=5 may return five rows, not ten. Group by side and handle an absent one before you compute a spread.

Ask your agent

Connected to the Vike MCP server (https://vike.io/mcp) in Claude, ChatGPT or Cursor, ask it in plain words. The polymarket_orderbook tool answers, at 1 credit a call.

Ask your agent
What did the Polymarket order book of token 2124295006397608207923779951408795040669109096087651269807278744579659839433 look like at 14:26:40 UTC on 2026-10-23?
Example response
[  {"as_of_ts": 1792765599913, "level": 1, "price": 0.46, "side": "ask", "size": 437.56},  {"as_of_ts": 1792765599913, "level": 2, "price": 0.47, "side": "ask", "size": 464.6},  {"as_of_ts": 1792765599913, "level": 3, "price": 0.48, "side": "ask", "size": 675.6},  {"as_of_ts": 1792765599913, "level": 1, "price": 0.45, "side": "bid", "size": 1668.49},  {"as_of_ts": 1792765599913, "level": 2, "price": 0.44, "side": "bid", "size": 1796.66},  {"as_of_ts": 1792765599913, "level": 3, "price": 0.43, "side": "bid", "size": 431.0}]