# Crypto Order Book Snapshot

> Crypto Order Book Snapshot is a paid API for AI agents from agent402.tools, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-15).

Returns an L2 order-book snapshot for a spot trading pair, including best bid/ask, mid price, spread, and top N aggregated price levels per side.

## Facts

- Endpoint: GET https://agent402.tools/api/crypto-orderbook
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/crypto-order-book-snapshot-0ae7b216
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_46Lz6-XzvKAuLcAg31Lvl

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 crypto-order-book-snapshot-0ae7b216
```

Example prompt: What does the BTC-USD order book look like right now? Show me the top 10 price levels on each side, and tell me the best bid, best ask, mid price, and spread.

## When to prefer this

Use this endpoint when you need a real-time L2 order book snapshot for a spot cryptocurrency pair traded on Coinbase Exchange — especially when you need both best bid/ask metadata AND aggregated depth levels in a single call. Prefer this over a simple ticker when you need spread analysis or market depth information.

## Known failure modes

- Invalid or unsupported pair format (e.g. BTCUSD instead of BTC-USD) returns an error
- Depth value outside 1-100 range is rejected
- Pair not listed on Coinbase Exchange returns a not-found or empty response
- Payment failure (insufficient USDC balance) prevents the call from completing
- Network timeout or exchange feed disruption may return stale or unavailable data

## How this service works

L2 order-book snapshot for a spot pair: best bid/ask, mid price, spread (absolute + %), and the top N aggregated price levels per side (default 25, max 100). Pairs use BASE-QUOTE format (BTC-USD, ETH-USD, SOL-USDC). Backed by Coinbase Exchange's public market-data API - keyless; coverage is Coinbase-listed markets.

## Output

A structured snapshot of the order book for the requested spot pair, including: best bid price, best ask price, mid price, absolute spread, spread as a percentage, and up to N (default 25, max 100) aggregated price levels for both the bid and ask sides.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "pair"
     ],
     "properties": {
      "pair": {
       "type": "string",
       "description": "Spot pair as BASE-QUOTE (e.g. BTC-USD, ETH-USD, SOL-USDC)"
      },
      "depth": {
       "type": "number",
       "description": "Price levels per side to return (1-100, default 25)"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "asks": [
   {
    "size": 0.5,
    "price": 62490.01,
    "orders": 3
   }
  ],
  "bids": [
   {
    "size": 0.81109777,
    "price": 62489.29,
    "orders": 8
   }
  ],
  "pair": "BTC-USD",
  "time": "2026-07-14T02:40:51Z",
  "depth": 1,
  "spread": 0.72,
  "bestAsk": 62490.01,
  "bestBid": 62489.29,
  "midPrice": 62489.65,
  "sequence": 132601080491,
  "spreadPct": 0.0012,
  "totalAskLevels": 27473,
  "totalBidLevels": 15653
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/crypto-order-book-snapshot-0ae7b216/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)
