Skip to main content

Credit Cost

2 per coin per minute (except BTC which is 20 per minute)

Processing

Realtime
Estimate your monthly cost for this API using the Pricing Calculator.
  • GoldRush-native. l4Book is not exposed on wss://api.hyperliquid.xyz/ws. Pointing a client at the public endpoint with this subscription type will fail.
  • Perps only. No spot assets.
  • coin is required. Unlike l2Book and l2BookDiff, you cannot omit coin to stream every asset. Open one subscription per asset.
  • Snapshot, then diffs. The first message is always a Snapshot; every message thereafter is an Updates. Clients must seed local book state from the snapshot and apply diffs from there. On reconnect, drop local state and re-seed from the next snapshot.
  • Per-order detail. Each entry exposes useroidcloidtif, and trigger metadata - enabling queue-position reconstruction, per-trader flow attribution, and microstructure analytics that are not possible with l2Book.
  • See the L4 Order Book recipe for patterns to maintain book state, attribute flow by user, or reconstruct aggregated price levels.
Note: When "coin":"BTC" is used, a credit rate of 20 credits per minute subscribed is applied.

Endpoint

string
required
Your GoldRush API key. Passed as a query parameter at connection time - no Authorization header is used.

Subscribe

Send this JSON message after the connection is established:
string
required
Always "subscribe".
object
required

Example

Unsubscribe

Send the same subscription body with method: "unsubscribe":

Streamed messages

Every message has channel: "l4Book". The data payload contains exactly one of two variants: a Snapshot (emitted once, immediately after subscribe) or an Updates (emitted on each subsequent HyperCore block where the book for coin changed).

Initial snapshot

The first message after subscribe carries the full resting book at the current block. Each entry in levels[0] (bids) and levels[1] (asks) is an individual order - not an aggregated price level.

Incremental updates

Subsequent messages carry only what changed since the previous block. order_statuses describes order lifecycle events (open, etc.); book_diffs carries the corresponding price-level changes.

Response fields

string
Always "l4Book".
object
Contains exactly one of Snapshot or Updates.

Order object

The Order type appears inside Snapshot.levels[*][*] and Updates.order_statuses[*].order.
string | null
Wallet address that owns the order. null when the order is nested inside an order_status (the parent already carries it).
string
Asset symbol.
string
"B" for bid, "A" for ask.
string
Limit price (decimal string).
string
Resting size (decimal string, base units).
int
Hyperliquid order id - stable for the lifetime of the order.
int
Order-placement timestamp in HyperCore milliseconds.
string
Trigger condition string (e.g. "N/A" for plain limit orders).
boolean
True if this is a stop / take-profit trigger order.
string
Trigger price (decimal string, "0.0" for non-trigger orders).
boolean
True if this is a position-level TP/SL.
boolean
True if the order is flagged reduce-only.
string
Hyperliquid order type (e.g. "Limit").
string
Time-in-force (e.g. "Alo", "Gtc", "Ioc").
string | null
Client-supplied order id (hex string), or null if none was provided.
Last reviewed: 2026-06-24