Docs

orderbook_getBook - Historical Order Book

Retrieve historical Hyperliquid l2Book or l4Book state for one market and block from the Dwellir Hyperliquid Index.

Use orderbook_getBook when you need historical order book state for one Hyperliquid market at a specific block. The parameters intentionally match Dwellir's live Order Book WebSocket subscription shape. For backfills, use orderbook_getBookRange instead of issuing one request per block.

Endpoints

REST:

Text
GET https://api-hyperliquid-index.n.dwellir.com/YOUR_API_KEY/v1/orderbook

JSON-RPC:

Text
POST https://api-hyperliquid-index.n.dwellir.com/YOUR_API_KEY/jsonrpc

Parameters

FieldTypeRequiredDescription
typestringyesl2Book for aggregated levels or l4Book for order-level data.
coinstringyesTrading pair symbol, for example BTC, ETH, xyz:MSTR, @150, or #31.
blockNumbernumberyesHyperliquid block number to reconstruct.
nSigFigsnumbernoL2 price aggregation significant figures. Applies only to l2Book.
nLevelsnumbernoL2 levels per side. Use 1 for BBO. Applies only to l2Book.

l4Book returns the full reconstructed order-level book and does not accept nLevels, nSigFigs, mantissa, or limit.

L4 naming

Dwellir's live stream calls individual resting orders l4Book. In traditional market data terminology this is the order-level book, commonly called L3.

REST Examples

Historical L2:

Bash
curl "https://api-hyperliquid-index.n.dwellir.com/YOUR_API_KEY/v1/orderbook?type=l2Book&coin=BTC&blockNumber=985480000&nSigFigs=5&nLevels=20"

Historical BBO:

Bash
curl "https://api-hyperliquid-index.n.dwellir.com/YOUR_API_KEY/v1/orderbook?type=l2Book&coin=BTC&blockNumber=985480000&nLevels=1"

Historical order-level book:

Bash
curl "https://api-hyperliquid-index.n.dwellir.com/YOUR_API_KEY/v1/orderbook?type=l4Book&coin=BTC&blockNumber=985480000"

Bulk Range Requests

Range requests keep the same type, coin, nSigFigs, and nLevels parameters and add startBlock, endBlock, pageSize, and cursor pagination. The response envelope matches other Hyperliquid Index range pages:

JSON
{
  "data": [
    {
      "type": "l2Book",
      "coin": "BTC",
      "blockNumber": 985450000,
      "bids": [{ "px": "81016", "sz": "1.2", "n": 3 }],
      "asks": [{ "px": "81017", "sz": "0.8", "n": 2 }]
    }
  ],
  "nextCursor": "985451000",
  "hasMore": true
}

Each object in data is one billable returned book. Empty successful pages do not bill, and errors are not charged.

See orderbook_getBookRange for full range parameters and examples.

JSON-RPC Example

Bash
curl -X POST "https://api-hyperliquid-index.n.dwellir.com/YOUR_API_KEY/jsonrpc" \
  -H "content-type: application/json" \
  -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "orderbook_getBook",
  "params": {
    "type": "l2Book",
    "coin": "BTC",
    "blockNumber": 985480000,
    "nSigFigs": 5,
    "nLevels": 20
  }
}'

Response

REST returns the book object directly. JSON-RPC returns the same object under result.

For l2Book, bids are sorted from highest price to lowest price, and asks are sorted from lowest price to highest price. For l4Book, orders are sorted by side and price, with order ID as the final tie-breaker.

Billing

Single-block orderbook_getBook responses bill as 1 returned book. Range requests bill by the number of book objects in data, not as one flat request. Empty successful range pages and error responses are not charged.