Skip to main content
The l2Book query returns a full L2 order book snapshot containing all price levels for a contract at a point in time. This is useful for initializing local order book state before connecting to the WebSocket feed. For ongoing updates, subscribe to the WebSocket l2Book channel — subscribing automatically delivers an initial snapshot, so you typically do not need to make this REST call separately.
This endpoint returns HTTP 503 with a NOT_READY error if no book data exists yet (for example, on a cold start or if no orders have ever been placed on the contract). Implement retry logic with exponential backoff when you receive this response.

Request

string
required
Must be "l2Book".
string
required
The contract ID to fetch the order book for, expressed as a decimal string (e.g. "1"). Use the contractId from configs.

Response

string
Contract ID.
integer
Timestamp of the snapshot in Unix milliseconds.
integer
Monotonically increasing version number for this book. Use this to deduplicate or order updates when combining REST snapshots with WebSocket deltas.
string
Current mark price (raw integer string). Returns "0" if the mark price has not yet been published for this contract.
string
Current oracle (index) price (raw integer string). Returns "0" if the oracle price has not yet been published for this contract.
array[]
Two-element array: levels[0] contains bids sorted from highest to lowest price; levels[1] contains asks sorted from lowest to highest price.