Order Book Depth

GET/gateway/v1/exchange/depth

Returns order book bid/ask levels with computed stats.

Included fields: spread, spread percentage, mid-price, and total bid/ask depth.

Use `limit` to control the number of price levels (1–100, default 20). Set `type=swap` to query perpetual contract order books instead of spot.

Query Parameters

pairstringrequired

Trading pair (e.g. BTC/USDT)

Example: BTC/USDT
typeenum<string>

Market type: spot for spot trading, swap/perpetual/perp for perpetual contracts

Available options:spotswapperpetualperp
Example: spot
limitinteger

Number of price levels (1-100)

Example: 20
exchangeenum<string>

Exchange identifier. Note: hyperliquid uses USDC-settled perps (e.g. BTC/USDC:USDC); pass USDC-quoted pairs when querying hyperliquid.

Available options:binanceokxbybitbitgetcoinbasekrakengatemexcupbitbitstampderibitbitmexbithumbhyperliquid
Example: binance
Order Book Depth
const options = {method: 'GET'};

fetch('https://api.asksurf.ai/gateway/v1/exchange/depth?pair=BTC/USDT&type=spot&limit=20&exchange=binance', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
OK
{
  "$schema": "https://example.com/schemas/SimpleListResponseExchangeDepthItem.json",
  "data": [
    {
      "ask_depth": 123,
      "asks": [
        {
          "amount": 123,
          "price": 123
        }
      ],
      "bid_depth": 123,
      "bids": [
        {
          "amount": 123,
          "price": 123
        }
      ],
      "exchange": "<string>",
      "mid_price": 123,
      "pair": "<string>",
      "spread": 123,
      "spread_pct": 123
    }
  ],
  "meta": {
    "cached": true,
    "credits_used": 123,
    "empty_reason": "<string>"
  }
}