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

# Cancel orders

> Cancels the orders you name and returns one CancelResult per identifier, so one call can partly succeed. A Failed result carries the error code CancelOrder would return for that identifier, with the same meaning. Errors that stop the whole batch, such as authentication or a missing account, are returned as an ordinary error instead. Safe to repeat.



## OpenAPI

````yaml api-reference/platform/plurex-platform-api.yaml POST /api/v1/hosts/command/CancelOrders
openapi: 3.2.0
info:
  title: Plurex Platform API
  version: 1.0.0
  description: >-
    Trade across exchanges and brokers through one API, and paper trade any of
    them with the same calls.


    **Venues** are the exchanges where markets trade. Venue operations are
    public market data: markets, order books, recent trades, prices, quotes,
    statistics, funding, open interest and candles. They need no API key.


    **Hosts** hold trading accounts and execute orders on a venue's markets, for
    example an exchange's own account service or a broker. Host operations cover
    each host's tradable markets and order rules, and every account action:
    orders, fills, balances, positions, margin, leverage and transactions. A
    venue market tells you what is trading; the matching host market tells you
    what you may order there.


    **Tenants** own trading resources: every account belongs to one tenant. You
    act as your tenant, and your API keys are created under it. Find your tenant
    ID next to your API keys on the DevTools page of the Plurex app.


    **Accounts** are your accounts on hosts. Connect an exchange or broker
    account with its API credentials, or create a **paper** account. A paper
    host simulates a real host against that venue's live order book, so a paper
    account trades through exactly the same host operations and can be switched
    for a real one without code changes.


    **Capabilities.** Hosts and venues differ. Each host and venue lists every
    operation it supports, and each market lists its order types, settings and
    market data. Check these before calling: an unsupported call returns 422
    NotSupported.


    **Requests.** Every operation is a POST with a JSON body (Content-Type
    application/json). Account operations need both the X-API-KEY and
    X-API-SECRET headers. Unknown fields, unknown enum values and wrong types
    are rejected with 400. Every error has the ErrorEnvelope shape; its code
    says what went wrong. Account changes also arrive as WebSocket streams,
    described in the AsyncAPI document.


    **Compatibility.** Enum values, union variants, error codes and fields are
    added over time without a new version. Ignore fields you do not recognise,
    and treat unknown enum values and variants as an unrecognised case instead
    of failing. Removing or renaming any of them would be a breaking change.
servers:
  - url: https://api.plurex.io
security:
  - ApiKey: []
    ApiSecret: []
tags:
  - name: venues
    summary: Market data
    description: >-
      Public market data from the exchanges where markets trade. No API key
      needed.
    kind: nav
  - name: venue-markets
    summary: Venues and markets
    description: The venues and their markets, with the market data each market supports.
    parent: venues
    kind: nav
  - name: order-books
    summary: Order books
    description: A market's current bids and asks.
    parent: venues
    kind: nav
  - name: public-trades
    summary: Public trades
    description: A market's recent public trades.
    parent: venues
    kind: nav
  - name: market-observations
    summary: Prices and market statistics
    description: >-
      Current prices, best quotes, statistics, indicative funding and open
      interest, read in batches of instruments.
    parent: venues
    kind: nav
  - name: candles
    summary: Candles
    description: Closed OHLC candles by price kind and interval, newest first.
    parent: venues
    kind: nav
  - name: hosts
    summary: Trading
    description: >-
      Trading on an account: each host's tradable markets and order rules,
      orders, fills, balances, positions, margin, market settings and
      transactions. Paper accounts use these same operations.
    kind: nav
  - name: host-markets
    summary: Hosts and markets
    description: >-
      The hosts and their tradable markets, with each market's order types,
      order rules and settings.
    parent: hosts
    kind: nav
  - name: orders
    summary: Orders
    description: Submit, cancel and read orders.
    parent: hosts
    kind: nav
  - name: fills
    summary: Fills
    description: The account's executions, by order, instrument or across the account.
    parent: hosts
    kind: nav
  - name: portfolio
    summary: Balances and positions
    description: Wallet balances, open positions, margin and per-market account state.
    parent: hosts
    kind: nav
  - name: market-settings
    summary: Leverage and position mode
    description: Read and set the account's leverage and position mode for a market.
    parent: hosts
    kind: nav
  - name: transactions
    summary: Transactions
    description: 'Balance postings: fees, funding payments, deposits and so on.'
    parent: hosts
    kind: nav
  - name: accounts
    summary: Accounts
    description: Connect, list and manage a tenant's exchange, broker and paper accounts.
    kind: nav
  - name: paper
    summary: Paper trading
    description: >-
      Create and fund paper accounts and set their simulated fees. Trade them
      through the hosts operations like any other account.
    kind: nav
  - name: paper-accounts
    summary: Paper accounts
    description: Create and fund paper accounts.
    parent: paper
    kind: nav
  - name: paper-fees
    summary: Paper fees
    description: Choose the fee tier a paper account is charged.
    parent: paper
    kind: nav
  - name: public
    summary: No API key
    description: Public market data and discovery; no authentication needed.
    kind: badge
  - name: optional
    summary: Check capabilities
    description: >-
      Not every host or venue supports this operation; check its capabilities
      first or expect 422 NotSupported.
    kind: badge
  - name: paged
    summary: Paged
    description: Returns pages; follow nextCursor until null.
    kind: badge
  - name: batch
    summary: Batch
    description: >-
      Takes a list of identifiers or instruments and returns one result for
      each.
    kind: badge
  - name: not-repeat-safe
    summary: Not safe to repeat
    description: >-
      Repeating the call repeats its effect. If the outcome is unclear, check
      before retrying.
    kind: badge
