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

# Get an order book snapshot

> Aggregated depth for one market: `bids` best first and descending, `asks` best first and ascending, each level the positional pair `[price, quantity]`, both decimal strings. The quantity is the total resting size at that price, not one order's.

`sequence` is the book's revision: the market's own order sequence, read in the same database snapshot as the levels, so it dates them. It only ever moves forward, so two snapshots can be ordered by it — but it counts accepted orders, not book changes, so a cancellation or a fill can change the depth without moving it and a step of more than one is not a gap. **Do not use it to decide whether the book has changed**; compare the `ETag`, which is derived from the levels themselves and therefore moves whenever they do. A conditional re-read with `If-None-Match` answers `304` only when the depth served is byte-for-byte what the client already holds.

**This endpoint is not part of stream synchronisation.** A client keeping a live book subscribes to `order_book` and joins on the snapshot the stream itself sends in band as its first message; there is no window between the two to reason about and nothing to fetch first. This read is for clients that want depth without holding a socket open. The procedure and the sequencing rules belong to the stream protocol.

`depth` names how many levels a side returns and must be one of 1, 5, 10, 20, 50, 100 or 500; omitting it returns 50. The depth is aggregated from the resting orders themselves: an order past its own expiry is not liquidity and is left out, because a taker could not have hit it.




## OpenAPI

````yaml https://raw.githubusercontent.com/bushaHQ/openapi/refs/heads/main/openapi-spec.yaml get /v1/exchange/markets/{symbol}/order_book
openapi: 3.0.0
info:
  title: Busha API
  contact:
    email: developers@busha.co
  description: >
    ## Introduction

    The **Busha API** is designed to provide businesses with tools for
    borderless financial transactions and operations, enabling modern, global
    money management. It serves as the backbone for facilitating:

    - Creation and management of multi-currency balances

    - Retrieval of real-time cryptocurrency rates

    - Substantial data insights for business owners


    Whether you’re a product-driven fintech or a developer building
    integrations, this API significantly accelerates implementation while
    reducing financial complexities.

    For detailed guides on API integration, visit our [official
    documentation]().



    ## Authentication

    All API requests require a **Bearer Token** for authentication, passed in
    the `Authorization` header.

    Your authorization value is a base64 encoded value of your api key and your
    secret key.

    You can obtain API tokens via your Busha user or business account.
    Authentication is mandatory to ensure secure and authorized interactions
    with the API.

    The API keys from the dashboard provides a base64 encoding of the your
    authorization tokens.


    Your generated Key should look like this:

    `VURtNXhWcHueantkpaiewjo0S044MWsadfojienuoxRTiWDJaeWJaTGxxanZ3Ym10OU1RZnVWajVW=`


    Example Header:

    ``` curl

    Authorization: Bearer
    VURtNXhWcHueantkpaiewjo0S044MWsadfojienuoxRTiWDJaeWJaTGxxanZ3Ym10OU1RZnVWajVW=

    ```


    ## Error Handling

    #Standardized error responses ensure predictable interactions. Errors are
    detailed for easy debugging and understanding:

    | **Error Code** | **HTTP Status Code** | **Description** |

    | --- | --- | --- |

    | `bad_request` | 400 | Invalid input or malformed request |

    | `unauthorized` | 401 | Invalid or missing authentication |

    | `not_found` | 404 | Resource not found |

    | `service_unavailable` | 503 | Server error |


    Basic Error Example:

    ``` json

    {
      "error": {
        "name": "bad_request",
        "message": "Invalid input data"
      }
    }

    ```


    Schema Error Body Example:

    ``` json

    {
      "error": {
        "name": "bad_request",
        "message": "Invalid input data"
      },
      "schema": {
        "reason": "The request body is defined as an object. However, it does not meet the schema requirements of the specification",
        "fix": "Ensure that the object being submitted, matches the schema correctly"
      }
    }

    ```


    Field Error Body Example:

    ``` json

    {
      "error": {
        "name": "bad_request",
        "message": "Invalid input data"
      },
      "fields": {
        "field1": [
          {
            "reason": "The request body is defined as an object. However, it does not meet the schema requirements of the specification",
          },
        ],
        "field2": [
          {
            "reason": "The request body is defined as an object. However, it does not meet the schema requirements of the specification",
          }
        ],
      }
    }

    ```


    ## Pagination

    Pagination uses cursors provided as:

    The API supports **cursor-based pagination** for endpoints with large
    datasets. Pagination uses a `next_cursor` and `previous_cursor` returned in
    the response.

    Example Response Format:

    ``` json

    {
      "current_entries_size": 10,
      "next_cursor": "base64_cursor_value",
      "previous_cursor": "base64_previous_cursor_value"
    }

    ```


    ## Rate Limiting

    Rate limits determine how many API calls can be made in a rolling minute.
    This ensures fair and optimized use of system resources.


    The rate limits allowed by each resource will be provided with the header:

    ```curl

    x-rate-limit 100

    ```

    If this header does not exist, then the rate limit is set at a default 100
    req/min


    Requests exceeding the allocated quota will receive a `429 Too Many
    Requests` response.


    ## Rejected business verification

    A business whose verification was rejected is view-only. Every request from
    its members that changes state answers `400` with `error.name =
    "profile_rejected"`, including operations whose per-operation error contract
    does not list that name. Reads, the caller's own session, and notifications
    stay available. Contact support to reopen the case.


    ##  Common Parameters

    Common parameters enhance consistency across endpoints:
      | **Parameter Name** | **Location** | **Description** | **Example** |
      | --- | --- | --- | --- |
      | `X-BU-PROFILE-ID` | Header | User profile identifier | `BUS_qwejinoiuiqw93ejjw` |
      | `id` | Path | Unique NanoID identifier | `dpt_jweqafajsndiun34fd` |
      | `cursor` | Query | Pagination cursor | `base64_cursor_string` |

    #### Paginated Response Example
      ``` json
      {
        "status": "success",
        "message": "Data retrieved",
        "pagination": {
          "next_cursor": "value_for_next_page",
          "current_entries_size": 20
        },
        "data": [...]
      }
      ```
  version: 1.0.0
