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

# Create 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
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:
    post:
      summary: Create order
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/createOrderSchema'
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responseCreatedOrderSchema'
          description: Created
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unauthorizedSchema'
          description: Unauthorized
components:
  schemas:
    createOrderSchema:
      type: object
      properties:
        quoteId:
          type: string
          description: Id of the quote to be associated with this order.
          example: 60d5ec9af682fbd39a1fa614
        notes:
          description: >-
            An optional description to be added to the order for your future
            reference.
          type: string
          example: Note
        payoutBankAccountId:
          description: >-
            Required for sell orders. This is the ID of the bank account where
            the funds will be deposited.
          type: string
          example: 60d5ec9af663fbd39a1fa523
        userAddressId:
          description: >-
            Required for buy orders. It is the ID of the address to which we
            will send the funds. For US sell orders, it is the address from
            which you will send the funds.
          type: string
          example: 50d5ec9af663fbd39a1fa629
        wireMessage:
          description: >-
            Only for sell orders in the US. This is an optional wire message
            that can be sent with the payout wire transfer.
          type: string
          example: Message
        clientReferenceId:
          description: >-
            Your own unique reference identifier for tracking this order in your
            system.
          type: string
          maxLength: 100
          example: 03d5ec9af663fbd39a1fa
      required:
        - quoteId
    responseCreatedOrderSchema:
      type: object
      properties:
        quoteId:
          type: string
          description: Unique identifier of the associated quote
          example: 60d5ec9af682fbd39a1fa614
        userId:
          type: string
          description: Unique identifier of the user who created the order
          example: 65a99abb6a92bda6e52bf7af
        status:
          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
          description: Current status of the order
        crypto:
          enum:
            - USDC
            - USDC_POLYGON_NXTB
            - SOL_USDC_PTHX
            - XLM_USDC_5F3T
            - USDT_POLYGON
            - USDT_ERC20
            - TRX_USDT_S2UZ
            - USDT_BSC
          description: Type of cryptocurrency involved in the order
        destinationOfFunds:
          type: object
          description: Details about the destination of funds
          properties:
            blockchainAddress:
              type: string
              description: The blockchain address
              example: TS9kqAVq4PR7xNoQDJXSP6Kgz8GFbwUbzi
            blockchainMemo:
              type: string
              description: >-
                The memo for the blockchain transaction (USDC Stellar orders
                only).
              example: '1234567890'
            accountHolderName:
              type: string
              description: The account holder name
              example: John Doe
            accountNumber:
              type: string
              description: The account number
              example: '1234567890'
            CCI:
              type: string
              description: >-
                20-digit code used to identify bank accounts, only applies in
                Peru
              example: '00111233001112345678'
            CLABE:
              type: string
              description: >-
                18-digit code used to identify bank accounts, only applies in
                Mexico
              example: '014027000000000008'
        side:
          enum:
            - buy
            - sell
          description: Indicates whether the order is a buy or sell order
        fiat:
          enum:
            - USD
            - MXN
            - PEN
            - COP
          description: Type of fiat currency used in the order
        createdAt:
          type: string
          description: Timestamp indicating when the order was created
          example: '2024-06-04T16:38:43.994Z'
        cryptoAddress:
          type: string
          description: Cryptocurrency address associated with the order
          example: '0xAf56edF88c429F1D6858f9E47731FF53F6d34D0C'
        country:
          enum:
            - MX
            - PE
            - CO
            - US
          description: Country of residence of the user who created the order
        amountFiat:
          type: number
          description: Amount of fiat currency involved in the order
          example: 1000
        amountCrypto:
          type: number
          description: Amount of cryptocurrency involved in the order
          example: 54.16
        fees:
          type: object
          description: Details about the fees
          properties:
            processingFeeFiat:
              type: number
              description: The processing fee in fiat
              example: 0
            transferFeeFiat:
              type: number
              description: The transfer fee in fiat
              example: 0.1803336531356813
            platformFeeFiat:
              type: number
              description: The platform fee in fiat
              example: 20
        marketPrice:
          type: number
          description: The price of the cryptocurrency
          example: 0.055452766725000005
        notes:
          type: string
          description: Any additional notes
          example: Note
        expiredQuotes:
          type: array
          description: List of expired quotes
          items:
            type: string
        id:
          type: string
          description: The ID of the order
          example: 665f4313b96e4fb76f5a1403
        payoutAddressId:
          type: string
          description: The unique identifier of the payout address
          example: 673b5cf6302b8444c78dd3d3
        attributes:
          type: array
          description: List of attributes associated with the order
          items:
            type: string
          example:
            - fixedPrice
        payoutTransferLimit:
          type: number
          description: The limit for payout transfer
          example: 475000
        paymentsReceived:
          type: array
          description: List of payments received
          items:
            type: object
            properties:
              amount:
                type: number
                description: The amount received
                example: 100000
              accountHolderName:
                type: string
                description: The name of the account holder
                example: John Doe
              accountNumber:
                type: string
                description: The account number
                example: null
              CCI:
                type: string
                description: >-
                  20-digit code used to identify bank accounts, only applies in
                  Peru
                example: null
              CLABE:
                type: string
                description: >-
                  18-digit code used to identify bank accounts, only applies in
                  Mexico
                example: '123456789012345678'
              receivedAt:
                type: string
                description: The date and time the payment was received
                example: '2025-01-10T13:14:42.855Z'
          example: []
        payoutsSent:
          type: array
          description: List of payouts sent
          items:
            type: object
            properties:
              amount:
                type: number
                description: The amount sent
                example: 4748.36
              blockchainTxId:
                type: string
                description: The blockchain transaction ID
                example: '0x66ECBd38905CC32249ddd6f4f0B4A3DdDDCbd608'
              sentAt:
                type: string
                description: The date and time the payout was sent
                example: '2025-01-10T13:14:48.240Z'
              SPEITrackingNumber:
                type: string
                description: >-
                  Unique identifier for a SPEI transaction (also known as clave
                  de rastreo) (sell order only)
              CEPLink:
                type: string
                description: >-
                  URL to view the CEP generated for the transaction (sell order
                  only)
              reference:
                type: string
                description: The reference for the payment (sell order only)
          example: []
        type:
          type: string
          description: >-
            The type of order. `market` means that the order is executed at the
            current market price, while `limit` means that the order is executed
            at a specified limit net price.
          enum:
            - market
            - limit
        parentOrderId:
          type: string
          description: >-
            The ID of the parent order. This is only applicable for if the order
            was spawned from a partial fill.
          example: 6660beaccc4633bc6412318a
        limitNetPrice:
          type: number
          description: >-
            The net price of the order. This is only applicable for if the order
            `type` is `limit`.
          example: 18.75
        timeInForceStartsAt:
          type: string
          description: >-
            The date and time from which the order is scheduled to be executed
            (optional).
          example: '2024-06-04T15:02:13.097Z'
        timeInForceEndsAt:
          type: string
          description: >-
            The date and time until which the order is scheduled to be executed
            (optional).
          example: '2024-06-04T15:02:13.097Z'
        twoWaySettlementDate:
          type: string
          description: The date on which the order is settled.
          example: '2024-06-04T15:02:13.097Z'
        effectiveTwoWaySettlementDateOffset:
          type: number
          description: >-
            The number of billable days until the order is settled. This is only
            applicable for if the `twoWaySettlementType` is `TPlusOffset`.
          example: 1
        informationalFees:
          type: object
          description: Informational fees for the order (does not affect quote)
          properties:
            serviceFeeFiat:
              type: number
              description: The service fee in the order’s fiat currency
              example: 0
            serviceFeeFiatTax:
              type: number
              description: The tax amount on the service fee in the order’s fiat currency
              example: 0
    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

````