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

# Create order

> Create an on-ramp or off-ramp order from a quote.

The order ID will be the same as the quote ID to allow for easy tracking and correlation.

## Requirements

If the quote lists [requirements](https://developer.uphold.com/rest-apis/on-off-ramp-api/orders/introduction.md#requirements), provide the data for each of them in `params.requirements`, such as `authorize:3ds` with a `returnUrl`. A `travel-rule` requirement must be resolved before creating the order.

When the user must confirm the payment, such as with a 3DS challenge, the `origin` node of the created order carries a `confirmationUrl` to send the user to.

> [!TIP]
>
> Orders that send the `authorize:3ds` requirement need the [user context](https://developer.uphold.com/rest-apis/headers.md#user-context) headers, `X-Uphold-User-Ip` and `X-Uphold-User-Agent`.

## Metadata

You can optionally include custom [entity metadata](https://developer.uphold.com/rest-apis/entity-metadata.md) in the `metadata` field to store your own business data (e.g., reference numbers, categorization, reconciliation data), which needs the `on-off-ramp.orders.metadata:write` scope. If not provided during creation, you can add it later using [Set metadata](https://developer.uphold.com/rest-apis/on-off-ramp-api/metadata/set-metadata.md).

> [!NOTE]
>
> If saving the metadata fails, the order is still created and the response includes an `errors.metadata` property. See [Entity metadata](https://developer.uphold.com/rest-apis/entity-metadata.md#errors-during-entity-creation) for details.


## OpenAPI

````yaml _media/specs/on-off-ramp-openapi.mintlify.json post /on-off-ramp/orders
openapi: 3.1.0
info:
  version: 0.1.0
  title: On & Off Ramp API
  description: >-
    The On & Off Ramp API offers a set of endpoints to move value between fiat
    and crypto through a single atomic order per direction: on-ramp or off-ramp.
  contact:
    name: Uphold API Team
    email: developer@uphold.com
    url: https://developer.uphold.com
servers:
  - url: https://api.enterprise.sandbox.uphold.com
    description: Sandbox
  - url: https://api.enterprise.uphold.com
    description: Production
security:
  - OAuth2: []
tags:
  - name: Orders
    description: On & Off Ramp orders.
  - name: Metadata
    description: Metadata.
  - name: Rails
    description: On & Off Ramp rails.
paths:
  /on-off-ramp/orders:
    post:
      tags:
        - Orders
      summary: Create order
      description: Create an on-ramp or off-ramp order from a quote.
      operationId: on-off-ramp.create-order
      requestBody:
        $ref: '#/components/requestBodies/create-order-request-body'
      responses:
        '201':
          $ref: '#/components/responses/create-order-response'
        '404':
          $ref: '#/components/responses/create-order-not-found-response'
        '409':
          $ref: '#/components/responses/create-order-conflict-response'
      security:
        - OAuth2:
            - on-off-ramp.orders:create
components:
  requestBodies:
    create-order-request-body:
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/create-order-request'
          examples:
            Create Order:
              value:
                quoteId: 623000c8-9bdf-4a2b-aa3d-6a6b44a7f6a0
                metadata:
                  externalId: 123
            Create Card Deposit Order:
              value:
                quoteId: 623000c8-9bdf-4a2b-aa3d-6a6b44a7f6a0
                params:
                  requirements:
                    - name: authorize:3ds
                      returnUrl: https://example.com/redirect
                metadata:
                  externalId: 123
  responses:
    create-order-response:
      description: Order created.
      content:
        application/json:
          schema:
            type: object
            properties:
              order:
                $ref: '#/components/schemas/order'
              errors:
                description: >-
                  Additional contextual errors that occurred while processing
                  the request.
                type: object
                properties:
                  metadata:
                    allOf:
                      - $ref: '#/components/schemas/error'
                      - description: Error related to metadata processing.
            required:
              - order
          examples:
            On-ramp Order Created - Credit Card to XRP:
              value:
                order:
                  id: 623000c8-9bdf-4a2b-aa3d-6a6b44a7f6a0
                  type: on-ramp
                  pricing: locked
                  origin:
                    asset: USD
                    amount: '100.00'
                    rate: '2.07021435361804542440'
                    node:
                      type: external-account
                      id: 7dc5c846-5ac2-4853-b67f-005cb83d4017
                      ownerId: cd21b26d-35d2-408a-9201-b8fdbef7a604
                      via: card
                      network: visa
                      confirmationUrl: >-
                        https://authentication-devices.sandbox.checkout.com/sessions-interceptor/sid_zrih63pnk6ietkpuerqiyd5zga
                  destination:
                    asset: XRP
                    amount: '46.125658'
                    rate: '0.48304176727029881912'
                    node:
                      type: crypto-address
                      network: xrp-ledger
                      address: rfBtmHiLwwWH5maH2PT78GxubrSydRF9aY
                      reference: '67809592'
                  denomination:
                    asset: USD
                    amount: '100.00'
                    rate: '1.00000000000000000000'
                    target: origin
                  fees:
                    - type: deposit
                      code: on-ramp-deposit
                      asset: USD
                      amount: '1.00'
                      percentage: '1'
                      beneficiary: uphold
                    - type: network
                      code: crypto-network
                      asset: USD
                      amount: '3.51'
                  status: processing
                  timeline: []
                  quotedAt: '2024-07-24T15:02:39.000Z'
                  createdAt: '2024-07-24T15:03:39.000Z'
                  updatedAt: '2024-07-24T15:03:39.000Z'
            On-ramp Order Created - Credit Card to Crypto External Account:
              value:
                order:
                  id: 623000c8-9bdf-4a2b-aa3d-6a6b44a7f6a0
                  type: on-ramp
                  pricing: locked
                  origin:
                    asset: USD
                    amount: '100.00'
                    rate: '89253.38317267768950981583'
                    node:
                      type: external-account
                      id: 7dc5c846-5ac2-4853-b67f-005cb83d4017
                      ownerId: cd21b26d-35d2-408a-9201-b8fdbef7a604
                      via: card
                      network: visa
                      confirmationUrl: >-
                        https://authentication-devices.sandbox.checkout.com/sessions-interceptor/sid_zrih63pnk6ietkpuerqiyd5zga
                  destination:
                    asset: BTC
                    amount: '0.00106987'
                    rate: '0.00001120405708392375'
                    node:
                      type: external-account
                      id: 5606d0a7-ff4d-ce4f-8675-dea65619122e
                      ownerId: cd21b26d-35d2-408a-9201-b8fdbef7a604
                      via: crypto
                      network: bitcoin
                  denomination:
                    asset: USD
                    amount: '100.00'
                    rate: '1.00000000000000000000'
                    target: origin
                  fees:
                    - type: deposit
                      code: on-ramp-deposit
                      asset: USD
                      amount: '1.00'
                      percentage: '1'
                      beneficiary: uphold
                    - type: network
                      code: crypto-network
                      asset: USD
                      amount: '3.51'
                  status: processing
                  timeline: []
                  quotedAt: '2024-07-24T15:02:39.000Z'
                  createdAt: '2024-07-24T15:03:39.000Z'
                  updatedAt: '2024-07-24T15:03:39.000Z'
            Off-ramp Order Created - BTC to Credit Card:
              value:
                order:
                  id: 623000c8-9bdf-4a2b-aa3d-6a6b44a7f6a0
                  type: off-ramp
                  pricing: estimated
                  origin:
                    asset: BTC
                    amount: '0.00113173'
                    rate: '0.00001120405708392375'
                    node:
                      type: crypto-address
                      network: bitcoin
                  destination:
                    asset: USD
                    amount: '100.00'
                    rate: '89253.38317267768950981583'
                    node:
                      type: external-account
                      id: 7dc5c846-5ac2-4853-b67f-005cb83d4017
                      ownerId: cd21b26d-35d2-408a-9201-b8fdbef7a604
                      via: card
                      network: visa
                  denomination:
                    asset: USD
                    amount: '100.00'
                    rate: '1.00000000000000000000'
                    target: destination
                  fees:
                    - type: withdrawal
                      code: off-ramp-withdrawal
                      asset: BTC
                      amount: '0.00001132'
                      percentage: '1'
                      beneficiary: uphold
                  status: pending
                  timeline: []
                  quotedAt: '2024-07-24T15:02:39.000Z'
                  createdAt: '2024-07-24T15:03:39.000Z'
                  updatedAt: '2024-07-24T15:03:39.000Z'
            Order Created With Metadata Error:
              value:
                order:
                  id: 623000c8-9bdf-4a2b-aa3d-6a6b44a7f6a0
                  type: off-ramp
                  pricing: estimated
                  origin:
                    asset: BTC
                    amount: '0.00113173'
                    rate: '0.00001120405708392375'
                    node:
                      type: crypto-address
                      network: bitcoin
                  destination:
                    asset: USD
                    amount: '100.00'
                    rate: '89253.38317267768950981583'
                    node:
                      type: external-account
                      id: 7dc5c846-5ac2-4853-b67f-005cb83d4017
                      ownerId: cd21b26d-35d2-408a-9201-b8fdbef7a604
                      via: card
                      network: visa
                  denomination:
                    asset: USD
                    amount: '100.00'
                    rate: '1.00000000000000000000'
                    target: destination
                  fees:
                    - type: withdrawal
                      code: off-ramp-withdrawal
                      asset: BTC
                      amount: '0.00001132'
                      percentage: '1'
                      beneficiary: uphold
                  status: pending
                  timeline: []
                  quotedAt: '2024-07-24T15:02:39.000Z'
                  createdAt: '2024-07-24T15:03:39.000Z'
                  updatedAt: '2024-07-24T15:03:39.000Z'
                errors:
                  metadata:
                    code: content_too_large
                    message: >-
                      The entity metadata size is greater than maximum size
                      limit
                    details:
                      threshold:
                        unit: characters
                        limit: 1024
      headers:
        x-uphold-request-id:
          description: >-
            A unique identifier for the request that can be shared with Uphold
            for troubleshooting purposes.
          required: true
          schema:
            type: string
          examples:
            Request ID:
              value: a4e390583b3ac581-MRS
    create-order-not-found-response:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
          examples:
            Quote Not Found:
              value:
                code: entity_not_found
                message: The quote cannot be found
                details:
                  entity: quote
      headers:
        x-uphold-request-id:
          description: >-
            A unique identifier for the request that can be shared with Uphold
            for troubleshooting purposes.
          required: true
          schema:
            type: string
          examples:
            Request ID:
              value: a4e390583b3ac581-MRS
    create-order-conflict-response:
      description: Business logic error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
          examples:
            Missing User Context:
              value:
                code: operation_not_allowed
                message: Request not allowed due to missing user context
                details:
                  reasons:
                    - missing-user-ip-header
                    - missing-user-agent-header
            Missing Return URL:
              value:
                code: operation_not_allowed
                message: Transaction not allowed due to a missing return URL
                details:
                  reasons:
                    - missing-return-url
            Duplicate Deposit:
              value:
                code: operation_not_allowed
                message: Transaction not allowed due to a duplicate deposit
                details:
                  reasons:
                    - duplicate-deposit
            Quote Rate Variance Not Allowed:
              value:
                code: operation_not_allowed
                message: Transaction not allowed due to high quote rate variance
                details:
                  reasons:
                    - quote-rate-variance-not-allowed
            Country Restricted Transaction:
              value:
                code: operation_not_allowed
                message: Transaction not allowed due to a country-restricted violation
                details:
                  reasons:
                    - country-restricted-transaction
            Pending Requests For Information:
              value:
                code: operation_not_allowed
                message: Order not allowed due to pending requests for information
                details:
                  reasons:
                    - pending-requests-for-information
            User Tier Changed:
              value:
                code: operation_not_allowed
                message: Order not allowed due to a change in the user tier
                details:
                  reasons:
                    - user-tier-changed
            Card Declined:
              value:
                code: operation_not_allowed
                message: Transaction not allowed due to the card being declined
                details:
                  reasons:
                    - card-declined
            Processing Failure:
              value:
                code: operation_not_allowed
                message: Transaction not allowed due to a processing failure
                details:
                  reasons:
                    - card-unauthorized
            User Capability Failure - Requirements:
              value:
                code: user_capability_failure
                message: The user has capability constraints
                details:
                  capability:
                    code: on-ramp
                    requirements:
                      - user-must-submit-identity
                    restrictions: []
            User Capability Failure - Restrictions:
              value:
                code: user_capability_failure
                message: The user has capability constraints
                details:
                  capability:
                    code: on-ramp
                    requirements: []
                    restrictions:
                      - user-country-not-supported
            Amount Exceeds Periodic Limit:
              value:
                code: transaction_amount_invalid
                message: The amount exceeds the daily limit
                details:
                  context: body
                  property: denomination
                  rule: amount-exceeds-daily-limit
                  limit:
                    maximumAmount: '100.00'
                    remainingAmount: '80.00'
            Amount Maximum Limit Exceeded:
              value:
                code: transaction_amount_invalid
                message: The amount maximum limit was exceeded
                details:
                  context: body
                  property: denomination
                  rule: maximum-limit-exceeded
                  limit:
                    maximumAmount: '150.00'
            Amount Minimum Limit Not Met:
              value:
                code: transaction_amount_invalid
                message: The amount minimum limit was not met
                details:
                  context: body
                  property: denomination
                  rule: minimum-limit-not-met
                  limit:
                    minimumAmount: '0.85'
            Unspecified Error:
              value:
                code: operation_not_allowed
                message: Transaction not allowed due to an unspecified error
                details:
                  reasons:
                    - unspecified-error
      headers:
        x-uphold-request-id:
          description: >-
            A unique identifier for the request that can be shared with Uphold
            for troubleshooting purposes.
          required: true
          schema:
            type: string
          examples:
            Request ID:
              value: a4e390583b3ac581-MRS
  schemas:
    create-order-request:
      type: object
      properties:
        quoteId:
          description: The id of the quote to create the order from.
          type: string
          format: uuid
        params:
          description: Additional parameters required to create the order.
          type: object
          properties:
            requirements:
              description: The requirements data needed to create the order.
              type: array
              items:
                $ref: '#/components/schemas/create-order-requirement'
        metadata:
          $ref: '#/components/schemas/metadata'
          description: Additional data for the order.
      required:
        - quoteId
    order:
      type: object
      discriminator:
        propertyName: type
        mapping:
          on-ramp: '#/components/schemas/order-on-ramp'
          off-ramp: '#/components/schemas/order-off-ramp'
      oneOf:
        - $ref: '#/components/schemas/order-on-ramp'
          title: On-ramp
        - $ref: '#/components/schemas/order-off-ramp'
          title: Off-ramp
    error:
      description: The error information.
      allOf:
        - $ref: '#/components/schemas/feedback'
    create-order-requirement:
      type: object
      discriminator:
        propertyName: name
        mapping:
          authorize:3ds: '#/components/schemas/create-order-authorize-3ds-requirement'
          authorize:apple-pay: >-
            #/components/schemas/create-order-authorize-apple-google-pay-requirement
          authorize:google-pay: >-
            #/components/schemas/create-order-authorize-apple-google-pay-requirement
          authorize:paypal: '#/components/schemas/create-order-authorize-paypal-venmo-requirement'
          authorize:venmo: '#/components/schemas/create-order-authorize-paypal-venmo-requirement'
      oneOf:
        - $ref: '#/components/schemas/create-order-authorize-3ds-requirement'
          title: Authorize 3DS
        - $ref: >-
            #/components/schemas/create-order-authorize-apple-google-pay-requirement
          title: Authorize Apple Pay/Google Pay
        - $ref: '#/components/schemas/create-order-authorize-paypal-venmo-requirement'
          title: Authorize PayPal/Venmo
    metadata:
      type: object
      additionalProperties: true
      minProperties: 1
    order-on-ramp:
      allOf:
        - $ref: '#/components/schemas/order-base'
        - type: object
          properties:
            type:
              description: The type of the order.
              type: string
              enum:
                - on-ramp
            pricing:
              $ref: '#/components/schemas/order-pricing'
              description: The pricing mode of the order.
            origin:
              description: The origin of the order.
              allOf:
                - $ref: '#/components/schemas/order-endpoint-base'
                - type: object
                  properties:
                    node:
                      description: The node of the endpoint.
                      oneOf:
                        - title: External account
                          type: object
                          discriminator:
                            propertyName: via
                            mapping:
                              card: >-
                                #/components/schemas/order-node-external-account-card
                              apm: >-
                                #/components/schemas/order-node-external-account-apm
                          oneOf:
                            - $ref: >-
                                #/components/schemas/order-node-external-account-card
                              title: External Account - Card
                            - $ref: >-
                                #/components/schemas/order-node-external-account-apm
                              title: External Account - APM
                        - $ref: '#/components/schemas/order-node-apm-origin'
                          title: APM
                  required:
                    - node
            destination:
              description: The destination of the order.
              allOf:
                - $ref: '#/components/schemas/order-endpoint-base'
                - type: object
                  properties:
                    node:
                      description: The node of the endpoint.
                      oneOf:
                        - $ref: '#/components/schemas/order-node-crypto-address'
                          title: Crypto address
                        - $ref: >-
                            #/components/schemas/order-node-external-account-crypto
                          title: External Account - Crypto
                  required:
                    - node
          required:
            - type
            - pricing
            - origin
            - destination
    order-off-ramp:
      allOf:
        - $ref: '#/components/schemas/order-base'
        - type: object
          properties:
            type:
              description: The type of the order.
              type: string
              enum:
                - off-ramp
            pricing:
              description: The pricing mode of the order.
              type: string
              enum:
                - estimated
            origin:
              description: The origin of the order.
              allOf:
                - $ref: '#/components/schemas/order-endpoint-base'
                - type: object
                  properties:
                    node:
                      $ref: '#/components/schemas/order-node-crypto-address'
                      description: The node of the endpoint.
                  required:
                    - node
            destination:
              description: The destination of the order.
              allOf:
                - $ref: '#/components/schemas/order-endpoint-base'
                - type: object
                  properties:
                    node:
                      description: The node of the endpoint.
                      oneOf:
                        - title: External account
                          type: object
                          discriminator:
                            propertyName: via
                            mapping:
                              card: >-
                                #/components/schemas/order-node-external-account-card
                          oneOf:
                            - $ref: >-
                                #/components/schemas/order-node-external-account-card
                              title: External Account - Card
                  required:
                    - node
          required:
            - type
            - pricing
            - origin
            - destination
    feedback:
      description: A feedback message with a code and human-readable description.
      type: object
      properties:
        code:
          description: A short string with a brief explanation about the code reported.
          type: string
        message:
          description: A human-readable message providing more details.
          type: string
        details:
          description: Additional information about the feedback reported.
          type: object
          additionalProperties: true
      required:
        - code
        - message
    create-order-authorize-3ds-requirement:
      type: object
      properties:
        name:
          description: The name of the requirement.
          type: string
          enum:
            - authorize:3ds
        returnUrl:
          description: The URL to redirect after the 3DS authorization flow.
          type: string
          format: uri
          pattern: ^[a-zA-Z][a-zA-Z0-9+\-.]*:\/\/[^\s]+$
      required:
        - name
        - returnUrl
    create-order-authorize-apple-google-pay-requirement:
      type: object
      properties:
        name:
          description: The name of the requirement.
          type: string
          enum:
            - authorize:apple-pay
            - authorize:google-pay
        provider:
          description: The provider used for the authorization.
          type: string
          enum:
            - checkout
        deviceData:
          description: The device data for fraud prevention.
          type: string
        tokenizedPayment:
          description: The payload from the payment provider.
          type: object
          additionalProperties: true
      required:
        - name
        - provider
        - deviceData
        - tokenizedPayment
    create-order-authorize-paypal-venmo-requirement:
      type: object
      properties:
        name:
          description: The name of the requirement.
          type: string
          enum:
            - authorize:paypal
            - authorize:venmo
        provider:
          description: The provider used for the authorization.
          type: string
          enum:
            - braintree
        deviceData:
          description: The device data for fraud prevention.
          type: string
        tokenizedPayment:
          description: The payload from the payment provider.
          type: object
          additionalProperties: true
      required:
        - name
        - provider
        - deviceData
    order-base:
      type: object
      properties:
        id:
          description: The id of the order.
          type: string
          format: uuid
        type:
          $ref: '#/components/schemas/order-type'
        origin:
          type: object
        destination:
          type: object
        denomination:
          $ref: '#/components/schemas/order-denomination'
          description: The denomination of the order.
        fees:
          $ref: '#/components/schemas/order-fees'
          description: The fees of the order.
        status:
          description: The status of the order.
          type: string
          enum:
            - pending
            - processing
            - on-hold
            - completed
            - expired
            - failed
        timeline:
          description: >-
            The timeline of events that occurred throughout the order's
            lifecycle.
          type: array
          items:
            $ref: '#/components/schemas/order-timeline-item'
        quotedAt:
          description: The time at which the order was quoted.
          type: string
          format: date-time
        createdAt:
          description: The time at which the order was created.
          type: string
          format: date-time
        updatedAt:
          description: The time at which the order was last updated.
          type: string
          format: date-time
        completedAt:
          description: The time at which the order was completed, if it has completed.
          type: string
          format: date-time
      required:
        - id
        - type
        - origin
        - destination
        - denomination
        - fees
        - status
        - timeline
        - quotedAt
        - createdAt
        - updatedAt
    order-pricing:
      description: The pricing mode.
      type: string
      enum:
        - estimated
        - locked
    order-endpoint-base:
      type: object
      properties:
        asset:
          description: The asset of the endpoint.
          type: string
        amount:
          description: The amount of the endpoint.
          type: string
        rate:
          description: >-
            The rate of the endpoint against its counter-part (origin to
            destination and vice-versa).
          type: string
      required:
        - asset
        - amount
        - rate
    order-node-external-account-card:
      allOf:
        - $ref: '#/components/schemas/quote-node-external-account-card'
        - type: object
          properties:
            confirmationUrl:
              description: >-
                The URL to confirm the authorization using the external account
                (e.g., 3DS).
              type: string
              format: uri
    order-node-external-account-apm:
      allOf:
        - $ref: '#/components/schemas/quote-node-external-account-apm'
        - type: object
          properties:
            confirmationUrl:
              description: >-
                The URL to confirm the authorization using the APM external
                account.
              type: string
              format: uri
    order-node-apm-origin:
      allOf:
        - $ref: '#/components/schemas/quote-node-apm-origin'
        - type: object
          properties:
            confirmationUrl:
              description: The URL to confirm the authorization using the APM.
              type: string
              format: uri
    order-node-crypto-address:
      type: object
      properties:
        type:
          description: The type of the node.
          type: string
          enum:
            - crypto-address
        network:
          $ref: '#/components/schemas/string-no-edge-spaces'
          description: The network that the crypto address is on.
        address:
          $ref: '#/components/schemas/string-no-edge-spaces'
          description: The crypto address (may not be available for deposits).
        reference:
          description: >-
            The additional identifier (e.g., destination tag, memo, or message)
            for the crypto address.
          type: string
        execution:
          $ref: '#/components/schemas/order-node-crypto-address-execution'
          description: The execution details for the operation.
      required:
        - type
        - network
    order-node-external-account-crypto:
      allOf:
        - $ref: '#/components/schemas/order-node-external-account-base'
        - type: object
          properties:
            via:
              description: The rail type which the external account is used.
              type: string
              enum:
                - crypto
            network:
              description: The network used with the external account.
              type: string
            execution:
              $ref: '#/components/schemas/order-node-crypto-address-execution'
              description: The execution details for the operation.
          required:
            - via
            - network
    order-type:
      description: >-
        Whether the order is an on-ramp (fiat to crypto) or off-ramp (crypto to
        fiat) order.
      type: string
      enum:
        - on-ramp
        - off-ramp
    order-denomination:
      type: object
      properties:
        asset:
          description: The asset in which the operation is denominated.
          type: string
        amount:
          description: The amount of the operation.
          type: string
        rate:
          description: The rate against the specified target (origin or destination).
          type: string
        target:
          description: >-
            Whether this exact amount should be paid by the origin or received
            by the destination.
          type: string
          enum:
            - origin
            - destination
      required:
        - asset
        - amount
        - rate
        - target
    order-fees:
      type: array
      items:
        type: object
        properties:
          type:
            description: The type of the fee, as charged on the order's transactions.
            type: string
            enum:
              - deposit
              - exchange
              - network
              - withdrawal
          code:
            description: The code of the fee, as charged on the order's transactions.
            type: string
          asset:
            description: The asset in which the fee is denominated.
            type: string
          amount:
            description: The amount of the fee.
            type: string
          percentage:
            description: >-
              The percentage of the fee, if the amount was calculated from a
              percentage.
            type: string
          beneficiary:
            description: The party that receives the fee.
            type: string
        required:
          - type
          - code
          - asset
          - amount
    order-timeline-item:
      type: object
      oneOf:
        - $ref: '#/components/schemas/order-timeline-item-regular'
          title: Regular events
        - $ref: '#/components/schemas/order-timeline-item-error'
          title: Events with error
        - $ref: '#/components/schemas/order-timeline-item-reason'
          title: Events with reason
    quote-node-external-account-card:
      allOf:
        - $ref: '#/components/schemas/order-node-external-account-base'
        - type: object
          properties:
            via:
              description: The rail type which the external account is used.
              type: string
              enum:
                - card
            network:
              description: The network used with the external account.
              type: string
          required:
            - via
            - network
    quote-node-external-account-apm:
      allOf:
        - $ref: '#/components/schemas/order-node-external-account-base'
        - type: object
          properties:
            via:
              description: The rail type which the external account is used.
              type: string
              enum:
                - apm
          required:
            - via
    quote-node-apm-origin:
      type: object
      properties:
        type:
          description: The type of the node.
          type: string
          enum:
            - apm
        method:
          description: The alternative payment method to be used in the operation.
          enum:
            - apple-pay
            - google-pay
            - paypal
            - venmo
      required:
        - type
        - method
    string-no-edge-spaces:
      type: string
      pattern: ^\S.*\S$|^\S$
    order-node-crypto-address-execution:
      type: object
      discriminator:
        propertyName: mode
        mapping:
          onchain: '#/components/schemas/order-node-crypto-address-execution-onchain'
          offchain: '#/components/schemas/order-node-crypto-address-execution-offchain'
          simulated: '#/components/schemas/order-node-crypto-address-execution-simulated'
      oneOf:
        - $ref: '#/components/schemas/order-node-crypto-address-execution-onchain'
          title: On-chain
        - $ref: '#/components/schemas/order-node-crypto-address-execution-offchain'
          title: Off-chain
        - $ref: '#/components/schemas/order-node-crypto-address-execution-simulated'
          title: Simulated
    order-node-external-account-base:
      type: object
      properties:
        type:
          description: The type of the node.
          type: string
          enum:
            - external-account
        id:
          description: The external account id.
          type: string
          format: uuid
        ownerId:
          description: The id of the user that owns the external account.
          type: string
          format: uuid
        via:
          description: The rail type which the external account is used.
          type: string
          enum:
            - apm
            - card
            - crypto
      required:
        - type
        - id
        - ownerId
    order-timeline-item-regular:
      type: object
      properties:
        event:
          description: The event that occurred in the order's timeline.
          type: string
          enum:
            - deposit-requested
            - deposit-processing
            - deposit-completed
            - deposit-expired
            - withdrawal-processing
            - withdrawal-sent
            - withdrawal-completed
            - refund-address-requested
            - refund-address-completed
            - refund-processing
            - refund-sent
            - refund-completed
            - refund-skipped
        timestamp:
          $ref: '#/components/schemas/order-timeline-timestamp'
      required:
        - event
        - timestamp
    order-timeline-item-error:
      type: object
      properties:
        event:
          description: The event that occurred in the order's timeline.
          type: string
          enum:
            - withdrawal-commit-failed
            - refund-commit-failed
        timestamp:
          $ref: '#/components/schemas/order-timeline-timestamp'
        error:
          $ref: '#/components/schemas/error'
          title: The error associated with the event.
      required:
        - event
        - error
        - timestamp
    order-timeline-item-reason:
      type: object
      properties:
        event:
          description: The event that occurred in the order's timeline.
          type: string
          enum:
            - deposit-on-hold
            - deposit-failed
            - withdrawal-on-hold
            - withdrawal-failed
            - refund-on-hold
            - refund-failed
        timestamp:
          $ref: '#/components/schemas/order-timeline-timestamp'
        reason:
          $ref: '#/components/schemas/transaction-status-reason'
          description: The reason associated with the event.
      required:
        - event
        - reason
        - timestamp
    order-node-crypto-address-execution-onchain:
      type: object
      properties:
        mode:
          description: The mode of execution.
          type: string
          enum:
            - onchain
        transactionHash:
          $ref: '#/components/schemas/string-no-edge-spaces'
          description: The hash of the transaction in the blockchain.
      required:
        - mode
        - transactionHash
    order-node-crypto-address-execution-offchain:
      type: object
      properties:
        mode:
          description: The mode of execution.
          type: string
          enum:
            - offchain
        accountId:
          description: The account id to which the off-chain transaction was made.
          type: string
          format: uuid
        accountOwnerId:
          description: >-
            The id of the user that owns the account to which the off-chain
            transaction was made.
          type: string
          format: uuid
      required:
        - mode
    order-node-crypto-address-execution-simulated:
      type: object
      properties:
        mode:
          description: The mode of execution.
          type: string
          enum:
            - simulated
        transactionHash:
          $ref: '#/components/schemas/string-no-edge-spaces'
          description: The simulated transaction hash.
      required:
        - mode
    order-timeline-timestamp:
      description: The time at which the event occurred.
      type: string
      format: date-time
    transaction-status-reason:
      description: The reason why the transaction failed or is on hold.
      type: string
      enum:
        - apm-account-holder-data-mismatch
        - apm-authorization-failed
        - apm-missing-account-holder-data
        - apm-payment-method-declined
        - bank-account-holder-name-mismatch
        - beneficiary-country-restricted
        - card-declined
        - card-declined-by-bank
        - card-expired
        - card-permanently-declined-by-bank
        - card-unauthorized
        - card-unsupported
        - card-withdrawals-unsupported
        - insufficient-funds
        - pending-requests-for-information
        - provider-maximum-limit-exceeded
        - screening-verification-failed
        - travel-rule-verification-failed
        - unspecified-error
        - velocity
  securitySchemes:
    OAuth2:
      type: oauth2
      description: OAuth 2.0 authentication
      flows:
        clientCredentials:
          tokenUrl: /core/oauth2/token
          scopes:
            on-off-ramp.orders:create: Grants access to create orders.
            on-off-ramp.orders:read: Grants access to view orders.
            on-off-ramp.orders.metadata:read: Grants access to view orders metadata.
            on-off-ramp.orders.metadata:write: Grants access to modify orders metadata.
            on-off-ramp.orders.quotes:create: Grants access to create order quotes.

````