servers:
  - url: https://api.sandbox.busha.so
    description: Sandbox Environment
  - url: https://api.busha.io
    description: Production Environment
security: []
tags:
  - name: Balances
    description: Handles account balances across different currencies.
  - name: Currencies
    description: >
      Endpoints to manage supported currencies, their properties, and network
      details.
  - name: Customers
    description: Handle customer requests and responses
  - name: Files
    description: Provides APIs to handle files upload
  - name: Insights
    description: Business analytics insights endpoints
  - name: Miscellaneous
    description: Provides auxiliary APIs to complement and enhance other services.
  - name: Pairs
    description: Access trading pair information and rates
  - name: PaymentLinks
    description: Payment Links
  - name: PaymentRequests
    description: Payment request
  - name: Pledges
    description: Customer-authorized pledge lifecycle APIs
  - name: Quotes
    description: Handle quotes requests and responses
  - name: Recipients
  - name: Transactions
  - name: Transfers
paths:
  /v1/exchange/markets/{symbol}/order_book:
    get:
      tags:
        - Exchange
      summary: Get an order book snapshot
      description: >
        Aggregated depth for one market: `bids` best first and descending,
        `asks` best first and ascending, each level the positional pair `[price,
        quantity]`, both decimal strings. The quantity is the total resting size
        at that price, not one order's.


        `sequence` is the book's revision: the market's own order sequence, read
        in the same database snapshot as the levels, so it dates them. It only
        ever moves forward, so two snapshots can be ordered by it — but it
        counts accepted orders, not book changes, so a cancellation or a fill
        can change the depth without moving it and a step of more than one is
        not a gap. **Do not use it to decide whether the book has changed**;
        compare the `ETag`, which is derived from the levels themselves and
        therefore moves whenever they do. A conditional re-read with
        `If-None-Match` answers `304` only when the depth served is
        byte-for-byte what the client already holds.


        **This endpoint is not part of stream synchronisation.** A client
        keeping a live book subscribes to `order_book` and joins on the snapshot
        the stream itself sends in band as its first message; there is no window
        between the two to reason about and nothing to fetch first. This read is
        for clients that want depth without holding a socket open. The procedure
        and the sequencing rules belong to the stream protocol.


        `depth` names how many levels a side returns and must be one of 1, 5,
        10, 20, 50, 100 or 500; omitting it returns 50. The depth is aggregated
        from the resting orders themselves: an order past its own expiry is not
        liquidity and is left out, because a taker could not have hit it.
      operationId: getExchangeOrderBook
      parameters:
        - $ref: '#/components/parameters/SymbolPathParam'
        - name: depth
          in: query
          required: false
          description: Levels per side. One of 1, 5, 10, 20, 50, 100, 500. Defaults to 50.
          schema:
            type: integer
            enum:
              - 1
              - 5
              - 10
              - 20
              - 50
              - 100
              - 500
            example: 5
      responses:
        '200':
          description: Order book
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExchangeOrderBookResponse'
              examples:
                default:
                  summary: Five levels a side on USDT-NGN
                  value:
                    status: success
                    message: Order book retrieved
                    data:
                      sequence: 90114627
                      bids:
                        - - '1371.50'
                          - '4200.00'
                        - - '1371.20'
                          - '6150.00'
                        - - '1370.85'
                          - '11800.00'
                        - - '1370.40'
                          - '9300.00'
                        - - '1369.95'
                          - '22450.00'
                      asks:
                        - - '1372.30'
                          - '3100.00'
                        - - '1372.65'
                          - '5400.00'
                        - - '1373.10'
                          - '10250.00'
                        - - '1373.70'
                          - '8800.00'
                        - - '1374.25'
                          - '19600.00'
                      time: '2026-09-06T12:00:00.482Z'
        4XX:
          $ref: '#/components/responses/ExchangeError4XX'
        5XX:
          $ref: '#/components/responses/ExchangeError5XX'
      security:
        - AuthOptional:
            - exchange:read
            - api:read
