l2BookDiffSnapshot | Hyperliquid Info API
Info API
l2BookDiffSnapshot | Hyperliquid Info API
Hyperliquid l2BookDiffSnapshot: fetch a full-depth L2 order book snapshot for one coin, carrying the height, epoch, and per-coin seq needed to bootstrap and align the l2BookDiff2 diff stream.
POST
l2BookDiffSnapshot | Hyperliquid Info API
Processing
Realtime
type: "l2BookDiffSnapshot" is used to fetch a full-depth L2 order book snapshot for one coin, carrying the height, epoch, and per-coin seq needed to bootstrap and align the l2BookDiff2 diff stream.
- GoldRush-native.
l2BookDiffSnapshotis not aPOST api.hyperliquid.xyz/infomethod - it is served only by the GoldRush endpoint. - Bootstrap for
l2BookDiff2. That WebSocket stream is diff-only; this endpoint provides the initial book to seed from, plus theheight/epoch/seqto align the diffs onto it. - Full depth. Unlike the 20-level
l2Booksnapshot, this returns the complete resting book for the coin so your reconstruction starts from a complete state. - The snapshot already reflects every diff up to and including its own
height(it is taken after that block is applied), so discard any diff at or below it.
coin - two arrays of price levels (bids first, then asks), each carrying price, resting size, and order count - together with the height, epoch, and per-coin seq that tie the snapshot to the l2BookDiff2 stream.
Endpoint
Request
string
default:"l2BookDiffSnapshot"
required
Always
"l2BookDiffSnapshot".string
required
The asset symbol, e.g.
"BTC". For HIP-3 markets use the deployer-prefixed form; for spot use the pair symbol or @<index>.Example
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.
Field descriptions
px and sz are returned as decimal strings, preserving upstream precision. Do not parse them as floats.string
The asset the book is for - echoes the request
coin.int
Snapshot timestamp in milliseconds since Unix epoch.
int
HyperCore block height the snapshot was taken at. Discard any
l2BookDiff2 batch whose block_height is ≤ this value.string
Server generation (UUID). Must match the
epoch on the l2BookDiff2 batches you apply; a different epoch means the stream reset and you should re-fetch.int
The per-coin sequence this snapshot is aligned to. The first
l2BookDiff2 diff you apply for this coin should have prev_seq == seq.array<array<object>>
Two-element array:
levels[0] are bids (highest price first), levels[1] are asks (lowest price first). Full depth.Bootstrapping the l2BookDiff2 stream
Use this snapshot to seed a local book, then keep it current with thel2BookDiff2 WebSocket stream:
- Subscribe to
l2BookDiff2for your coin(s) and start bufferingUpdates. - Fetch this snapshot; note
height,epoch, andseq. - Drop any buffered batch whose
block_height≤height. - Confirm each remaining batch’s
epochequals this snapshot’sepoch(else re-fetch). - Apply diffs in order - the first for the coin has
prev_seq == seq. - Keep checking per-coin
prev_seqcontinuity; on a gap orepochchange, re-fetch and re-bootstrap.
Related endpoints
l2BookDiff2
The diff-only WebSocket stream this snapshot bootstraps.
l2Book
20-level point-in-time L2 order book snapshot.