Polymarket Orderbook History

GET/gateway/v1/prediction-market/polymarket/orderbooks

Historical orderbook snapshots for a Polymarket token. Returns raw bid/ask depth levels. Timestamps in milliseconds.

Data refresh: ~5 minutes

Query Parameters

token_idstringrequired

Token identifier

Example: 73662070458561467734997715458900555626841827840002814944742182699282770895284
start_timeinteger

Start time in Unix milliseconds. 0 means 7 days ago.

end_timeinteger

End time in Unix milliseconds. 0 means current time.

limitinteger

Maximum number of snapshots to return

pagination_keystring

Base64 cursor for pagination

Polymarket Orderbook History
const options = {method: 'GET'};

fetch('https://api.asksurf.ai/gateway/v1/prediction-market/polymarket/orderbooks?token_id=73662070458561467734997715458900555626841827840002814944742182699282770895284', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
OK
{
  "$schema": "https://example.com/schemas/V2OrderbooksResponse.json",
  "pagination": {
    "count": 123,
    "has_more": true,
    "limit": 123,
    "pagination_key": "<string>"
  },
  "snapshots": [
    {
      "asks": [
        {
          "price": 123,
          "size": 123
        }
      ],
      "assetId": "<string>",
      "bids": [
        {
          "price": 123,
          "size": 123
        }
      ],
      "hash": "<string>",
      "indexedAt": 123,
      "market": "<string>",
      "tickSize": "<string>",
      "timestamp": 123
    }
  ]
}