> ## 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.

# Cancel every order on one market

> Cancels all of the caller's live orders on one market and answers with the orders the cancel applied to. `market` is **required**: a venue-wide cancel with no scope is too easy to fire by accident and too blunt for a maker quoting several books, so it is not offered. Cancel each market in turn, or arm the dead man's switch.

If placement is unavailable, this write returns `503 book_busy` by default.




## OpenAPI

````yaml https://raw.githubusercontent.com/bushaHQ/openapi/refs/heads/main/openapi-spec.yaml delete /v1/exchange/orders
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/orders:
    delete:
      tags:
        - Exchange
      summary: Cancel every order on one market
      description: >
        Cancels all of the caller's live orders on one market and answers with
        the orders the cancel applied to. `market` is **required**: a venue-wide
        cancel with no scope is too easy to fire by accident and too blunt for a
        maker quoting several books, so it is not offered. Cancel each market in
        turn, or arm the dead man's switch.


        If placement is unavailable, this write returns `503 book_busy` by
        default.
      operationId: cancelExchangeOrders
      parameters:
        - $ref: '#/components/parameters/ProfileHeader'
        - name: market
          in: query
          required: true
          description: The market to cancel on. Required.
          schema:
            $ref: '#/components/schemas/ExchangeSymbol'
      responses:
        '200':
          description: Orders cancelled
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExchangeOrderListResponse'
              examples:
                default:
                  value:
                    status: success
                    message: Orders cancelled
                    pagination:
                      current_entries_size: 1
                    data:
                      - id: exo_7Kq2mZ4tRbXn
                        client_order_id: mm-usdtngn-bid-0091
                        market: USDT-NGN
                        side: buy
                        type: limit
                        time_in_force: gtc
                        post_only: true
                        stp_mode: cancel_taker
                        status: cancelled
                        price: '1371.50'
                        quantity: '5000.00'
                        quote_quantity: null
                        filled_quantity: '0.00'
                        filled_quote: '0.00'
                        remaining_quantity: '5000.00'
                        average_price: null
                        cancel_reason: cancel_all
                        maker_fee_rate: '0.0000'
                        taker_fee_rate: '0.0010'
                        created_at: '2026-09-06T12:00:00.115Z'
                        updated_at: '2026-09-06T12:01:11.006Z'
                        expires_at: null
        4XX:
          $ref: '#/components/responses/ExchangeError4XX'
        5XX:
          $ref: '#/components/responses/ExchangeError5XX'
      security:
        - Auth:
            - exchange:trade
            - api:write
