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

# L4 order book

> L4 order-level Hyperliquid depth: every resting order with oid and user_address, plus diffs and reconstruction for core, Spot, HIP-3, and HIP-4.

L4 is the whole book order by order: every resting order with its own `oid` and `user_address`, plus the diffs to roll the book forward and reconstruct it at any point in time, not the aggregated levels of [L2](/rest-api/order-books-l2).

L4 is the deepest order-book grain 0xArchive serves and carries the fields needed for deterministic order-level reconstruction. It is a Hyperliquid-family surface: Hyperliquid core, Spot, HIP-3, and HIP-4 all expose L4. Lighter exposes individual orders through [L3](/rest-api/order-books-l3) instead, so do not reach for an L4 route on Lighter. Use L4 when you need microstructure, queue position, per-order user attribution, or a book you can reconstruct the same way twice; use [L2](/rest-api/order-books-l2) when aggregated levels are enough.

## Get an L4 snapshot

Pick your venue. The path and symbol format change per family.

<Tabs>
  <Tab title="Hyperliquid">
    ```bash theme={"theme":"github-dark"}
    curl "https://api.0xarchive.io/v1/hyperliquid/orderbook/BTC/l4" \
      -H "X-API-Key: $OXARCHIVE_API_KEY"
    ```

    `/v1/hyperliquid/orderbook/{symbol}/l4`, `/l4/diffs`, `/l4/history`. Plain perp symbols such as `BTC` and `ETH`.
  </Tab>

  <Tab title="Spot">
    ```bash theme={"theme":"github-dark"}
    curl "https://api.0xarchive.io/v1/hyperliquid/spot/orderbook/HYPE-USDC/l4" \
      -H "X-API-Key: $OXARCHIVE_API_KEY"
    ```

    `/v1/hyperliquid/spot/orderbook/{symbol}/l4`, `/l4/diffs`, `/l4/history`. Pair symbols such as `HYPE-USDC`.
  </Tab>

  <Tab title="HIP-3">
    ```bash theme={"theme":"github-dark"}
    curl "https://api.0xarchive.io/v1/hyperliquid/hip3/orderbook/km:US500/l4" \
      -H "X-API-Key: $OXARCHIVE_API_KEY"
    ```

    `/v1/hyperliquid/hip3/orderbook/{symbol}/l4`, `/l4/diffs`, `/l4/history`. Namespaced builder symbols, case-sensitive (for example `km:US500`). Preserve the builder prefix.
  </Tab>

  <Tab title="HIP-4">
    ```bash theme={"theme":"github-dark"}
    curl "https://api.0xarchive.io/v1/hyperliquid/hip4/orderbook/%230/l4" \
      -H "X-API-Key: $OXARCHIVE_API_KEY"
    ```

    `/v1/hyperliquid/hip4/orderbook/{symbol}/l4`, `/l4/diffs`, `/l4/history`. Outcome side ids such as `%230` (Yes).
  </Tab>
</Tabs>

## Request parameters

| Parameter      | In    | Type           | Required | Description                                                            |
| -------------- | ----- | -------------- | -------- | ---------------------------------------------------------------------- |
| `symbol`       | path  | string         | Yes      | Trading pair symbol, e.g. `BTC`                                        |
| `timestamp`    | query | integer (ms)   | No       | Snapshot route only; Unix milliseconds; omit for the latest checkpoint |
| `start`, `end` | query | integer (ms)   | No       | History and diff routes; Unix-millisecond window bounds                |
| `limit`        | query | integer        | No       | Max rows or checkpoints on history and diff routes                     |
| `cursor`       | query | string/integer | No       | Continuation token from `meta.next_cursor`                             |

Use `/l4/history` with `start` and `end` for a past window; `timestamp` is for the snapshot-at-time route. L4 is available on every tier, including Free.

## Example response

```json theme={"theme":"github-dark"}
{
  "success": true,
  "data": {
    "coin": "BTC",
    "timestamp": "2026-06-05T13:53:32.540Z",
    "checkpoint_timestamp": "2026-06-05T13:53:32.540Z",
    "diffs_applied": 0,
    "last_block_number": 1023882395,
    "bids": [
      { "oid": 459287722336, "user_address": "0xfcf104006bfff47695c1dc21dad3e9de1e72098e", "side": "B", "price": 61088, "size": 0.40603 }
    ],
    "asks": [
      { "oid": 459287726057, "user_address": "0x1c1c270b573d55b68b3d14722b5d5d401511bed0", "side": "A", "price": 61089, "size": 0.40924 }
    ],
    "bid_count": 24501,
    "ask_count": 18101,
    "total_bid_size": 10176.96,
    "total_ask_size": 5165.62
  },
  "meta": { "request_id": "req_5b1e0c47a9d23f88" }
}
```

