Crypto order book

$0.001 per call · USDC via x402 · GET /api/crypto-orderbook

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). Send GET /api/crypto-orderbook with the required field pair and pay $0.001 per call over x402 or MPP (there is no free tier). It returns a JSON object with pair, time, sequence, bestBid, bestAsk and 8 more.

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.

Category: Crypto & onchain data · Tags: crypto orderbook depth spread trading market-data

TRY IN PLAYGROUND →

Parameters

NameTypeRequiredDescription
pairstringyesSpot pair as BASE-QUOTE (e.g. BTC-USD, ETH-USD, SOL-USDC)
depthnumbernoPrice levels per side to return (1-100, default 25)

Example request

curl -i "https://agent402.tools/api/crypto-orderbook?pair=BTC-USD"

Without payment this returns HTTP 402 Payment Required with the exact price for crypto-orderbook; any x402 v2 or MPP client pays it and retries.

Example response

{
  "pair": "BTC-USD",
  "time": "2026-07-14T02:40:51Z",
  "sequence": 132601080491,
  "bestBid": 62489.29,
  "bestAsk": 62490.01,
  "midPrice": 62489.65,
  "spread": 0.72,
  "spreadPct": 0.0012,
  "bids": [
    {
      "price": 62489.29,
      "size": 0.81109777,
      "orders": 8
    }
  ],
  "asks": [
    {
      "price": 62490.01,
      "size": 0.5,
      "orders": 3
    }
  ],
  "depth": 1,
  "totalBidLevels": 15653,
  "totalAskLevels": 27473
}
FieldTypeAlways presentIn the example
pairstringyesBTC-USD
timestringyes2026-07-14T02:40:51Z
sequencenumberyes132601080491
bestBidnumberyes62489.29
bestAsknumberyes62490.01
midPricenumberyes62489.65
spreadnumberyes0.72
spreadPctnumberyes0.0012
bidsarray of objectsyes1 item in the example
asksarray of objectsyes1 item in the example
depthnumberyes1
totalBidLevelsnumberyes15653
totalAskLevelsnumberyes27473

From an MCP client

catalog.call {
  "slug": "crypto-orderbook",
  "params": {
    "pair": "BTC-USD"
  }
}

The hosted connector at https://agent402.tools/mcp needs a payment for crypto-orderbook; the stdio package pays it from a wallet or from AGENT402_CREDITS_KEY. Local install: npx -y agent402-mcp.

Errors and behavior

Paid call (JavaScript agent)

import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
client.setSpendControls?.(false); // keep your own spending ceiling in code
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/api/crypto-orderbook?pair=BTC-USD");

Related tools

Perp order book

$0.002 · POST /api/perp-orderbook

Level-2 order book for one perpetual: best bid/ask, mid, spread (absolute and bps), up to 20 levels per side with size a…

Token price by contract address

$0.005 · GET /api/coin-price-by-contract

Live price, market cap, 24h volume and 24h change for ERC-20 / SPL / other chain tokens looked up by CONTRACT ADDRESS on…

Coin profile

$0.008 · GET /api/coin-profile

Full profile of one coin by id: name/symbol, description, categories, contract addresses per platform, links (homepage, …

DEX volume by protocol

$0.001 · POST /api/defi-dex-volume

Decentralized exchanges ranked by 24h spot trading volume from DefiLlama's free DEX overview: per-DEX 24h/7d/30d/1y/all-…

Exchange tickers

$0.008 · GET /api/exchange-tickers

Markets (tickers) listed on one exchange: base/target pair, last price, 24h volume, USD- and BTC-converted last price an…

Tokenized asset

$0.006 · GET /api/rwa-asset

One tokenized real-world asset by id (gold, nvidia, tesla, spy ...): identity, type, image and web slug joined with its …