components:
  parameters:
    ProfileHeader:
      in: header
      name: X-BU-PROFILE-ID
      required: false
      description: User profile header
      schema:
        type: string
        example: BUS_YOK8tp5Zga01qOKEsqp07
  schemas:
    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
    ExchangeOrderListResponse:
      allOf:
        - $ref: '#/components/schemas/CursorPagination'
        - type: object
          required:
            - data
          properties:
            data:
              type: array
              items:
                $ref: '#/components/schemas/ExchangeOrder'
    CursorPagination:
      allOf:
        - $ref: '#/components/schemas/BaseSchema'
        - type: object
          required:
            - pagination
          properties:
            pagination:
              type: object
              required:
                - current_entries_size
              properties:
                next_cursor:
                  type: string
                  example: MjAyNC0xMC0xNVQxMTowNTo1My45NTkxNDErMDE6MDA=
                current_entries_size:
                  type: integer
                  example: 20
                previous_cursor:
                  type: string
                  example: MjAyNC0xMC0xNVQxMDowNTo1My45NTIxQjE3MDE6MDA=
    ExchangeOrder:
      type: object
      description: >
        One of the caller's orders. Every field is always present and the ones
        that do not apply are `null` rather than absent, so a client's parser
        never has to branch on a missing key. The single exception is
        `cancel_reason`, which is absent on an order that was not cancelled, for
        the reason its own description gives.
      required:
        - id
        - client_order_id
        - market
        - side
        - type
        - time_in_force
        - post_only
        - stp_mode
        - status
        - price
        - quantity
        - quote_quantity
        - filled_quantity
        - filled_quote
        - remaining_quantity
        - average_price
        - maker_fee_rate
        - taker_fee_rate
        - created_at
        - updated_at
        - expires_at
      properties:
        id:
          type: string
          description: The platform's identifier for the order
          example: exo_3Nd8vYpLwGtE
        client_order_id:
          type: string
          nullable: true
          maxLength: 64
          description: The caller's own reference, or `null` if none was supplied
          example: mm-usdtngn-ask-0090
        market:
          $ref: '#/components/schemas/ExchangeSymbol'
        side:
          $ref: '#/components/schemas/ExchangeSide'
        type:
          $ref: '#/components/schemas/ExchangeOrderType'
        time_in_force:
          $ref: '#/components/schemas/ExchangeTimeInForce'
        post_only:
          type: boolean
          description: Whether the order was placed as post-only
          example: true
        stp_mode:
          $ref: '#/components/schemas/ExchangeStpMode'
        status:
          $ref: '#/components/schemas/ExchangeOrderStatus'
        price:
          type: string
          format: decimal
          nullable: true
          description: The limit price, or `null` on a market order that named no cap
          example: '1372.30'
        quantity:
          type: string
          format: decimal
          nullable: true
          description: >-
            The size in the base asset, or `null` on an order sized by
            `quote_quantity`
          example: '5000.00'
        quote_quantity:
          type: string
          format: decimal
          nullable: true
          description: >-
            The spend in the quote asset, or `null` on an order sized by
            `quantity`
          example: null
        filled_quantity:
          allOf:
            - $ref: '#/components/schemas/Decimal'
          description: >-
            How much of the base asset has traded so far. Zero on an untouched
            order.
          example: '1900.00'
        filled_quote:
          allOf:
            - $ref: '#/components/schemas/Decimal'
          description: >
            How much of the quote asset has changed hands so far. Carried
            alongside `filled_quantity` rather than left to the client to
            multiply, because rounding at each fill makes the product and the
            sum disagree.
          example: '2607370.00'
        remaining_quantity:
          type: string
          format: decimal
          nullable: true
          description: >
            What is still open on the order: `quantity` less `filled_quantity`,
            less anything a self-trade decrement removed. It stays as the
            untraded leftover once the order closes, so a client can see what
            never traded. It is `null` exactly where `quantity` is null, and
            otherwise it is the same number the private stream publishes under
            the same name. For a market buy sized by `quote_quantity`, which has
            no quantity of its own, this field is null on the order reads while
            the private stream publishes "0" for the same order.
          example: '3100.00'
        average_price:
          type: string
          format: decimal
          nullable: true
          description: >-
            `filled_quote` divided by `filled_quantity`, or `null` before the
            first fill
          example: '1372.30'
        cancel_reason:
          $ref: '#/components/schemas/ExchangeCancelReason'
        maker_fee_rate:
          allOf:
            - $ref: '#/components/schemas/Decimal'
          description: >
            The fee rate applied to the parts of this order that rested and were
            taken, as a fraction rather than a percentage. Fixed at placement,
            so a later tier change does not reprice a resting order.
          example: '0.0000'
        taker_fee_rate:
          allOf:
            - $ref: '#/components/schemas/Decimal'
          description: >-
            The fee rate applied to the parts of this order that crossed the
            spread, as a fraction
          example: '0.0010'
        created_at:
          $ref: '#/components/schemas/TimeStamp'
        updated_at:
          $ref: '#/components/schemas/TimeStamp'
        expires_at:
          type: string
          format: date-time
          nullable: true
          description: >-
            When the order expires of its own accord, or `null` for a `gtc`
            order
          example: null
    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
    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
    ExchangeSide:
      type: string
      description: The direction of an order or a fill, in terms of the market's base asset
      enum:
        - buy
        - sell
      example: buy
    ExchangeOrderType:
      type: string
      description: >
        `limit` rests at a named price. `market` takes whatever the book offers,
        bounded by `quote_quantity` on a buy and by `quantity` on a sell.
      enum:
        - limit
        - market
      example: limit
    ExchangeTimeInForce:
      type: string
      description: >
        How long the order may live. `gtc` rests until filled or cancelled.
        `ioc` fills what it can immediately and cancels the rest. `fok` fills in
        full immediately or does nothing at all.
      enum:
        - gtc
        - ioc
        - fok
      example: gtc
    ExchangeStpMode:
      type: string
      description: >
        What happens when an order would match the same caller's resting order.
        `cancel_taker` cancels the incoming order, `cancel_maker` cancels the
        resting one, `cancel_both` cancels both, and `decrement` takes the
        crossing quantity off both and lets whatever is left of each carry on.
        Defaults to `cancel_taker`.


        A self-trade is always prevented: there is no value that lets one print.
        That is what every major spot venue does — Binance permits its `NONE`
        mode on none of its live spot symbols, Coinbase Exchange states that
        self-trading is not allowed, and Kraken applies prevention to every
        order.
      enum:
        - cancel_taker
        - cancel_maker
        - cancel_both
        - decrement
      example: cancel_taker
    ExchangeOrderStatus:
      type: string
      description: >
        Where the order stands. `open` and `partially_filled` are live and can
        be cancelled; `filled` and `cancelled` are terminal. A partially filled
        order that is then cancelled ends `cancelled` with its `filled_quantity`
        intact.


        A `market` `buy` sized by `quote_quantity` ends `filled` once it has
        spent the amount: every whole `quantity_step` the amount buys after the
        taker fee is bought, and what is left, less than one step, returns to
        the available balance. `filled_quote` plus the taker fee is what was
        spent. It ends `cancelled` with `immediate_or_cancel` when it bought
        nothing, when the matching walk stopped before the money ran out, or
        when a `decrement` self-trade prevention took part of the amount off
        without spending it.
      enum:
        - open
        - partially_filled
        - filled
        - cancelled
      example: open
    Decimal:
      type: string
      description: decimal value
      example: '100'
    ExchangeCancelReason:
      type: string
      description: >
        Why a `cancelled` order was cancelled. It is the field a maker reads to
        tell an intentional withdrawal from one the venue forced.


        This is the one field on an order that is **absent** rather than `null`
        when it does not apply. An enum cannot admit `null` in OpenAPI 3.0
        without carrying `null` as a member of the enum itself, which generates
        a nonsense `"<nil>"` constant a Go client could send by accident; on a
        trading API that is a worse hazard than one optional key.


        `admin` is a cancel the **venue** made rather than you: a staff member
        took the order off the book, either on its own or as part of clearing
        the whole market during an incident. Support can say who and why. It is
        deliberately not folded into `user_requested`, because a maker
        reconciling a morning of vanished quotes needs to tell "I cancelled
        these" from "somebody at the venue did", and only the second is worth a
        conversation.


        `dust_remainder` means a remainder the book cannot trade: its executable
        quantity is zero or worth less than one minor unit of the quote asset at
        its own price (one kobo on an NGN book). Executable quantity is the
        remainder floored to the quantity step. When the walk reaches it, the
        venue retires it, returns its collateral, and continues to the next
        maker. A larger tradeable legacy off-step remainder supplies whole
        steps; its sub-step crumb is retired the next time it is reached.


        `crossing_depth_exhausted` means the taker still had quantity remaining
        after reading the market's maximum crossing depth. Its remainder is
        cancelled and its unused collateral returned rather than resting against
        makers the bounded read did not reach.

        `price_protection` means a market order's remainder could not fill
        inside its protection price: the market's reference price less (for a
        sell) or plus (for a buy) the market's price protection share, fixed
        when the order arrived. The remainder is cancelled and its unused
        collateral returned. Place a limit order to trade further from the
        market.

        `price_band` means the market's price band stopped the order. Its next
        fill, or the price its remainder would rest at, lay further from the
        market's reference price than the band allows, or a resting order
        outside the band stood in its way. The band is the market's breaker
        threshold either side of the reference price, fixed when the order
        arrived. The rest is cancelled and its unused collateral returned (FIX
        OrdRejReason 8, "Price exceeds current price band").
      enum:
        - user_requested
        - cancel_all
        - dead_mans_switch
        - admin
        - dust_remainder
        - crossing_depth_exhausted
        - price_protection
        - price_band
        - post_only_would_cross
        - immediate_or_cancel
        - fill_or_kill
        - self_trade_prevention
        - market_halted
        - expired
        - insufficient_available
      example: user_requested
    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:
    Auth:
      type: http
      scheme: bearer
      description: Bearer Authentication

````

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