paths:
  /api/v1/hosts/command/CancelOrders:
    post:
      tags:
        - orders
        - optional
        - batch
      summary: Cancel orders
      description: >-
        Cancels the orders you name and returns one CancelResult per identifier,
        so one call can partly succeed. A Failed result carries the error code
        CancelOrder would return for that identifier, with the same meaning.
        Errors that stop the whole batch, such as authentication or a missing
        account, are returned as an ordinary error instead. Safe to repeat.
      operationId: hostsCancelOrders
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelOrdersCommand'
      responses:
        '200':
          description: Successful result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseEnvelopeCancelResultList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/Rejected'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/UnexpectedError'
        '502':
          $ref: '#/components/responses/UpstreamFailure'
        '503':
          $ref: '#/components/responses/Unavailable'
        '504':
          $ref: '#/components/responses/UpstreamTimeout'
      security:
        - ApiKey: []
          ApiSecret: []
components:
  schemas:
    CancelOrdersCommand:
      type: object
      properties:
        accountId:
          type: string
        command:
          $ref: '#/components/schemas/CancelOrders'
      required:
        - accountId
        - command
    ResponseEnvelopeCancelResultList:
      type: object
      required:
        - data
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/CancelResult'
    CancelOrders:
      oneOf:
        - $ref: '#/components/schemas/CancelOrdersByClientOrderIds'
        - $ref: '#/components/schemas/CancelOrdersByClientOrderIdsForInstrument'
        - $ref: '#/components/schemas/CancelOrdersByIds'
      discriminator:
        propertyName: type
        mapping:
          ByClientOrderIds: '#/components/schemas/CancelOrdersByClientOrderIds'
          ByClientOrderIdsForInstrument: '#/components/schemas/CancelOrdersByClientOrderIdsForInstrument'
          ByIds: '#/components/schemas/CancelOrdersByIds'
    CancelResult:
      oneOf:
        - $ref: '#/components/schemas/CancelResultCancelled'
        - $ref: '#/components/schemas/CancelResultFailed'
      discriminator:
        propertyName: type
        mapping:
          Cancelled: '#/components/schemas/CancelResultCancelled'
          Failed: '#/components/schemas/CancelResultFailed'
      description: Outcome for one requested identifier.
    ErrorEnvelope:
      type: object
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
        error:
          type:
            - string
            - 'null'
          description: Reserved for structured detail; currently always null.
      required:
        - code
        - message
        - error
      description: >-
        Every error has this shape, at every HTTP status, including unknown
        paths (404 NotFound) and wrong methods (405 MethodNotAllowed). code is
        the specific reason. Each operation describes when to retry and how to
        check the outcome; an error alone does not prove a command had no
        effect.
    CancelOrdersByClientOrderIds:
      type: object
      properties:
        clientOrderIds:
          type: array
          items:
            type: string
        type:
          type: string
          enum:
            - ByClientOrderIds
      required:
        - type
        - clientOrderIds
    CancelOrdersByClientOrderIdsForInstrument:
      type: object
      properties:
        instrument:
          $ref: '#/components/schemas/Instrument'
        clientOrderIds:
          type: array
          items:
            type: string
        type:
          type: string
          enum:
            - ByClientOrderIdsForInstrument
      required:
        - type
        - instrument
        - clientOrderIds
    CancelOrdersByIds:
      type: object
      properties:
        orderIds:
          type: array
          items:
            type: string
        type:
          type: string
          enum:
            - ByIds
      required:
        - type
        - orderIds
    CancelResultCancelled:
      type: object
      properties:
        identifier:
          type: string
          description: The requested order ID or clientOrderId, echoed exactly as sent.
        type:
          type: string
          enum:
            - Cancelled
      required:
        - type
        - identifier
      description: >-
        The host accepted the cancel; the order may not be terminal yet. Confirm
        with the order stream or GetOrder.
    CancelResultFailed:
      type: object
      properties:
        identifier:
          type: string
          description: The requested order ID or clientOrderId, echoed exactly as sent.
        code:
          $ref: '#/components/schemas/ErrorCode'
          description: >-
            The code CancelOrder would return for this identifier.
            OrderNotFound: reconcile, the order may be unknown, forgotten or not
            yet visible. OrderAlreadyClosed: terminal and may have filled; do
            not retry. RateLimited, Unavailable, UpstreamTimeout and
            UpstreamFailure are transient and may be retried. Rejected and
            NotSupported mean the request must change.
        message:
          type: string
        type:
          type: string
          enum:
            - Failed
      required:
        - type
        - identifier
        - code
        - message
    ErrorCode:
      type: string
      enum:
        - InvalidRequest
        - Unauthenticated
        - Forbidden
        - AccountNotFound
        - OrderNotFound
        - NotFound
        - MethodNotAllowed
        - DuplicateClientOrderId
        - OrderAlreadyClosed
        - Conflict
        - UnsupportedMediaType
        - InsufficientFunds
        - InvalidProviderCredentials
        - AccountLimit
        - NotSupported
        - Rejected
        - RateLimited
        - UnexpectedError
        - CancelAllFailed
        - UpstreamFailure
        - Unavailable
        - UpstreamTimeout
      description: >-
        Stable error reason. The HTTP status for each code is fixed:
        InvalidRequest (400): Malformed JSON, wrong types, unknown fields or
        enum values, or invalid values.; Unauthenticated (401): Missing or
        invalid API key headers.; Forbidden (403): Authenticated, but without
        access to the account or operation.; AccountNotFound (404): The
        accountId does not exist.; OrderNotFound (404): The account exists, but
        the order identifier does not.; NotFound (404): Unknown path, host or
        venue.; MethodNotAllowed (405): The path exists but only accepts POST.;
        DuplicateClientOrderId (409): An order with this clientOrderId already
        exists.; OrderAlreadyClosed (409): The order is already filled,
        cancelled or rejected.; Conflict (409): A unique value (for example an
        account name) is already used.; UnsupportedMediaType (415): The request
        is not Content-Type application/json.; InsufficientFunds (422): The
        account cannot fund the order.; InvalidProviderCredentials (422): The
        provider rejected the account credentials.; AccountLimit (422): An
        account or subscription limit was reached.; NotSupported (422): The host
        does not support this operation, variant or instrument.; Rejected (422):
        The host or validation rejected the command.; RateLimited (429): The
        provider rate limited the request.; UnexpectedError (500): Unexpected
        server failure.; CancelAllFailed (502): At least one sub-cancel failed;
        reconcile with ListOpenOrders.; UpstreamFailure (502): The provider
        failed or returned an unusable response.; Unavailable (503): The service
        or provider is temporarily unavailable.; UpstreamTimeout (504): The
        provider did not respond in time. New codes may be added; treat an
        unknown code by its HTTP status.
    Instrument:
      oneOf:
        - $ref: '#/components/schemas/InstrumentFuture'
        - $ref: '#/components/schemas/InstrumentFutureInv'
        - $ref: '#/components/schemas/InstrumentOption'
        - $ref: '#/components/schemas/InstrumentPerp'
        - $ref: '#/components/schemas/InstrumentPerpInv'
        - $ref: '#/components/schemas/InstrumentSpot'
      discriminator:
        propertyName: type
        mapping:
          Future: '#/components/schemas/InstrumentFuture'
          FutureInv: '#/components/schemas/InstrumentFutureInv'
          Option: '#/components/schemas/InstrumentOption'
          Perp: '#/components/schemas/InstrumentPerp'
          PerpInv: '#/components/schemas/InstrumentPerpInv'
          Spot: '#/components/schemas/InstrumentSpot'
      description: >-
        An instrument, identified by its fields rather than a venue symbol:
        type, base, quote, and expiry, strike and right where they apply. type
        takes the InstrumentType values; unknown types are rejected. Market
        summaries also give its canonical symbol.
    InstrumentFuture:
      type: object
      properties:
        base:
          type: string
          pattern: ^[A-Z0-9.]{1,32}$
        quote:
          type: string
          pattern: ^[A-Z0-9.]{1,32}$
        expiry:
          type: string
          format: date
          description: Contract expiry date (YYYY-MM-DD).
        type:
          type: string
          enum:
            - Future
      required:
        - type
        - base
        - quote
        - expiry
    InstrumentFutureInv:
      type: object
      properties:
        base:
          type: string
          pattern: ^[A-Z0-9.]{1,32}$
        quote:
          type: string
          pattern: ^[A-Z0-9.]{1,32}$
        expiry:
          type: string
          format: date
          description: Contract expiry date (YYYY-MM-DD).
        type:
          type: string
          enum:
            - FutureInv
      required:
        - type
        - base
        - quote
        - expiry
    InstrumentOption:
      type: object
      properties:
        base:
          type: string
          pattern: ^[A-Z0-9.]{1,32}$
        quote:
          type: string
          pattern: ^[A-Z0-9.]{1,32}$
        expiry:
          type: string
          format: date
          description: Contract expiry date (YYYY-MM-DD).
        strike:
          type: string
          pattern: ^(?:0|[1-9][0-9]*)(?:\.[0-9]*[1-9])?$
          description: >-
            Positive strike price in the quote asset, in canonical form so
            identity is exact; a plain decimal with no exponent and no trailing
            fractional zeros (50000, not 50000.0 or 5E4).
        right:
          $ref: '#/components/schemas/OptionRight'
        type:
          type: string
          enum:
            - Option
      required:
        - type
        - base
        - quote
        - expiry
        - strike
        - right
      description: >-
        Option contract. Option markets are not listed or tradable yet; options
        appear only where a host reports account activity on them.
    InstrumentPerp:
      type: object
      properties:
        base:
          type: string
          pattern: ^[A-Z0-9.]{1,32}$
        quote:
          type: string
          pattern: ^[A-Z0-9.]{1,32}$
        type:
          type: string
          enum:
            - Perp
      required:
        - type
        - base
        - quote
    InstrumentPerpInv:
      type: object
      properties:
        base:
          type: string
          pattern: ^[A-Z0-9.]{1,32}$
        quote:
          type: string
          pattern: ^[A-Z0-9.]{1,32}$
        type:
          type: string
          enum:
            - PerpInv
      required:
        - type
        - base
        - quote
    InstrumentSpot:
      type: object
      properties:
        base:
          type: string
          pattern: ^[A-Z0-9.]{1,32}$
        quote:
          type: string
          pattern: ^[A-Z0-9.]{1,32}$
        type:
          type: string
          enum:
            - Spot
      required:
        - type
        - base
        - quote
    OptionRight:
      type: string
      enum:
        - Call
        - Put
  responses:
    BadRequest:
      description: 400 BadRequest; code is InvalidRequest.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Unauthenticated:
      description: 401 Unauthenticated; code is Unauthenticated.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Forbidden:
      description: 403 Forbidden; code is Forbidden.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    NotFound:
      description: 404 NotFound; code is AccountNotFound, OrderNotFound or NotFound.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    UnsupportedMediaType:
      description: 415 UnsupportedMediaType; code is UnsupportedMediaType.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Rejected:
      description: >-
        422 Rejected; code is InsufficientFunds, InvalidProviderCredentials,
        AccountLimit, NotSupported or Rejected.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    RateLimited:
      description: 429 RateLimited; code is RateLimited.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    UnexpectedError:
      description: 500 UnexpectedError; code is UnexpectedError.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    UpstreamFailure:
      description: 502 UpstreamFailure; code is UpstreamFailure or CancelAllFailed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Unavailable:
      description: 503 Unavailable; code is Unavailable.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    UpstreamTimeout:
      description: 504 UpstreamTimeout; code is UpstreamTimeout.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-API-KEY
    ApiSecret:
      type: apiKey
      in: header
      name: X-API-SECRET

````

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