Skip to content

Perp order book

$0.002 per callUSDC via x402POST /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 and order count, cumulative depth in coins and USD on each side, and the bid/ask imbalance within the requested depth. Send POST /api/perp-orderbook with the required field coin and pay $0.002 per call over x402 or MPP (there is no free tier). It returns a JSON object with source, coin, time, bestBid, bestAsk and 9 more.

Hyperliquid public data, no key.

Category: Crypto & onchain dataTags: crypto derivatives perpetuals orderbook depth spread hyperliquid

Try in playground →

Parameters

NameTypeRequiredDescription
coinstringyesPerp ticker, e.g. BTC, ETH, SOL. Also accepted as symbol, id, ticker, asset, currency.
depthnumbernoLevels per side to return (default 10, max 20).

Example request

curl -i -X POST https://agent402.tools/api/perp-orderbook \
  -H "Content-Type: application/json" \
  -d '{"coin":"BTC","depth":5}'

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

Watch a call get paid

RequestPOST /api/perp-orderbook
402$0.002 USDC
SignPAYMENT-SIGNATURE
Settleon 14 chains
Answer200 OK
ReceiptAgent402-ReceiptEd25519

Example response

{
  "source": "hyperliquid",
  "coin": "BTC",
  "time": "2026-08-22T12:00:00.000Z",
  "bestBid": 77279,
  "bestAsk": 77280,
  "mid": 77279.5,
  "spread": 1,
  "spreadBps": 0.129,
  "bids": [
    {
      "px": 77279,
      "sz": 3.13,
      "n": 10
    }
  ],
  "asks": [
    {
      "px": 77280,
      "sz": 1.2,
      "n": 4
    }
  ],
  "bidDepth": {
    "levels": 5,
    "size": 6.1,
    "notionalUsd": 471000
  },
  "askDepth": {
    "levels": 5,
    "size": 4.2,
    "notionalUsd": 324000
  },
  "imbalance": 0.185,
  "fetchedAt": "2026-08-22T12:00:00.000Z"
}
FieldTypeAlways presentIn the example
sourcestringyeshyperliquid
coinstringyesBTC
timestringyes2026-08-22T12:00:00.000Z
bestBidnumberyes77279
bestAsknumberyes77280
midnumberyes77279.5
spreadnumberyes1
spreadBpsnumberyes0.129
bidsarray of objectsyes1 item in the example
asksarray of objectsyes1 item in the example
bidDepthobjectyes3 fields: levels, size, notionalUsd
askDepthobjectyes3 fields: levels, size, notionalUsd
imbalancenumberyes0.185
fetchedAtstringyes2026-08-22T12:00:00.000Z

From an MCP client

catalog.call {
  "slug": "perp-orderbook",
  "params": {
    "coin": "BTC",
    "depth": 5
  }
}

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

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?.({ maxAmountPerPayment: "$0.002" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/api/perp-orderbook", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "coin": "BTC",
    "depth": 5
  }),
});

Related tools

Perp premium and predicted funding

$0.002POST /api/perp-basis

Basis view for one perpetual: mark, oracle and mid price, mark-vs-oracle premium in percent and bps, the impact premium.

Perp dex limits and status (HIP-3)

$0.002POST /api/perp-dex-limits

Risk limits and status of ONE builder-deployed perp dex (HIP-3): total open-interest cap, per-perp OI size cap, max.

Perp dex markets snapshot (HIP-3)

$0.003POST /api/perp-dex-markets

Snapshot of every market on ONE builder-deployed perp dex (HIP-3): mark and oracle price, 24h change, hourly funding.

Perp dexs (HIP-3 builder-deployed)

$0.002POST /api/perp-dexs

Every builder-deployed perpetuals dex on Hyperliquid (HIP-3): dex name, full name, deployer, oracle updater and fee.

Perp funding rate and history

$0.002POST /api/perp-funding

Current funding rate for one perpetual (hourly, per 8h and annualized) plus the last N hourly funding prints.

Perp candles (OHLCV)

$0.001POST /api/perp-klines

OHLCV candles for one perpetual at intervals from 1m to 1M (1m 3m 5m 15m 30m 1h 2h 4h 8h 12h 1d 3d 1w 1M), newest last.