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

# Get order book levels

> Returns aggregated bid or ask levels for one market. Use this endpoint for focused depth checks when you only need one side of the book.



## OpenAPI

````yaml /openapi/openapi.json get /partner/exchange/orderbook/{pair_id}/levels
openapi: 3.1.0
info:
  title: Stabyl API
  description: >-
    REST API for approved Stabyl accounts to automate exchange, wallet, and
    non-production simulation workflows.
  contact:
    name: Stabyl Support
    email: support@stabyl.com
  license:
    name: Proprietary
  version: 1.0.0
servers:
  - url: https://api.stabyl.com/v1
    description: Production
  - url: https://api-staging.stabyl.com/v1
    description: Staging
security: []
tags:
  - name: Exchange
    description: Trading market data and order management for account automation.
  - name: Wallets
    description: >-
      Supported routes, deposit destinations, balances, transactions, and saved
      recipients.
  - name: Webhooks
    description: >-
      Outbound event delivery configuration and eventually consistent delivery
      history. Verify Standard Webhooks webhook-id, webhook-timestamp, and
      webhook-signature headers against the unchanged raw request body before
      parsing JSON.
  - name: Simulation
    description: Non-production endpoints for testing integration behavior.
paths:
  /partner/exchange/orderbook/{pair_id}/levels:
    get:
      tags:
        - Exchange
      summary: Get order book levels
      description: >-
        Returns aggregated bid or ask levels for one market. Use this endpoint
        for focused depth checks when you only need one side of the book.
      operationId: get_partner_exchange_orderbook_pair_id_levels
      parameters:
        - name: pair_id
          in: path
          description: >-
            Trading pair identifier returned by `GET /partner/exchange/markets`.
            URL-encode `/` as `%2F` in path parameters, for example `USD%2FNGN`.
          required: true
          schema:
            type: string
          example: USD%2FNGN
        - name: side
          in: query
          description: Order book side. Use `bid` for buys or `ask` for sells.
          required: true
          schema:
            type: string
          example: bid
        - name: limit
          in: query
          description: Maximum number of price levels to return.
          required: false
          schema:
            type:
              - integer
              - 'null'
            format: int64
          example: 20
      responses:
        '200':
          description: Order book levels
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/OrderBookLevelsResponse'
                  status:
                    type: string
                    enum:
                      - success
              example:
                data:
                  levels:
                    - price: '1650.00'
                      quantity: '100.00'
                  pair_id: USD/NGN
                  side: bid
                  timestamp: '2026-05-24T12:00:00Z'
                status: success
        '400':
          description: Invalid side parameter
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: string
                        example: VALIDATION_FAILED
                      message:
                        type: string
                        example: invalid request parameters
                  status:
                    type: string
                    enum:
                      - error
              example:
                error:
                  code: VALIDATION_FAILED
                  message: invalid request parameters
                status: error
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: string
                        example: UNAUTHORIZED
                      message:
                        type: string
                        example: missing X-Api-Key header
                  status:
                    type: string
                    enum:
                      - error
              example:
                error:
                  code: UNAUTHORIZED
                  message: missing X-Api-Key header
                status: error
      security:
        - api_key: []
components:
  schemas:
    OrderBookLevelsResponse:
      type: object
      description: Aggregated order book levels for one side of a trading pair.
      required:
        - pair_id
        - side
        - levels
        - timestamp
      properties:
        levels:
          type: array
          items:
            $ref: '#/components/schemas/PriceLevel'
          description: Price levels
        pair_id:
          type: string
          description: Trading pair identifier
          example: USD/NGN
        side:
          type: string
          description: Side of the order book
          example: bid
        timestamp:
          type: string
          description: Timestamp of the snapshot
    PriceLevel:
      type: object
      description: Aggregated price and quantity available at one order book level.
      required:
        - price
        - quantity
      properties:
        price:
          type: string
          description: Price at this level
          example: '1650.50'
        quantity:
          type: string
          description: Total quantity at this price
          example: '100.00'
  securitySchemes:
    api_key:
      type: apiKey
      in: header
      name: X-Api-Key
      description: >-
        API credential. Withdrawal quote and submit operations additionally
        require the documented Ed25519 timestamp, nonce, and signature headers.
      x-default: sb_test_your_key

````