`bids` and `asks` are truncated above. That snapshot carried **24,501 bids and 18,101 asks**: the entire resting book, each order with its own `oid` and `user_address`.

### Response fields

Responses use the `{ success, data, meta }` envelope; the fields below are `data`.

| Field                              | Type    | Description                                                                                                                                                                                              |
| ---------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `coin`                             | string  | Symbol (the L4 payload uses `coin`)                                                                                                                                                                      |
| `timestamp`                        | string  | When the book was in this state (UTC)                                                                                                                                                                    |
| `checkpoint_timestamp`             | string  | Instant the reconstruction is current to                                                                                                                                                                 |
| `diffs_applied`                    | integer | Diffs rolled onto the checkpoint; `0` is a clean checkpoint                                                                                                                                              |
| `last_block_number`                | integer | Chain block the reconstruction is current to                                                                                                                                                             |
| `bids`, `asks`                     | array   | Resting orders, each with `oid`, `user_address`, `side`, `price`, `size`. Within each price level, orders are listed in true queue priority, ALO priority insertions included, not placement-time order. |
| `bid_count`, `ask_count`           | integer | Full-book order counts, even when only the top orders are shown                                                                                                                                          |
| `total_bid_size`, `total_ask_size` | number  | Full-book aggregate sizes                                                                                                                                                                                |

`price` and `size` are numbers in L4 payloads, while [L2](/rest-api/order-books-l2) and [L3](/rest-api/order-books-l3) return `px`/`sz` as decimal strings, so check types per route. The [Endpoint reference](/reference) carries the exact types, and full field meanings live in the [field dictionary](/responses#field-dictionary).

## Reconstruct from diffs

A snapshot is a checkpoint. To follow the book over time, take an `l4` checkpoint, then apply `l4/diffs` in order, or pull `l4/history` for a window. Diff items may carry an optional `insert_before` field (an order ID, or null): for a new ALO order granted queue priority, it names the resting order this one is inserted ahead of within its price level. Null or absent means tail append. To reproduce queue order when rolling a checkpoint forward, insert the new order directly before that `oid` instead of appending. The field is populated on data from 2026-07-21 onward. Depth truncation is by order count, so the orders at a depth cut can differ from responses served before that date. `diffs_applied: 0` means a clean checkpoint; a higher number means it was rolled forward from the last one. When sequence and gap handling matter, move to [WebSocket L4 order book](/websocket/l4-orderbook) and [WebSocket replay](/websocket/replay), or let [SDK reconstruction](/sdks/reconstruction) hold local book state for you.

A current L2 snapshot is fine for inspecting the book or a spread. It is not the same dataset as a replayable L4 history window: what depth, which venue family, what timestamp semantics, and whether the historical book can be reconstructed the same way twice.

## Stream it live

Order-level updates stream on `l4_diffs` and `l4_orders` for Hyperliquid core; Spot, HIP-3, and HIP-4 use prefixed variants (`spot_l4_diffs`, `hip3_l4_diffs`, `hip4_l4_orders`, and so on). For sequence and gap handling, see [WebSocket L4 order book](/websocket/l4-orderbook) and [WebSocket replay](/websocket/replay).

```javascript theme={"theme":"github-dark"}
ws.send(JSON.stringify({ op: "subscribe", channel: "l4_diffs", symbol: "BTC" }));
```

The full channel matrix is on [WebSocket channels](/websocket/channels).

## Export in bulk

L4 books export as the `l4_orderbook` schema (`$8/GB`, `$25 minimum`), and order-level events export as `l4_orders` (`$8/GB`, `$25 minimum`), delivered as Parquet with ZSTD compression. Keep L2, L3, and L4 in separate tables. Build a selection in the [Data catalog](/data-catalog); columns and coverage keys are on [Export schemas](/export-schemas).

## Other depths

<CardGroup cols={2}>
  <Card title="L2 order book" icon="layers" href="/rest-api/order-books-l2">
    Aggregated price levels (`px`, `sz`, `n`) across every venue family.
  </Card>

  <Card title="L3 order book" icon="list-ordered" href="/rest-api/order-books-l3">
    Individual orders on Lighter, order-level detail without full lifecycle.
  </Card>
</CardGroup>

## Next

Start from [Order books](/rest-api/order-books) for the depth overview, [Order history](/rest-api/order-history) and [Order flow](/rest-api/order-flow) for the lifecycle around the book, [WebSocket L4 order book](/websocket/l4-orderbook) when sequence matters, or [Data quality](/data-quality) before any long historical window.
