# l2Book

## Subscribe to l2Book

> Subscription to L2 order book events for a specific asset.

```json
{"openapi":"3.1.1","info":{"title":"Hyperliquid Subscription - l2Book","version":"1.0.0"},"tags":[{"name":"l2Book"}],"servers":[{"url":"wss://api.hyperliquid.xyz/ws","description":"Mainnet WebSocket"},{"url":"wss://api.hyperliquid-testnet.xyz/ws","description":"Testnet WebSocket"}],"paths":{"/":{"post":{"tags":["l2Book"],"summary":"Subscribe to l2Book","description":"Subscription to L2 order book events for a specific asset.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"description":"Type of subscription.","enum":["l2Book"]},"coin":{"type":"string","description":"Asset symbol (e.g., BTC)."},"nSigFigs":{"anyOf":[{"enum":[2,3,4,5],"nullable":true}],"description":"Number of significant figures."},"mantissa":{"anyOf":[{"enum":[2,5],"nullable":true}],"description":"Mantissa for aggregation (if `nSigFigs` is 5)."}},"required":["type","coin"],"description":"Subscription to L2 order book events for a specific asset."}}},"required":true},"responses":{"200":{"description":"Event of L2 order book snapshot.","content":{"application/json":{"schema":{"type":"object","properties":{"coin":{"type":"string","description":"Asset symbol."},"time":{"type":"integer","minimum":0,"description":"Timestamp of the snapshot (in ms since epoch)."},"levels":{"type":"array","items":[{"type":"array","items":{"type":"object","properties":{"px":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","description":"Price."},"sz":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","description":"Total size."},"n":{"type":"integer","minimum":0,"description":"Number of individual orders."}},"required":["px","sz","n"],"description":"L2 order book level."}},{"type":"array","items":{"type":"object","properties":{"px":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","description":"Price."},"sz":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","description":"Total size."},"n":{"type":"integer","minimum":0,"description":"Number of individual orders."}},"required":["px","sz","n"],"description":"L2 order book level."}}],"minItems":2,"description":"Bid and ask levels (index 0 = bids, index 1 = asks)."}},"required":["coin","time","levels"],"description":"Event of L2 order book snapshot."}}}}}}}}}
```
