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

# Cancel order

### Requirements to consume the endpoint.

<CardGroup cols={2}>
  <Card title="Create and modify role" icon="user-lock">
    The user must have the role to create and modify.
  </Card>

  <Card title="User approved" icon="check">
    The user must be approved in at least one country.
  </Card>
</CardGroup>


## OpenAPI

````yaml post /api/orders/{id}/cancel
openapi: 3.0.0
info:
  version: v1.0.0
  title: Orders API
  description: API for managing orders in the Rio platform
servers:
  - url: https://app.sandbox.rio.trade
security:
  - apiKeyAuth: []
paths:
  /api/orders/{id}/cancel:
    post:
      summary: Cancel order
      parameters:
        - name: id
          in: path
          description: Id of the order to be cancelled.
          required: true
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responseCanceledOrderSchema'
          description: OK
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unauthorizedSchema'
          description: Unauthorized
components:
  schemas:
    responseCanceledOrderSchema:
      type: object
      properties:
        quoteId:
          type: string
          description: The unique identifier assigned to the quote.
          example: 6660bdefd6c964829d63fcb7
        userId:
          type: string
          description: The unique identifier assigned to the user.
          example: 65a99abb6a92bda6e52bf7af
        status:
          description: The current status of the order.
          enum:
            - created
            - cancelled
            - processing
            - sourcingLiquidity
            - cryptoAddressAdded
            - liquiditySourced
            - awaitingBankPayoutDetails
            - awaitingBinanceSettlement
            - binanceSettlementFailed
            - incorrectBinanceSettlement
            - depositRegistered
            - depositConfirmed
            - paymentOriginMismatch
            - paid
            - filled
            - addressCheckPassed
            - depositAddressCreated
            - complete
            - failedPayment
            - bankPayoutDetailsAdded
            - awaitingPayment
            - awaitingOriginOrderCompletion
            - awaitingTransferReissue
            - awaitingPayout
            - awaitingAsyncPayout
            - awaitingAsyncPayment
            - awaitingBridgeRouting
            - failedFill
            - failedTransfer
            - failedQuote
            - failedProcessorRouting
            - failedLiquidityRouting
            - failedFees
            - incorrectAmountPaid
            - insufficientLiquidityFailed
            - depositAddressFailed
            - addressCheckFailed
            - refundComplete
            - bridgeOrderCreationFailed
            - bridgeOrderRoutingFailed
            - bridgeTransferFailed
            - depositAmountMismatchFailed
            - failedUnknown
            - expired
        crypto:
          description: The type of cryptocurrency used in the order.
          enum:
            - USDC
            - USDC_POLYGON_NXTB
            - SOL_USDC_PTHX
            - XLM_USDC_5F3T
            - USDT_POLYGON
            - USDT_ERC20
            - TRX_USDT_S2UZ
            - USDT_BSC
        side:
          description: The side of the order, indicating whether it's a buy or sell order.
          enum:
            - buy
            - sell
        fiat:
          description: The type of fiat currency used in the order.
          enum:
            - USD
            - MXN
            - PEN
            - COP
        createdAt:
          type: string
          description: The date and time when the order was created.
          example: '2024-06-05T19:35:17.436Z'
        cryptoAddress:
          type: string
          description: The address associated with the cryptocurrency used in the order.
          example: '0xAf56edF88c429F1D6858f9E47731FF53F6d34D0C'
        country:
          description: The country where the user is located.
          enum:
            - MX
            - PE
            - CO
            - US
        amountFiat:
          type: number
          description: The total amount of the order in fiat currency.
          example: 1000
        amountCrypto:
          type: number
          description: The total amount of the order in cryptocurrency.
          example: 55.51
        fees:
          type: object
          description: Details of the applied fees.
          properties:
            processingFeeFiat:
              type: number
              description: Processing fee in fiat currency.
              example: 0
            transferFeeFiat:
              type: number
              description: Transfer fee in fiat currency.
              example: 0.17594406538826532
            platformFeeFiat:
              type: number
              description: Platform fee in fiat currency.
              example: 20
        marketPrice:
          type: number
          description: Price of the cryptocurrency.
          example: 0.0568362449619
        notes:
          type: string
          description: Additional notes about the order.
          example: Description
        expiredQuotes:
          type: array
          description: List of expired quotes.
          items:
            type: string
        id:
          type: string
          description: Unique identifier of the order.
          example: 6660bdf5cc4633bc64122f3c
    unauthorizedSchema:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: number
                example: 19
              message:
                type: string
                example: Not authorized
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````