# Agent402 Perpetuals Orderbook

> Agent402 Perpetuals Orderbook is a paid API for AI agents from agent402.tools, paid per call via x402, $0.002/call, status unknown (last checked 2026-09-14).

Returns a live CLOB orderbook snapshot for a perpetual futures market, including bid/ask levels, spread, depth, and imbalance metrics.

## Facts

- Endpoint: POST https://agent402.tools/api/perp-orderbook
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agent402-perpetuals-orderbook-1a60a59d
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_-QL4kuk1W-5CoTsFZiKgM

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability agent402-perpetuals-orderbook-1a60a59d -d '<json body>'
```

Example prompt: What does the BTC perpetual futures orderbook look like right now — give me the top 15 levels on each side so I can see the spread and depth.

## When to prefer this

Choose this endpoint when you need a real-time perpetual futures orderbook snapshot with structured depth and imbalance analytics, sourced from Hyperliquid, without requiring API keys or account signup — payment is handled per-call via USDC over x402. Prefer it over exchange-direct APIs when operating in a wallet-native, agent-first context or when you need pre-computed spread and depth metrics rather than raw tick data.

## Known failure modes

- Invalid or unsupported ticker symbol returns an error — only perp markets listed on Hyperliquid are supported
- Depth value exceeding 20 may be rejected or clamped
- Payment failure or insufficient USDC balance results in a 402 Payment Required response
- Temporary unavailability of the underlying Hyperliquid data source may yield a timeout or stale data error

## How this service works

The live level-2 order book for one perpetual: best bid and ask, mid, spread in basis points, up to 20 levels a side with cumulative depth and bid/ask imbalance. Use it when an agent is sizing an order, checking liquidity before a trade or measuring book pressure at a point in time.

## Output

Returns a JSON object with the mid price, best bid and best ask prices, an array of bid levels and ask levels (each with price, size, and level count), spread in raw and basis-point terms, aggregated bid/ask depth (total size and notional USD across requested levels), an order imbalance score, the source exchange (Hyperliquid), and fetch/event timestamps.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "coin": {
   "type": "string",
   "description": "Perp ticker, e.g. BTC, ETH, SOL."
  },
  "depth": {
   "type": "number",
   "description": "Levels per side to return (default 10, max 20)."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "mid": 77279.5,
  "asks": [
   {
    "n": 4,
    "px": 77280,
    "sz": 1.2
   }
  ],
  "bids": [
   {
    "n": 10,
    "px": 77279,
    "sz": 3.13
   }
  ],
  "coin": "BTC",
  "time": "2026-08-22T12:00:00.000Z",
  "source": "hyperliquid",
  "spread": 1,
  "bestAsk": 77280,
  "bestBid": 77279,
  "askDepth": {
   "size": 4.2,
   "levels": 5,
   "notionalUsd": 324000
  },
  "bidDepth": {
   "size": 6.1,
   "levels": 5,
   "notionalUsd": 471000
  },
  "fetchedAt": "2026-08-22T12:00:00.000Z",
  "imbalance": 0.185,
  "spreadBps": 0.129
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent402-perpetuals-orderbook-1a60a59d/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent402.tools](https://www.zero.xyz/host/agent402.tools/llms.txt)
