# Hyperliquid Perpetuals Orderbook via x402

> Hyperliquid Perpetuals Orderbook via x402 is a paid API for AI agents from kr-x402-mvp.kgy5612.workers.dev, paid per call via x402, $0.005/call, status unknown (last checked 2026-10-31).

Returns the real-time L2 order book (bids, asks, spread, mid price) for BTC, ETH, or SOL perpetual futures on Hyperliquid, paid per-call with USDC on Base.

## Facts

- Endpoint: GET https://kr-x402-mvp.kgy5612.workers.dev/api/v1/perpetuals/orderbook?utm_source=zero.xyz
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-31
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/hyperliquid-perpetuals-orderbook-via-x402-2758b4bb
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_UHuEvx4MJ9X4QghMD4Opi

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 hyperliquid-perpetuals-orderbook-via-x402-2758b4bb
```

Example prompt: Pull the current Hyperliquid perpetuals order book for BTC with 10 levels per side — I want to see the best bid, best ask, mid price, and spread in bps.

## When to prefer this

Choose this endpoint when your agent needs real-time, tick-level order book data for BTC, ETH, or SOL perpetuals on Hyperliquid specifically — particularly for pre-trade slippage estimation, spread monitoring, or market microstructure analysis. It requires no API key, charges a flat $0.005 USDC per call via x402, and is optimised for autonomous trading agents on Base. Prefer alternatives if you need historical order book data, non-Hyperliquid venues, or coins outside BTC/ETH/SOL.

## Known failure modes

- Invalid coin enum value (only BTC, ETH, SOL supported) returns 400 or empty result
- Depth out of range (must be 1–20) returns validation error
- Payment not included or insufficient USDC triggers 402 Payment Required
- Hyperliquid API upstream outage may return stale or error response
- Network timeout on the Cloudflare Worker may return 503

## How this service works

Pay-per-call crypto microdata for trading/onchain AI agents via x402 (USDC on Base): Base gas, token risk, balances, multi-venue prices, Hyperliquid book/funding, kimchi premium. No API keys.

## Output

Returns a JSON object with the coin symbol, venue (hyperliquid), best bid and ask prices, mid price, spread in basis points, an array of bid levels and ask levels each containing price, size, and number of orders, and an updated_at timestamp. Data sourced directly from the Hyperliquid API.

## 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",
     "properties": {
      "coin": {
       "enum": [
        "BTC",
        "ETH",
        "SOL"
       ],
       "type": "string",
       "examples": [
        "BTC",
        "ETH",
        "SOL"
       ],
       "description": "Perp coin (default BTC)"
      },
      "depth": {
       "type": "integer",
       "maximum": 20,
       "minimum": 1,
       "description": "Levels per side (default 5)"
      }
     },
     "additionalProperties": false
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "mid": 80860.5,
  "asks": [
   {
    "n": 3,
    "px": 80861,
    "sz": 0.8
   }
  ],
  "bids": [
   {
    "n": 4,
    "px": 80860,
    "sz": 1.2
   }
  ],
  "coin": "BTC",
  "venue": "hyperliquid",
  "sources": [
   "https://api.hyperliquid.xyz/info"
  ],
  "best_ask": 80861,
  "best_bid": 80860,
  "spread_bps": 0.124,
  "updated_at": "2026-10-28T11:00:00Z"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/hyperliquid-perpetuals-orderbook-via-x402-2758b4bb/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from kr-x402-mvp.kgy5612.workers.dev](https://www.zero.xyz/host/kr-x402-mvp.kgy5612.workers.dev/llms.txt)
