> ## Documentation Index
> Fetch the complete documentation index at: https://docs.asksurf.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Order Book Depth



## OpenAPI

````yaml openapi.json GET /gateway/v1/exchange/depth
openapi: 3.1.0
info:
  title: Hermod
  version: 0.0.1
servers:
  - url: https://api.asksurf.ai
security: []
paths:
  /gateway/v1/exchange/depth:
    get:
      tags:
        - Exchange
      summary: Exchange Order Book Depth
      description: >-
        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.
      operationId: exchange-depth
      parameters:
        - description: Trading pair (e.g. BTC/USDT)
          explode: false
          in: query
          name: pair
          required: true
          schema:
            description: Trading pair (e.g. BTC/USDT)
            examples:
              - BTC/USDT
            type: string
        - description: 'Market type: spot for spot trading, swap for perpetual contracts'
          explode: false
          in: query
          name: type
          schema:
            default: spot
            description: 'Market type: spot for spot trading, swap for perpetual contracts'
            enum:
              - spot
              - swap
            examples:
              - spot
            type: string
        - description: Number of price levels (1-100)
          explode: false
          in: query
          name: limit
          schema:
            default: 20
            description: Number of price levels (1-100)
            examples:
              - 20
            format: int64
            maximum: 100
            minimum: 1
            type: integer
        - description: Exchange identifier
          explode: false
          in: query
          name: exchange
          schema:
            default: binance
            description: Exchange identifier
            enum:
              - binance
              - okx
              - bybit
              - bitget
              - coinbase
              - kraken
              - gate
              - mexc
              - upbit
              - bitstamp
              - deribit
              - bitmex
              - bithumb
            examples:
              - binance
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleListResponseExchangeDepthItem'
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataAPIError'
          description: Error
      security:
        - AccessToken: []
components:
  schemas:
    SimpleListResponseExchangeDepthItem:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - >-
              https://example.com/schemas/SimpleListResponseExchangeDepthItem.json
          format: uri
          readOnly: true
          type: string
        data:
          items:
            $ref: '#/components/schemas/ExchangeDepthItem'
          type:
            - array
            - 'null'
        meta:
          $ref: '#/components/schemas/ObjectResponseMeta'
      required:
        - data
        - meta
      type: object
    DataAPIError:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/schemas/DataAPIError.json
          format: uri
          readOnly: true
          type: string
        error:
          $ref: '#/components/schemas/DataAPIErrorDetail'
      required:
        - error
      type: object
    ExchangeDepthItem:
      additionalProperties: false
      properties:
        ask_depth:
          description: Total ask-side depth in base currency units
          format: double
          type:
            - number
            - 'null'
        asks:
          description: Sell orders, price ascending
          items:
            $ref: '#/components/schemas/ExchangeDepthLevel'
          type:
            - array
            - 'null'
        bid_depth:
          description: Total bid-side depth in base currency units
          format: double
          type:
            - number
            - 'null'
        bids:
          description: Buy orders, price descending
          items:
            $ref: '#/components/schemas/ExchangeDepthLevel'
          type:
            - array
            - 'null'
        exchange:
          description: Exchange identifier
          type: string
        mid_price:
          description: (best_bid + best_ask) / 2
          format: double
          type:
            - number
            - 'null'
        pair:
          description: Trading pair like BTC/USDT
          type: string
        spread:
          description: Best ask - best bid
          format: double
          type:
            - number
            - 'null'
        spread_pct:
          description: Spread as percent of mid price
          format: double
          type:
            - number
            - 'null'
      required:
        - exchange
        - pair
        - bids
        - asks
        - spread
        - spread_pct
        - bid_depth
        - ask_depth
        - mid_price
      type: object
    ObjectResponseMeta:
      additionalProperties: false
      properties:
        cached:
          description: Whether this response was served from cache
          type: boolean
        credits_used:
          description: Credits deducted for this request
          format: int64
          type: integer
      required:
        - credits_used
        - cached
      type: object
    DataAPIErrorDetail:
      additionalProperties: false
      properties:
        code:
          type: string
        message:
          type: string
      required:
        - code
        - message
      type: object
    ExchangeDepthLevel:
      additionalProperties: false
      properties:
        amount:
          description: Amount at this level
          format: double
          type: number
        price:
          description: Price level
          format: double
          type: number
      required:
        - price
        - amount
      type: object

````