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

# l2Book | Hyperliquid Info API

> Hyperliquid l2Book: fetch an aggregated Level-2 order book snapshot for a single coin - bids and asks as price, size, and order-count levels.

> [card] Credit Cost
>
> 1 per call

> [card] Processing
>
> Realtime

The Hyperliquid info endpoint with `type: "l2Book"` is used to fetch an aggregated Level-2 order book snapshot for a single coin - bids and asks as price, size, and order-count levels.

> [!TIP]
>
> Estimate your monthly cost for this API using the [Pricing Calculator](https://goldrush.dev/docs/pricing-calculator.md?endpoint=%2Fapi-reference%2Fhyperliquid-info%2Fl2-book).

> [!NOTE]
>
> * Wire-equal to `POST api.hyperliquid.xyz/info` with `{"type": "l2Book", "coin": "..."}`.
> * Returns at most 20 levels per side.
> * For a continuous push stream instead of polling snapshots, subscribe to the [WebSocket API `l2Book`](https://goldrush.dev/docs/api-reference/hyperliquid-websocket/l2-book) channel (optional wildcard `coin`) or the GoldRush-native [`l2BookDiff`](https://goldrush.dev/docs/api-reference/hyperliquid-websocket/l2-book-diff) for incremental updates.

Returns a point-in-time aggregated order book for one `coin`: two arrays of price levels (bids first, then asks), each level carrying the price, the total resting size at that price, and the number of orders comprising it. Use it for a one-shot depth snapshot, spread checks, or seeding a book before switching to a diff stream.

## Endpoint

```
POST https://hypercore.goldrushdata.com/info
Authorization: Bearer <GOLDRUSH_API_KEY>
Content-Type: application/json
```

## Request

**type** `string` *required* (default: l2Book)

Always `"l2Book"`.

**coin** `string` *required*

The asset symbol, e.g. `"BTC"`. For HIP-3 markets use the deployer-prefixed form (e.g. `"xyz:GOLD"`); for spot use the pair symbol or `@<index>`.

**nSigFigs** `int`

Number of significant figures to aggregate price levels to (`2`-`5`). Omit or pass `null` for full precision.

**mantissa** `int`

Optional mantissa for price-level bucketing. Only valid when `nSigFigs` is `5`. Omit or pass `null` for the default.

### Example

```bash cURL theme={null}
curl -X POST https://hypercore.goldrushdata.com/info \
  -H "Authorization: Bearer $GOLDRUSH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "l2Book",
    "coin": "BTC"
  }'
```

```typescript TypeScript theme={null}
const response = await fetch("https://hypercore.goldrushdata.com/info", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.GOLDRUSH_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    type: "l2Book",
    coin: "BTC",
  }),
});

const book = await response.json();
const [bids, asks] = book.levels;
```

```python Python theme={null}
import os, requests

response = requests.post(
    "https://hypercore.goldrushdata.com/info",
    headers={"Authorization": f"Bearer {os.environ['GOLDRUSH_API_KEY']}"},
    json={"type": "l2Book", "coin": "BTC"},
)

book = response.json()
bids, asks = book["levels"]
```

## Response

A single JSON object. `levels` is a two-element array: element 0 is the bid side (descending price), element 1 is the ask side (ascending price). Each level is a `{px, sz, n}` object.

```json theme={null}
{
  "coin": "BTC",
  "time": 1780940795265,
  "levels": [
    [
      { "px": "63405.0", "sz": "4.43382", "n": 36 },
      { "px": "63404.0", "sz": "3.38588", "n": 44 }
    ],
    [
      { "px": "63406.0", "sz": "0.00347", "n": 3 },
      { "px": "63407.0", "sz": "0.00017", "n": 1 }
    ]
  ]
}
```

### Field descriptions

> [!NOTE]
>
> `px` and `sz` are returned as **decimal strings**, preserving upstream precision. Do not parse them as floats.

**coin** `string`

The asset the book is for - echoes the request `coin`.

**time** `int`

Snapshot timestamp in milliseconds since Unix epoch.

**levels** `array\<array\<object\>\>`

Two-element array: `levels[0]` are bids (sorted highest price first), `levels[1]` are asks (sorted lowest price first). Each side defaults to up to 20 aggregated levels.

**level properties**

**px** `string`

Price of the level.

**sz** `string`

Total resting size at this price.

**n** `int`

Number of individual orders aggregated into this level.

## Related endpoints

> [card] [l2BookDiffSnapshot](https://goldrush.dev/docs/api-reference/hyperliquid-info/l2-book-diff-snapshot.md)
>
> fetch a full-depth L2 order book snapshot for one coin, with height, epoch, and seq to bootstrap the l2BookDiff2 stream.

> [card] [allMids](https://goldrush.dev/docs/api-reference/hyperliquid-info/all-mids.md)
>
> fetch the current mid price for every actively traded asset in a single call.

> [card] [candleSnapshot](https://goldrush.dev/docs/api-reference/hyperliquid-info/candle-snapshot.md)
>
> fetch historical OHLCV candles for a coin and interval over a time window for charting and backtesting.

> [card] [fundingHistory](https://goldrush.dev/docs/api-reference/hyperliquid-info/funding-history.md)
>
> fetch a coin’s historical funding rates and premiums over a time window for funding analytics and basis strategies.

See all Hyperliquid endpoints: [Overview hub](https://goldrush.dev/docs/goldrush-hyperliquid/overview.md) · [Info API reference](https://goldrush.dev/docs/goldrush-hyperliquid/info-api/overview.md)

*Last reviewed: 2026-06-16*


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.