> ## 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.

# L2 order book

> L2 price-level depth across Hyperliquid core, Spot, HIP-3, HIP-4, and Lighter, with native snapshots and full-depth Hyperliquid L2 from L4.

L2 is price-level aggregated depth: each level carries a price, the total size resting at that price, and the order count behind it (`px`, `sz`, `n`), not the individual orders themselves.

L2 is the shape of the book. Reach for it when you need spreads, depth charts, a top-of-book monitor, or a light historical window, and step up to [L3](/rest-api/order-books-l3) or [L4](/rest-api/order-books-l4) only when individual orders or full lifecycle matter. This page covers the two L2 surfaces: native venue snapshots capped at 20 levels per side, and the full-depth aggregated L2 route family derived from L4 on Hyperliquid core and HIP-3.

## Get an L2 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/l2?depth=200" \
      -H "X-API-Key: $OXARCHIVE_API_KEY"
    ```

    | Depth                                     | Route                                                                              |
    | ----------------------------------------- | ---------------------------------------------------------------------------------- |
    | Full-depth aggregated L2 from L4          | `/v1/hyperliquid/orderbook/{symbol}/l2`, `/l2/history`, `/l2/diffs`                |
    | Native L2 snapshot or history (20 levels) | `/v1/hyperliquid/orderbook/{symbol}`, `/v1/hyperliquid/orderbook/{symbol}/history` |

    Plain perp symbols such as `BTC` and `ETH`. Use the `/l2` routes for full-depth aggregated L2 (request levels via `depth`) from March 10, 2026 onward.
  </Tab>

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

    | Depth                         | Route                                                                                        |
    | ----------------------------- | -------------------------------------------------------------------------------------------- |
    | Native L2 snapshot or history | `/v1/hyperliquid/spot/orderbook/{symbol}`, `/v1/hyperliquid/spot/orderbook/{symbol}/history` |

    Pair symbols such as `HYPE-USDC`. Spot serves native L2 depth; order-level detail on Spot is [L4](/rest-api/order-books-l4).
  </Tab>

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

    | Depth                                     | Route                                                                                        |
    | ----------------------------------------- | -------------------------------------------------------------------------------------------- |
    | Full-depth aggregated L2 from L4          | `/v1/hyperliquid/hip3/orderbook/{symbol}/l2`, `/l2/history`, `/l2/diffs`                     |
    | Native L2 snapshot or history (20 levels) | `/v1/hyperliquid/hip3/orderbook/{symbol}`, `/v1/hyperliquid/hip3/orderbook/{symbol}/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?depth=3" \
      -H "X-API-Key: $OXARCHIVE_API_KEY"
    ```

    | Depth                                   | Route                                                                                        |
    | --------------------------------------- | -------------------------------------------------------------------------------------------- |
    | Native outcome book snapshot or history | `/v1/hyperliquid/hip4/orderbook/{symbol}`, `/v1/hyperliquid/hip4/orderbook/{symbol}/history` |

    Outcome side ids such as `%230` (Yes). Books are probability-priced where documented.
  </Tab>

  <Tab title="Lighter">
    ```bash theme={"theme":"github-dark"}
    curl "https://api.0xarchive.io/v1/lighter/orderbook/{symbol}?depth=3" \
      -H "X-API-Key: $OXARCHIVE_API_KEY"
    ```

    | Depth                  | Route                                                                      |
    | ---------------------- | -------------------------------------------------------------------------- |
    | L2 snapshot or history | `/v1/lighter/orderbook/{symbol}`, `/v1/lighter/orderbook/{symbol}/history` |

    Lighter L2 matches the same `px`/`sz`/`n` shape. For order-level depth on Lighter, use [L3](/rest-api/order-books-l3). Find symbols on `/v1/lighter/instruments`.
  </Tab>
</Tabs>

## Native L2 versus full-depth L2

Hyperliquid core and HIP-3 expose two L2 surfaces, and they answer different questions:

| Job                                              | Route                                                                         | Notes                                                  |
| ------------------------------------------------ | ----------------------------------------------------------------------------- | ------------------------------------------------------ |
| Full-depth aggregated L2                         | `/v1/hyperliquid/orderbook/{symbol}/l2` or the HIP-3 equivalent               | Derived from L4, with March 10, 2026+ coverage         |
| Native source snapshot or older top-book windows | `/v1/hyperliquid/orderbook/{symbol}` and `/history`, or the HIP-3 equivalents | Mirrors the venue snapshot; caps at 20 levels per side |

Native Hyperliquid and HIP-3 L2 routes mirror the venue source snapshot and top out at 20 levels per side. A request like `depth=200` on `/v1/hyperliquid/orderbook/BTC/history` still returns at most 20 levels. For full-depth aggregated L2 on those families, use the `/l2` route family. Spot, HIP-4, and Lighter serve native L2 depth.

## Request parameters

| Parameter      | In    | Type           | Required | Description                                                                                                                                                                   |
| -------------- | ----- | -------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `symbol`       | path  | string         | Yes      | Trading pair symbol, e.g. `BTC`                                                                                                                                               |
| `timestamp`    | query | integer (ms)   | No       | Snapshot routes only; Unix milliseconds; omit for the latest snapshot                                                                                                         |
| `start`, `end` | query | integer (ms)   | No       | History and diff routes; Unix-millisecond window bounds                                                                                                                       |
| `depth`        | query | integer        | No       | Snapshot depth where documented. Native Hyperliquid/HIP-3 L2 caps at 20 levels (venue source limit); full-depth `/l2` snapshots return the depth you request. Not tier-gated. |
| `limit`        | query | integer        | No       | Max rows or checkpoints on history/diff routes                                                                                                                                |
| `cursor`       | query | string/integer | No       | Continuation token from `meta.next_cursor`                                                                                                                                    |

The `/l2/history` routes return the checkpoint's stored full depth and currently do not take a per-request `depth` override. Ask for a bounded `start`/`end` window and paginate with `cursor`.

## Example response

The L2 snapshot returns the same envelope across venues:

```json theme={"theme":"github-dark"}
{
  "success": true,
  "data": {
    "coin": "BTC",
    "symbol": "BTC",
    "timestamp": "2026-06-05T13:53:33.971Z",
    "bids": [
      { "px": "61077.0", "sz": "0.0003", "n": 1 },
      { "px": "61075.0", "sz": "1.60628", "n": 6 }
    ],
    "asks": [
      { "px": "61078.0", "sz": "11.73086", "n": 32 },
      { "px": "61079.0", "sz": "1.45565", "n": 4 }
    ],
    "mid_price": "61077.5",
    "spread": "1",
    "spread_bps": "0.16372641316360362"
  },
  "meta": { "request_id": "req_2c9a7f10b8e34d52" }
}
```

A price level is `px` (price), `sz` (total size), and `n` (order count). `px`, `sz`, `mid_price`, `spread`, and `spread_bps` are decimal strings, so parse them as decimals, not floats. `n` aggregates the orders at a level; [L4](/rest-api/order-books-l4) lists each one with its `oid` and `user_address`. The `/l2` routes also return `bid_levels`, `ask_levels`, `total_bid_size`, and `total_ask_size`. Full field meanings live in the [field dictionary](/responses#field-dictionary), and the [Endpoint reference](/reference) carries the exact types.

## Stream it live

Every venue streams the L2 book. Subscribe to `orderbook` on Hyperliquid core; Spot, HIP-3, and HIP-4 use prefixed variants (`spot_orderbook`, `hip3_orderbook`, and so on), and Lighter adds `lighter_orderbook`.

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

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

## Export in bulk

L2 books export as the `l2_orderbook` schema (`$6/GB`, `$10 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="L3 order book" icon="list-ordered" href="/rest-api/order-books-l3">
    Individual orders on Lighter, order-level detail without full lifecycle.
  </Card>

  <Card title="L4 order book" icon="blocks" href="/rest-api/order-books-l4">
    Every resting order with its `oid` and `user_address`, plus diffs and reconstruction.
  </Card>
</CardGroup>

## Next

Start from [Order books](/rest-api/order-books) for the depth overview, [Order book depth](/core-concepts/order-book-depth) to choose a grain, [Example responses](/response-examples) for more payload shapes, or [Data quality](/data-quality) before any long historical window.
