> ## 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 api-reference/orders-docs.json post /api/orders/{id}/cancel
openapi: 3.0.0
info:
  version: v2.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:
      $ref: '#/components/schemas/responseOrderSchema'
    unauthorizedSchema:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: number
                example: 19
              message:
                type: string
                example: Not authorized
    responseOrderSchema:
      type: object
      properties:
        id:
          type: string
          description: Id of the order.
          example: 6660bdefd6c964829d63fcb8
        quoteId:
          type: string
          description: >-
            Id of the quote the order is priced on. Changes when the order is
            re-quoted.
          example: 6660bdefd6c964829d63fcb7
        userId:
          type: string
          description: Id of the user the order belongs to.
          example: 66290ac8bd3903485989f82e
        clientReferenceId:
          type: string
          description: Your own reference for the order.
          example: my-reference-1234
        status:
          type: string
          enum:
            - awaitingTimeInForceToStart
            - awaitingLimitPriceCondition
            - timeInForceEnded
            - created
            - addressCheckPassed
            - awaitingPayment
            - processing
            - paid
            - incorrectAmountPaid
            - sourcingLiquidity
            - liquiditySourced
            - filled
            - complete
            - depositAddressCreated
            - awaitingBankPayoutDetails
            - bankPayoutDetailsAdded
            - depositConfirmed
            - awaitingPayout
            - bankPaymentDetailsAdded
            - awaitingAsyncPayment
            - awaitingAsyncPayout
            - cancelled
            - expired
          description: >-
            Current status. These are the statuses an order moves through on a
            normal flow. Which ones it sees depends on the flow. Other statuses
            can appear depending on the circumstances of the order.
          example: awaitingPayment
        flow:
          type: string
          enum:
            - fiatToCrypto
            - cryptoToFiat
            - cryptoToCrypto
          description: >-
            Direction of the conversion, derived from the two assets.
            `fiatToCrypto` buys stablecoins, `cryptoToFiat` sells them,
            `cryptoToCrypto` swaps one stablecoin or network for another.
          example: fiatToCrypto
        origin:
          type: object
          description: What the customer pays. The amount is in the leg's own asset.
          properties:
            asset:
              type: string
              enum:
                - USD
                - MXN
                - PEN
                - COP
                - USDC
                - USDCe
                - EURC
                - USDT
              description: >-
                Currency code. Fiat currencies are `USD`, `MXN`, `PEN` and
                `COP`. Stablecoins are `USDC`, `USDCe` (USDC.e), `EURC` and
                `USDT`. A stablecoin is always paired with the `network` it
                lives on.
              example: MXN
            amount:
              type: number
              description: Amount of the origin asset.
              example: 1000
            country:
              type: string
              enum:
                - MX
                - PE
                - CO
              description: Country the leg settles in.
              example: MX
        destination:
          type: object
          description: What the customer receives. The amount is in the leg's own asset.
          properties:
            asset:
              type: string
              enum:
                - USD
                - MXN
                - PEN
                - COP
                - USDC
                - USDCe
                - EURC
                - USDT
              description: >-
                Currency code. Fiat currencies are `USD`, `MXN`, `PEN` and
                `COP`. Stablecoins are `USDC`, `USDCe` (USDC.e), `EURC` and
                `USDT`. A stablecoin is always paired with the `network` it
                lives on.
              example: USDC
            amount:
              type: number
              description: Amount of the destination asset.
              example: 54.76
            country:
              type: string
              enum:
                - MX
                - PE
                - CO
              description: Country the leg settles in.
              example: MX
        fixedLeg:
          type: string
          enum:
            - origin
            - destination
          description: >-
            Which leg's amount you specified. The other leg was derived from the
            price and fees.
          example: origin
        pricingDetails:
          type: object
          description: How the destination amount was derived from the origin amount.
          properties:
            fees:
              type: array
              items:
                type: object
                properties:
                  type:
                    type: string
                    enum:
                      - processing
                      - transfer
                      - platform
                      - broker
                      - valueDateOffset
                    description: >-
                      `processing` is the payment processor fee, `transfer` the
                      network or bank transfer fee, `platform` Rio's fee,
                      `broker` the fee of the broker the account belongs to and
                      `valueDateOffset` the cost of a T+N settlement.
                  amount:
                    type: number
                    description: Fee amount, in `asset`.
                    example: 20
                  asset:
                    type: string
                    enum:
                      - USD
                      - MXN
                      - PEN
                      - COP
                      - USDC
                      - USDCe
                      - EURC
                      - USDT
                    description: Currency the fee is charged in.
                    example: MXN
                  tax:
                    type: number
                    description: >-
                      Tax charged on this fee, when applicable, in the same
                      asset.
                    example: 3.2
                required:
                  - type
                  - amount
                  - asset
              description: >-
                Fees charged on the order. Each fee names the asset it is
                charged in.
        settlement:
          type: object
          description: How and when the two legs settle.
          properties:
            mode:
              type: string
              enum:
                - deliverable
              description: Settlement mode.
              example: deliverable
            timing:
              type: string
              enum:
                - default
                - TPlusOffset
              description: >-
                `default` settles on receipt of payment. `TPlusOffset` settles
                `valueDateOffset` business days after payment (T+N).
              example: default
            valueDateOffset:
              type: number
              description: >-
                Business days between payment and payout for `TPlusOffset`
                settlement.
              example: 1
            effectiveValueDateOffset:
              type: number
              description: Billable days for the `TPlusOffset` settlement.
              example: 1
            valueDate:
              type: string
              format: date-time
              description: Date the payout leg settles.
              example: '2026-10-12T18:00:00.000Z'
            payment:
              type: object
              description: >-
                The leg you pay. Rio's payment details appear under
                `instructions` once the order is awaiting payment.
              properties:
                asset:
                  type: string
                  enum:
                    - USD
                    - MXN
                    - PEN
                    - COP
                    - USDC
                    - USDCe
                    - EURC
                    - USDT
                  description: >-
                    Currency code. Fiat currencies are `USD`, `MXN`, `PEN` and
                    `COP`. Stablecoins are `USDC`, `USDCe` (USDC.e), `EURC` and
                    `USDT`. A stablecoin is always paired with the `network` it
                    lives on.
                  example: MXN
                amount:
                  type: number
                  description: Amount that settles on this leg, in `asset`.
                  example: 1000
                rail:
                  type: string
                  enum:
                    - bankTransfer
                    - blockchain
                  description: >-
                    How the leg moves. Fiat settles over `bankTransfer`, crypto
                    over `blockchain`.
                  example: bankTransfer
                network:
                  type: string
                  enum:
                    - ethereum
                    - polygon
                    - solana
                    - stellar
                    - base
                    - tempo
                    - tron
                    - bsc
                  description: Network of a `blockchain` leg. Absent on bank legs.
                  example: polygon
                dueDate:
                  type: string
                  format: date-time
                  description: >-
                    When this leg is due. On the payment leg it is the payment
                    deadline, on the payout leg the value date.
                  example: '2026-10-12T18:00:00.000Z'
                status:
                  type: string
                  enum:
                    - pending
                    - awaitingDetails
                    - awaitingFunds
                    - partiallySettled
                    - settled
                    - failed
                  description: Settlement progress of this leg.
                  example: awaitingFunds
                amountSettled:
                  type: number
                  description: Amount settled so far on this leg.
                  example: 0
                bankAccountId:
                  type: string
                  description: >-
                    Id of the bank account the leg settles to. Present when the
                    leg's `asset` is a fiat currency. On the payout leg it is
                    the `settlement.payout.bankAccountId` sent when creating the
                    order.
                  example: 66733d33222710ab2785dc62
                addressId:
                  type: string
                  description: >-
                    Id of the address the leg settles to. Present when the leg's
                    `asset` is a crypto asset. On the payout leg it is the
                    `settlement.payout.addressId` sent when creating the order.
                  example: 66733d33222710ab2785dc62
                instructions:
                  type: object
                  description: >-
                    Where to send funds for this leg. On the payment leg these
                    are Rio's details for you to pay to. On the payout leg these
                    are the details of the account or wallet Rio pays to. Bank
                    legs carry bank fields, blockchain legs carry
                    `blockchainAddress` and, when the network needs one,
                    `blockchainMemo`.
                  properties:
                    blockchainAddress:
                      type: string
                      description: Wallet address.
                      example: '0xAf56edF88c429F1D6858f9E47731FF53F6d34D0C'
                    blockchainMemo:
                      type: string
                      description: >-
                        Memo or tag required by some networks (for example
                        Stellar).
                    bankName:
                      type: string
                      description: Bank name.
                      example: STP
                    companyName:
                      type: string
                      description: Account holder for Rio's collection account.
                      example: Rio Transfer S.A.P.I. de C.V.
                    companyAddress:
                      type: string
                      description: Address of the account holder.
                    bankAddress:
                      type: string
                      description: Address of the bank.
                    accountHolderName:
                      type: string
                      description: Account holder name.
                      example: John Doe
                    accountNumber:
                      type: string
                      description: Account number.
                      example: '99998888'
                    routingNumber:
                      type: string
                      description: Routing number (US).
                    reference:
                      type: string
                      description: Reference that must accompany the transfer.
                      example: 9f5676
                    CLABE:
                      type: string
                      description: CLABE (Mexico).
                      example: '646180000000000001'
                    CCI:
                      type: string
                      description: CCI (Peru).
                    RUC:
                      type: string
                      description: RUC of the account holder (Peru).
                    RFC:
                      type: string
                      description: RFC of the account holder (Mexico).
                      example: RBL123456789
                    NIT:
                      type: string
                      description: NIT of the account holder (Colombia).
                    USBankTransferMethod:
                      type: string
                      enum:
                        - wire
                        - ach_push
                      description: Transfer method for US bank legs.
                transactions:
                  type: array
                  items:
                    type: object
                    description: >-
                      A payment received or a payout sent on this leg. Bank
                      transfers carry the bank fields, blockchain transfers
                      carry the chain fields.
                    properties:
                      amount:
                        type: number
                        description: Amount moved, in the leg's asset.
                        example: 1000
                      createdAt:
                        type: string
                        format: date-time
                        description: When the transfer was registered.
                        example: '2026-10-12T18:00:00.000Z'
                      blockchainTxId:
                        type: string
                        description: Transaction hash on the leg's network.
                        example: >-
                          0x66ec2a9d4e1f6b7c8d9e0f1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e
                      blockchainAddress:
                        type: string
                        description: Counterparty wallet address.
                        example: '0xAf56edF88c429F1D6858f9E47731FF53F6d34D0C'
                      SPEITrackingNumber:
                        type: string
                        description: SPEI tracking number (Mexico).
                        example: TRK20261012001
                      SPIDTrackingNumber:
                        type: string
                        description: SPID tracking number (Mexico, USD transfers).
                      CEPLink:
                        type: string
                        description: Link to the Banxico CEP receipt (Mexico).
                        example: https://www.banxico.org.mx/cep/
                      reference:
                        type: string
                        description: Transfer reference.
                        example: 9f5676
                      accountHolderName:
                        type: string
                        description: >-
                          Name of the account holder on the other side of the
                          transfer.
                        example: John Doe
                      accountNumber:
                        type: string
                        description: Counterparty account number.
                      CCI:
                        type: string
                        description: Counterparty CCI (Peru).
                      CLABE:
                        type: string
                        description: Counterparty CLABE (Mexico).
                        example: '014027000000000008'
                  description: Transfers registered on this leg.
                bulkBankPaymentId:
                  type: string
                  description: >-
                    Id of the bulk bank payment this leg is paid through.
                    Present on a fiat payment leg when the order was created
                    with `settlement.payment.bulkBankPaymentId`.
                bulkCryptoPaymentId:
                  type: string
                  description: >-
                    Id of the bulk crypto payment this leg is paid through.
                    Present on a crypto payment leg when the order was created
                    with `settlement.payment.bulkCryptoPaymentId`.
            payout:
              type: object
              description: >-
                The leg Rio pays out. `instructions` are the details of your
                bank account or wallet.
              properties:
                asset:
                  type: string
                  enum:
                    - USD
                    - MXN
                    - PEN
                    - COP
                    - USDC
                    - USDCe
                    - EURC
                    - USDT
                  description: >-
                    Currency code. Fiat currencies are `USD`, `MXN`, `PEN` and
                    `COP`. Stablecoins are `USDC`, `USDCe` (USDC.e), `EURC` and
                    `USDT`. A stablecoin is always paired with the `network` it
                    lives on.
                  example: USDC
                amount:
                  type: number
                  description: Amount that settles on this leg, in `asset`.
                  example: 54.76
                rail:
                  type: string
                  enum:
                    - bankTransfer
                    - blockchain
                  description: >-
                    How the leg moves. Fiat settles over `bankTransfer`, crypto
                    over `blockchain`.
                  example: blockchain
                network:
                  type: string
                  enum:
                    - ethereum
                    - polygon
                    - solana
                    - stellar
                    - base
                    - tempo
                    - tron
                    - bsc
                  description: Network of a `blockchain` leg. Absent on bank legs.
                  example: polygon
                dueDate:
                  type: string
                  format: date-time
                  description: >-
                    When this leg is due. On the payment leg it is the payment
                    deadline, on the payout leg the value date.
                  example: '2026-10-12T18:00:00.000Z'
                status:
                  type: string
                  enum:
                    - pending
                    - awaitingDetails
                    - awaitingFunds
                    - partiallySettled
                    - settled
                    - failed
                  description: Settlement progress of this leg.
                  example: awaitingFunds
                amountSettled:
                  type: number
                  description: Amount settled so far on this leg.
                  example: 0
                bankAccountId:
                  type: string
                  description: >-
                    Id of the bank account the leg settles to. Present when the
                    leg's `asset` is a fiat currency. On the payout leg it is
                    the `settlement.payout.bankAccountId` sent when creating the
                    order.
                  example: 66733d33222710ab2785dc62
                addressId:
                  type: string
                  description: >-
                    Id of the address the leg settles to. Present when the leg's
                    `asset` is a crypto asset. On the payout leg it is the
                    `settlement.payout.addressId` sent when creating the order.
                  example: 66733d33222710ab2785dc62
                instructions:
                  type: object
                  description: >-
                    Where to send funds for this leg. On the payment leg these
                    are Rio's details for you to pay to. On the payout leg these
                    are the details of the account or wallet Rio pays to. Bank
                    legs carry bank fields, blockchain legs carry
                    `blockchainAddress` and, when the network needs one,
                    `blockchainMemo`.
                  properties:
                    blockchainAddress:
                      type: string
                      description: Wallet address.
                      example: '0xAf56edF88c429F1D6858f9E47731FF53F6d34D0C'
                    blockchainMemo:
                      type: string
                      description: >-
                        Memo or tag required by some networks (for example
                        Stellar).
                    bankName:
                      type: string
                      description: Bank name.
                      example: STP
                    companyName:
                      type: string
                      description: Account holder for Rio's collection account.
                      example: Rio Transfer S.A.P.I. de C.V.
                    companyAddress:
                      type: string
                      description: Address of the account holder.
                    bankAddress:
                      type: string
                      description: Address of the bank.
                    accountHolderName:
                      type: string
                      description: Account holder name.
                      example: John Doe
                    accountNumber:
                      type: string
                      description: Account number.
                      example: '99998888'
                    routingNumber:
                      type: string
                      description: Routing number (US).
                    reference:
                      type: string
                      description: Reference that must accompany the transfer.
                      example: 9f5676
                    CLABE:
                      type: string
                      description: CLABE (Mexico).
                      example: '646180000000000001'
                    CCI:
                      type: string
                      description: CCI (Peru).
                    RUC:
                      type: string
                      description: RUC of the account holder (Peru).
                    RFC:
                      type: string
                      description: RFC of the account holder (Mexico).
                      example: RBL123456789
                    NIT:
                      type: string
                      description: NIT of the account holder (Colombia).
                    USBankTransferMethod:
                      type: string
                      enum:
                        - wire
                        - ach_push
                      description: Transfer method for US bank legs.
                transactions:
                  type: array
                  items:
                    type: object
                    description: >-
                      A payment received or a payout sent on this leg. Bank
                      transfers carry the bank fields, blockchain transfers
                      carry the chain fields.
                    properties:
                      amount:
                        type: number
                        description: Amount moved, in the leg's asset.
                        example: 1000
                      createdAt:
                        type: string
                        format: date-time
                        description: When the transfer was registered.
                        example: '2026-10-12T18:00:00.000Z'
                      blockchainTxId:
                        type: string
                        description: Transaction hash on the leg's network.
                        example: >-
                          0x66ec2a9d4e1f6b7c8d9e0f1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e
                      blockchainAddress:
                        type: string
                        description: Counterparty wallet address.
                        example: '0xAf56edF88c429F1D6858f9E47731FF53F6d34D0C'
                      SPEITrackingNumber:
                        type: string
                        description: SPEI tracking number (Mexico).
                        example: TRK20261012001
                      SPIDTrackingNumber:
                        type: string
                        description: SPID tracking number (Mexico, USD transfers).
                      CEPLink:
                        type: string
                        description: Link to the Banxico CEP receipt (Mexico).
                        example: https://www.banxico.org.mx/cep/
                      reference:
                        type: string
                        description: Transfer reference.
                        example: 9f5676
                      accountHolderName:
                        type: string
                        description: >-
                          Name of the account holder on the other side of the
                          transfer.
                        example: John Doe
                      accountNumber:
                        type: string
                        description: Counterparty account number.
                      CCI:
                        type: string
                        description: Counterparty CCI (Peru).
                      CLABE:
                        type: string
                        description: Counterparty CLABE (Mexico).
                        example: '014027000000000008'
                  description: Transfers registered on this leg.
                bulkBankPaymentId:
                  type: string
                  description: >-
                    Id of the bulk bank payment this leg is paid through.
                    Present on a fiat payment leg when the order was created
                    with `settlement.payment.bulkBankPaymentId`.
                bulkCryptoPaymentId:
                  type: string
                  description: >-
                    Id of the bulk crypto payment this leg is paid through.
                    Present on a crypto payment leg when the order was created
                    with `settlement.payment.bulkCryptoPaymentId`.
        marketPrice:
          type: number
          description: >-
            Market price at the time the order was created, in units of the
            destination asset per unit of the origin asset.
          example: 0.056
        netPrice:
          type: number
          description: Final price including fees and taxes.
          example: 0.05476
        type:
          type: string
          enum:
            - market
            - limit
          description: >-
            `market` executes at the current price, `limit` waits for
            `limitNetPrice`.
          example: market
        limitNetPrice:
          type: number
          description: >-
            Limit price for `limit` orders, expressed like `netPrice` as units
            of the destination asset per unit of the origin asset. Only
            applicable when `orderType` is `limit`.
          example: 0.0555
        timeInForceStartsAt:
          type: string
          format: date-time
          description: Earliest execution time of a `limit` order.
          example: '2026-10-12T18:00:00.000Z'
        timeInForceEndsAt:
          type: string
          format: date-time
          description: Latest execution time of a `limit` order.
          example: '2026-10-12T18:00:00.000Z'
        attributes:
          type: array
          items:
            type: string
          description: List of attributes associated with the order.
          example:
            - fixedPrice
        notes:
          type: string
          description: Notes you attached to the order.
          example: Note
        payoutTransferLimit:
          type: number
          description: Maximum amount per payout transfer. Larger payouts are split.
          example: 475000
        paymentReceivedAt:
          type: string
          format: date-time
          description: When your payment was received.
          example: '2026-10-12T18:00:00.000Z'
        expiredQuotes:
          type: array
          items:
            type: string
          description: Ids of quotes the order went through before the current one.
          example: []
        parentOrderId:
          type: string
          description: >-
            Id of the parent order when this order was spawned from a partial
            fill.
        invoice:
          type: object
          description: Invoice details, Mexican orders only.
          properties:
            PDFLink:
              type: string
              description: Link to the invoice PDF.
            XMLLink:
              type: string
              description: Link to the invoice XML.
        informationalFees:
          type: object
          description: Informational fees (do not affect the quote).
          properties:
            serviceFeeFiat:
              type: number
              description: Service fee in the order's fiat currency.
              example: 0
            serviceFeeFiatTax:
              type: number
              description: Tax on the service fee.
              example: 0
        createdAt:
          type: string
          format: date-time
          description: Creation time.
          example: '2026-10-12T18:00:00.000Z'
  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.