l2Book
Get L2 orderbook snapshot with aggregated price levels.
Overview
The l2Book endpoint returns L2 orderbook snapshots — aggregated price levels with total size and order count at each level. Supports optional price aggregation via significant figures and mantissa parameters.
Key details:
Depth-20 snapshots (top 20 bids and asks)
Refreshed once per second
Supports price aggregation (
nSigFigs,mantissa)Returns zstd-compressed msgpack
Request
Endpoint: POST /info
Single coin:
{
"type": "l2Book",
"coin": "ETH"
}Multiple coins:
{
"type": "l2Book",
"coins": ["ETH", "BTC", "SOL"]
}With aggregation:
Parameters:
coin
string
No*
Single coin to fetch. Spot ("@107", "PURR/USDC") and outcome markets ("#2870" etc.) are accepted.
coins
string[]
No*
Multiple coins to fetch. Spot and outcome markets are accepted.
nSigFigs
number
No
Aggregate price levels to N significant figures (2-5).
mantissa
number
No
Snap to mantissa step (2 or 5). Only valid when nSigFigs=5.
* Either coin or coins must be provided. This endpoint has no all-markets / firehose mode — use l2BookDiffSnapshot for that.
Response
Headers:
Content-Type: application/octet-streamContent-Encoding: zstd
Format: Zstd-compressed msgpack L2BookSnapshot:
For multiple coins, each snapshot is returned as a separate zstd-compressed msgpack blob.
Field reference
coin
string
Market symbol
time
number
Block timestamp (milliseconds since epoch)
levels
array
Tuple of [bids, asks]. Bids descending, asks ascending.
levels[][].px
string
Price as decimal string
levels[][].sz
string
Total size at this price level
levels[][].n
number
Number of orders at this level
height
number
Block height of this snapshot
Common errors
400: Missing or invalid
coin/coinsparameter400: Invalid
nSigFigs(must be 2-5) ormantissa(must be 2 or 5 withnSigFigs=5)403: Permission denied - check API key
404
"{coin} is not listed": the coin is not in Hyperliquid's current listings (the dex's perpmeta,spotMetaoroutcomeMeta). Typical causes are a typo, a missing dex prefix (xyz:GOLD, notGOLD), or a market that has not launched yet. Retrying will not help until the coin is listed. Withcoins, this is returned only when no requested coin has a snapshot and every one of them is unlisted; the message names them ("xyz:FOO, xyz:BAR are not listed").404
"snapshot not available — orderbook_service may be starting up, retry shortly": the coin is listed but its snapshot is not ready, which is on our side. Retry after a short delay.429: Rate limit exceeded
With coins, coins that have no snapshot are left out of the response as long as at least one coin has one.
Last updated