> ## Documentation Index
> Fetch the complete documentation index at: https://docs.oddpool.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Historical orderbook

> Full orderbook snapshots with YES bids, NO bids, and derived best bid/ask.

Full orderbook snapshots with YES bids, NO bids, and derived best bid/ask from the YES perspective. Without `start_time`/`end_time`, returns the most recent snapshots.

## Parameters

<ParamField query="market_id" type="string" required>
  Kalshi market ticker (e.g., `KXFEDDECISION-26APR-H0`).
</ParamField>

<ParamField query="start_time" type="integer">
  Start time in Unix ms. Omit with `end_time` to get latest data.
</ParamField>

<ParamField query="end_time" type="integer">
  End time in Unix ms. Omit with `start_time` to get latest data.
</ParamField>

<ParamField query="granularity" type="string" default="1m">
  Snapshot interval: `1m` or `5m`.
</ParamField>

<ParamField query="limit" type="integer" default="100">
  Max rows per page (1-200).
</ParamField>

<ParamField query="pagination_key" type="string">
  Cursor from previous response for next page.
</ParamField>

## Example

```bash theme={null}
curl -H "X-API-Key: oddpool_..." \
  "https://api.oddpool.com/historical/kalshi/orderbook?market_id=KXFEDDECISION-26APR-H0&start_time=1774015200000&end_time=1774018800000&limit=5"
```

## Response

```json theme={null}
{
  "snapshots": [
    {
      "market_id": "KXFEDDECISION-26APR-H0",
      "timestamp": 1774015256106,
      "yes_bids": [
        {"price": "0.9400", "size": 12500.0},
        {"price": "0.9300", "size": 8000.0}
      ],
      "no_bids": [
        {"price": "0.0600", "size": 21.0},
        {"price": "0.0500", "size": 366630.0}
      ],
      "best_yes_bid": 0.94,
      "best_yes_ask": 0.94,
      "mid": 0.94,
      "spread": 0.0
    }
  ],
  "pagination": {
    "limit": 5,
    "count": 5,
    "has_more": true,
    "pagination_key": "eyJo..."
  }
}
```