components:
  parameters:
    SymbolPathParam:
      name: symbol
      in: path
      required: true
      description: The market symbol, `BASE-QUOTE` in uppercase
      schema:
        $ref: '#/components/schemas/ExchangeSymbol'
  schemas:
    ExchangeOrderBookResponse:
      allOf:
        - $ref: '#/components/schemas/BaseSchema'
        - type: object
          required:
            - data
          properties:
            data:
              $ref: '#/components/schemas/ExchangeOrderBook'
    ExchangeSymbol:
      type: string
      description: >
        A market's one canonical identifier: the base asset, a hyphen, the quote
        asset, all uppercase. `USDT-NGN` means USDT priced in NGN, so a `buy`
        acquires USDT and spends NGN. The same string is used in paths, query
        parameters, request bodies and stream subscriptions; there is no second
        spelling of a market anywhere on this surface.
      pattern: ^[A-Z0-9]{2,10}-[A-Z0-9]{2,10}$
      minLength: 5
      maxLength: 21
      example: USDT-NGN
    BaseSchema:
      description: General response Values
      type: object
      required:
        - status
        - message
      properties:
        status:
          type: string
          enum:
            - success
            - error
          example: success
        message:
          type: string
          example: message for success
    ExchangeOrderBook:
      type: object
      description: Aggregated depth for one market at one revision of the book
      required:
        - sequence
        - bids
        - asks
        - time
      properties:
        sequence:
          type: integer
          format: int64
          description: >
            The book's revision: the market's own order sequence — the number of
            orders the venue has accepted on this book — read in the same
            statement and the same database snapshot as the levels beside it, so
            it dates them exactly.


            It is monotonic and never decreases, which is what lets two
            snapshots be ordered. It is **not** a per-change counter, and a
            client must not treat a step of more than one as a gap: a
            cancellation or a fill changes the book without advancing it, and a
            placement advances it whether or not it changed the visible depth.
            Use it to tell which of two snapshots is newer, not to detect loss
            and not to detect change — the `ETag` is derived from the levels
            themselves and is what moves whenever the book does.


            A client keeping a live book joins on the `order_book` stream's own
            in-band snapshot rather than on this one; the stream's sequencing
            rules are its own and are part of the stream protocol.
          example: 90114627
        bids:
          type: array
          description: >
            Buy levels as `[price, quantity]` pairs, best (highest) price first,
            so `bids[0]` is the best bid. Empty when nothing rests on the buy
            side; never null.
          items:
            $ref: '#/components/schemas/ExchangeOrderBookLevel'
        asks:
          type: array
          description: >
            Sell levels as `[price, quantity]` pairs, best (lowest) price first,
            so `asks[0]` is the best ask. Empty when nothing rests on the sell
            side; never null.
          items:
            $ref: '#/components/schemas/ExchangeOrderBookLevel'
        time:
          $ref: '#/components/schemas/TimeStamp'
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - name
            - message
          properties:
            name:
              type: string
              example: bad_request
            message:
              type: string
              example: Invalid Request
        fields:
          type: object
        schema:
          type: array
          items:
            $ref: '#/components/schemas/SchemaViolation'
      example:
        error:
          name: bad_request
          message: Invalid Request
    ExchangeOrderBookLevel:
      type: array
      minItems: 2
      maxItems: 2
      items:
        type: string
      description: >
        One aggregated price level as the positional pair `[price, quantity]`.
        Element `0` is the price the level rests at; element `1` is the total
        size resting there across every order, not one order's.


        Both are decimal strings with trailing zeros **trimmed**, never padded
        to a fixed width: a level of 1390 for 2 is published as `["1390", "2"]`
        and not as `["1390.00", "2.00"]`. Nothing on this surface pads a decimal
        and nothing can — every amount renders through `decimal.String()` — so a
        client that wants a fixed width formats it itself, reading
        `price_decimals` and `quantity_decimals` off the market row, which is
        what those two fields are for. The example below is written out for
        readability and promises no width; the same rule holds for every decimal
        on this surface.


        The pair is positional rather than a named object because that is what
        every venue an integrator has already written against publishes —
        Binance, Coinbase Exchange and Kraken all return `[price, size]`, and
        CCXT's unified order book is defined in those terms — so a generic
        client reads this book without a special case.


        On the `order_book` stream channel a level's quantity is absolute rather
        than a delta, and a quantity of `"0"` means the price is gone from the
        book rather than that nothing rests there. The channel's own level shape
        is part of the stream protocol.
      example:
        - '1371.50'
        - '4200.00'
    TimeStamp:
      type: string
      format: date-time
      example: '2023-10-15T12:15:30Z'
    SchemaViolation:
      type: object
      description: >
        One thing wrong with the request body: in prose for a person, and in a
        code and a pointer for a program. `reason` and `fix` are written by the
        validation library and their wording changes between releases of it;
        `code` and `pointer` do not, so branch on those.
      properties:
        reason:
          type: string
          description: >-
            What is wrong, in prose. For a person reading a log, not for code to
            match on.
          example: missing property 'additional_info'
        fix:
          type: string
          description: What to do about it, in prose.
          example: Ensure that the object being submitted, matches the schema correctly
        code:
          type: string
          description: >
            What is wrong, as a stable token. `missing-property` for a required
            property left out, `type-mismatch` for a value of the wrong JSON
            type, `enum-mismatch` for a value outside the documented set,
            `pattern-mismatch` for a string that fails its pattern,
            `unknown-property` for a property the endpoint does not declare,
            `malformed-json` for a body that is not JSON at all, and
            `constraint-<keyword>` for any other JSON Schema keyword the body
            tripped.
          example: missing-property
        pointer:
          type: string
          description: >
            Where it is wrong: an RFC 6901 JSON Pointer into the request body.
            The empty string points at the body itself, which is the answer when
            no single property is at fault.
          example: /additional_info
        schema_validation_error:
          type: array
          description: The validator's own specifics, where it produced any.
          items:
            type: string
          example:
            - 'minLength: got 3, want 12'
  responses:
    ExchangeError4XX:
      description: Client error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            default:
              $ref: '#/components/examples/DefaultError'
            not_found_error:
              $ref: '#/components/examples/NotFoundError'
            unauthorized_error:
              $ref: '#/components/examples/UnAuthorizedError'
            request_validation_error:
              $ref: '#/components/examples/RequestValidationError'
            schema_validation_error:
              $ref: '#/components/examples/SchemaValidationError'
            below_min_notional:
              summary: An order under the market's minimum value
              value:
                error:
                  name: below_min_notional
                  message: Order value must be at least 5000 NGN
            market_halted:
              summary: An order against a market that is not accepting them
              value:
                error:
                  name: market_halted
                  message: USDT-NGN is not accepting new orders
    ExchangeError5XX:
      description: Server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            internal_server_error:
              $ref: '#/components/examples/InternalServerError'
            service_unavailable_error:
              $ref: '#/components/examples/ServiceUnavailableError'
  examples:
    DefaultError:
      description: Default error
      value:
        error:
          name: bad_request
          message: Invalid request
    NotFoundError:
      description: Not Found error
      value:
        error:
          name: resource_not_found
          message: Resource Not Found
    UnAuthorizedError:
      description: Unauthorized Error
      value:
        error:
          name: unauthorized
          message: Unauthorized request
    RequestValidationError:
      description: Request Validation error example
      value:
        error:
          name: request_validation
          message: Validation error
        fields:
          field1:
            - reason: One of target and source amount must be set
          field2:
            - reason: One of target and source amount must be set
    SchemaValidationError:
      description: >
        Schema validation error example. One entry per violation, each with its
        own `code` and `pointer` naming what is wrong and where; branch on those
        rather than on the prose beside them.
      value:
        error:
          name: schema_validation
          message: Error Validating Requests
        schema:
          - reason: Missing property 'market'
            fix: >-
              Ensure that the object being submitted, matches the schema
              correctly
            code: missing-property
            pointer: /market
            schema_validation_error:
              - missing property 'market'
          - reason: 'MinLength: got 3, want 12'
            fix: >-
              Ensure that the object being submitted, matches the schema
              correctly
            code: constraint-minlength
            pointer: /additional_info/name
            schema_validation_error:
              - 'minLength: got 3, want 12'
    InternalServerError:
      description: Internal Server Error
      value:
        error:
          name: internal_server_error
          message: Internal Server Error
    ServiceUnavailableError:
      description: Service Unavailable Error
      value:
        error:
          name: service_unavailable
          message: Service Unavailable
  securitySchemes:
    AuthOptional:
      type: http
      scheme: bearer
      description: Bearer Authentication

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.