Home / API docs / Crypto Order Book API
Crypto Markets

Crypto Order Book API

GET /api/orderbook $0.05 per call USDC on Base · x402

L2 ORDER-BOOK DEPTH — the live bid/ask ladder for any crypto pair, normalized across Coinbase, Binance.US and Kraken (auto-fallback, or pick a source). Returns bids/asks to your depth plus the analytics that matter: mid, spread (absolute + bps), book liquidity per side, and slippage estimates for $1k/$10k/$100k market orders both directions. Deterministic, no keys, ~1.5s cache. ?pair=BTC-USD&depth=50&source=auto

Parameters

NameInDescription
pairqueryrequiredBASE-QUOTE, e.g. BTC-USD, ETH-USD, SOL-USD
depthqueryprice levels per side, 1-200 (default 50)
sourcequeryauto (default), coinbase, binance, kraken

Example request

curl "https://api.webbersites.com/api/orderbook?pair=BTC-USD&depth=50&source=auto"
# first call returns 402 + payment requirements; an x402 client pays and retries automatically

Example response

{
    "pair": "BTC-USD",
    "source": "coinbase",
    "mid": 62655.35,
    "spread": 0.01,
    "spread_bps": 0.002,
    "best_bid": {
        "price": 62655.34,
        "size": 1.25
    },
    "best_ask": {
        "price": 62655.35,
        "size": 0.4
    },
    "liquidity_quote": {
        "bids": 812443.1,
        "asks": 764210.9
    },
    "slippage": {
        "buy": [
            {
                "notional": 100000,
                "fillable": true,
                "avg_price": 62658.15,
                "vs_best_bps": 0.45,
                "filled_base": 1.596
            }
        ],
        "sell": [
            "…"
        ]
    },
    "bids": [
        [
            62655.34,
            1.25
        ]
    ],
    "asks": [
        [
            62655.35,
            0.4
        ]
    ]
}
MCP tool: get_orderbook — via npx -y webbersites-x402-mcp (local, key stays on your machine) or the remote endpoint https://api.webbersites.com/mcp.

How payment works

There is no signup and no API key. Call the endpoint; it replies 402 Payment Required with machine-readable payment requirements. Your client signs a USDC transfer authorization (EIP-3009, gasless) and retries with the X-PAYMENT header — @x402/fetch does this automatically. See the overview for a working snippet.