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

<Warning>
  **v1 (legacy).** This page documents the API before the v2 update. The v1
  format is not enabled for new accounts and must be enabled on your account by
  your account manager. New integrations should use the
  [current documentation](/introduction). To update an existing integration,
  follow the [migration guide](/migration).
</Warning>

### 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 v1/api-reference/orders-docs.json post /api/orders/{id}/cancel
openapi: 3.0.0
info:
  version: v1.0.0
  title: Orders API (legacy v1)
  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, which is `cancelled` once the
            cancellation goes through.
          enum:
            - cancelled
        crypto:
          description: The type of cryptocurrency used in the order.
          enum:
            - USDC
            - USDC_POLYGON_NXTB
            - SOL_USDC_PTHX
            - XLM_USDC_5F3T
            - USDC_BASECHAIN_ETH_5I5C
            - USDCE_TEMPO_MXYR
            - USDT_POLYGON
            - USDT_ERC20
            - TRX_USDT_S2UZ
            - USDT_BSC
            - SOL_USDT_EWAY
            - EUROC_ETH_F5NG
            - EURC_SOL
            - EURC_B609K9QB_Y213
        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
        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

````

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