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

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

## Order type

The `type` field sets the [order type](https://developer.uphold.com/rest-apis/on-off-ramp-api/orders/overview.md#order-types): `on-ramp` to buy crypto with fiat, or `off-ramp` to sell crypto for fiat. It defines the shape of the rest of the request, including the node types allowed as origin and destination.

## Origin and destination

The `origin` and `destination` objects identify the source and destination of funds respectively for the order.

Read more about the [Anatomy of a quote request](https://developer.uphold.com/rest-apis/on-off-ramp-api/orders/overview.md#anatomy-of-a-quote-request) to understand the different types of nodes you can use as origin and destination for each order type. Refer to the API spec below to see how each node type is expressed in the request.

## Denomination

The `denomination` object defines what is being moved, how much, and which side of the order the amount applies to precisely.

* `asset`: The currency or asset in which `amount` is expressed — for example, `USD` or `BTC`. Does not need to match the asset of the origin or the destination; Uphold will convert as needed.
* `amount`: The amount of the order, expressed as a decimal string (e.g. `"100.00"`).
* `target`: Controls which side of the order has the exact `amount`:
  * `origin` — The origin pays exactly `amount`. Fees are deducted before the destination receives funds.
  * `destination` — The destination receives exactly `amount`. Fees are added on top of what the origin pays.

### Example: How target affects fee handling

Consider an on-ramp of 500 USD to BTC with a 2% fee:

| Target | Paid by origin | Received by destination |
| - | - | - |
| `origin` | Exactly 500 USD | BTC equivalent of 490 USD (after 10 USD fee) |
| `destination` | 510 USD (500 + 10 USD fee) | BTC equivalent of exactly 500 USD |

Use `origin` when you want to control exactly how much the user pays. Use `destination` when you want to control exactly how much the user receives.

For a more comprehensive explanation of the denomination concept, see the [Core API introduction](https://developer.uphold.com/rest-apis/core-api/introduction.md#denomination) page.

## Pricing and fees

The `pricing` field in the response says whether the rate is `locked` for the order or `estimated`, in which case the final amounts may differ. Quotes for orders whose deposit the user pushes, such as crypto from an external wallet, are always `estimated`. The `fees` field lists each fee charged on the order.

Read more about [pricing](https://developer.uphold.com/rest-apis/on-off-ramp-api/orders/overview.md#pricing) and [fees](https://developer.uphold.com/rest-apis/on-off-ramp-api/orders/overview.md#fees).

## Quote expiry

A quote is valid for a limited time. The `expiresAt` field in the response indicates the exact time when the quote expires, after which it can no longer be used to create an order.

The `refreshAt` field indicates the recommended time to refresh the quote. There is no endpoint to refresh a quote: to refresh it, create a new one. Use it to drive quote refresh logic in your UI: if the user hasn't confirmed by then, create a new quote. The quote's `expiresAt` is equal to or later than `refreshAt`, to give the user time to complete an external action needed to proceed, such as authorizing an APM payment.

A quote can only be used once. See [Creating a quote-based order](https://developer.uphold.com/rest-apis/on-off-ramp-api/orders/overview.md#creating-a-quote-based-order) for the error returned when an order is created from an expired or already used quote.

## Requirements

Some quotes require additional information before the order can be created. The `requirements` array in the response lists what is needed — if it's empty, no extra information is needed and you can proceed to create the order directly.

Read more about [requirements](https://developer.uphold.com/rest-apis/on-off-ramp-api/orders/overview.md#requirements).


## OpenAPI

````yaml _media/specs/on-off-ramp-openapi.mintlify.json post /on-off-ramp/orders/quote
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/quote:
    post:
      tags:
        - Orders
      summary: Create quote
      description: Create a quote for an on-ramp or off-ramp order.
      operationId: on-off-ramp.create-quote
      requestBody:
        $ref: '#/components/requestBodies/create-quote-request-body'
      responses:
        '201':
          $ref: '#/components/responses/create-quote-response'
        '404':
          $ref: '#/components/responses/create-quote-not-found-response'
        '409':
          $ref: '#/components/responses/create-quote-conflict-response'
      security:
        - OAuth2:
            - on-off-ramp.orders.quotes:create
components:
  requestBodies:
    create-quote-request-body:
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/create-quote-request'
          examples:
            On-ramp - 100 USD from an external account to XRP:
              value:
                type: on-ramp
                origin:
                  type: external-account
                  id: 7dc5c846-5ac2-4853-b67f-005cb83d4017
                destination:
                  type: crypto-address
                  asset: XRP
                  network: xrp-ledger
                  address: rfBtmHiLwwWH5maH2PT78GxubrSydRF9aY
                  reference: '67809592'
                denomination:
                  asset: USD
                  amount: '100.00'
                  target: origin
            On-ramp - 100 USD from an external account to a crypto external account:
              value:
                type: on-ramp
                origin:
                  type: external-account
                  id: 7dc5c846-5ac2-4853-b67f-005cb83d4017
                destination:
                  type: external-account
                  id: 5606d0a7-ff4d-ce4f-8675-dea65619122e
                denomination:
                  asset: USD
                  amount: '100.00'
                  target: origin
            On-ramp - 100 USD from an alternative payment method to XRP:
              value:
                type: on-ramp
                origin:
                  type: apm
                  method: paypal
                destination:
                  type: crypto-address
                  asset: XRP
                  network: xrp-ledger
                  address: rfBtmHiLwwWH5maH2PT78GxubrSydRF9aY
                  reference: '67809592'
                denomination:
                  asset: USD
                  amount: '100.00'
                  target: origin
            Off-ramp - BTC to 100 USD in an external account:
              value:
                type: off-ramp
                origin:
                  type: crypto-address
                  asset: BTC
                  network: bitcoin
                destination:
                  type: external-account
                  id: 7dc5c846-5ac2-4853-b67f-005cb83d4017
                denomination:
                  asset: USD
                  amount: '100.00'
                  target: destination
  responses:
    create-quote-response:
      description: Quote created.
      content:
        application/json:
          schema:
            type: object
            properties:
              quote:
                $ref: '#/components/schemas/quote'
            required:
              - quote
          examples:
            On-ramp Quote Created:
              value:
                quote:
                  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
                  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'
                  requirements:
                    - name: authorize:3ds
                      quoteId: 9f8a7c2e-1b3d-4e5f-8a6b-7c9d0e1f2a3b
                  expiresAt: '2024-07-24T15:22:51.000Z'
                  refreshAt: '2024-07-24T15:22:39.000Z'
            On-ramp Quote Created - Credit Card to Crypto External Account:
              value:
                quote:
                  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
                  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'
                  requirements:
                    - name: authorize:3ds
                      quoteId: 9f8a7c2e-1b3d-4e5f-8a6b-7c9d0e1f2a3b
                  expiresAt: '2024-07-24T15:22:51.000Z'
                  refreshAt: '2024-07-24T15:22:39.000Z'
            Off-ramp Quote Created:
              value:
                quote:
                  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
                  requirements: []
                  expiresAt: '2024-07-24T15:22:51.000Z'
                  refreshAt: '2024-07-24T15:22:39.000Z'
      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-quote-not-found-response:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
          examples:
            Denomination Asset Not Found:
              value:
                code: entity_not_found
                message: The denomination asset cannot be found
                details:
                  entity: asset
                  context: body
                  property: denomination.asset
            Origin Not Found:
              value:
                code: entity_not_found
                message: The origin cannot be found
                details:
                  entity: external-account
                  context: body
                  property: origin
            Destination Not Found:
              value:
                code: entity_not_found
                message: The destination cannot be found
                details:
                  entity: external-account
                  context: body
                  property: destination
            Rail For Destination Asset And Network Not Found:
              value:
                code: entity_not_found
                message: >-
                  A rail for the specified destination asset and network cannot
                  be found
                details:
                  entity: rail
                  context: body
                  property: destination
      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-quote-conflict-response:
      description: Business logic error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
          examples:
            Transaction Node Invalid:
              value:
                code: transaction_node_invalid
                message: The origin node is invalid
            Origin External Account Status Invalid:
              value:
                code: transaction_node_invalid
                message: The origin external account status is invalid
            Destination External Account Status Invalid:
              value:
                code: transaction_node_invalid
                message: The destination external account status is invalid
            Origin External Account Type Not Allowed:
              value:
                code: transaction_node_invalid
                message: The origin external account type is not allowed
            Destination External Account Type Not Allowed:
              value:
                code: transaction_node_invalid
                message: The destination external account type is not allowed
            Destination External Account Missing Withdraw Feature:
              value:
                code: transaction_node_invalid
                message: The destination external account lacks 'withdraw' feature
            Destination External Account Network Not Supported:
              value:
                code: transaction_node_invalid
                message: >-
                  The destination external account does not support the
                  specified network
            Crypto Address Invalid:
              value:
                code: crypto_address_invalid
                message: The crypto address is invalid
                details:
                  context: body
                  property: destination.address
            Crypto Address Reference Missing:
              value:
                code: crypto_address_invalid
                message: The crypto address reference is missing
                details:
                  context: body
                  property: destination.reference
            Crypto Address Reference Invalid:
              value:
                code: crypto_address_invalid
                message: The crypto address reference is invalid
                details:
                  context: body
                  property: destination.reference
            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
            Origin Asset Missing Sell Feature:
              value:
                code: asset_feature_not_available
                message: The 'sell' feature is not available for the origin asset
                details:
                  context: body
                  property: origin
                  feature: sell
            Destination Asset Missing Buy Feature:
              value:
                code: asset_feature_not_available
                message: The 'buy' feature is not available for the destination asset
                details:
                  context: body
                  property: destination
                  feature: buy
            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'
            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'
            Country Restricted Transaction:
              value:
                code: operation_not_allowed
                message: Transaction not allowed due to a country-restricted violation
                details:
                  reasons:
                    - country-restricted-transaction
            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-quote-request:
      type: object
      discriminator:
        propertyName: type
        mapping:
          on-ramp: '#/components/schemas/create-quote-on-ramp-request'
          off-ramp: '#/components/schemas/create-quote-off-ramp-request'
      oneOf:
        - $ref: '#/components/schemas/create-quote-on-ramp-request'
          title: On-ramp
        - $ref: '#/components/schemas/create-quote-off-ramp-request'
          title: Off-ramp
    quote:
      type: object
      discriminator:
        propertyName: type
        mapping:
          on-ramp: '#/components/schemas/quote-on-ramp'
          off-ramp: '#/components/schemas/quote-off-ramp'
      oneOf:
        - $ref: '#/components/schemas/quote-on-ramp'
          title: On-ramp
        - $ref: '#/components/schemas/quote-off-ramp'
          title: Off-ramp
    error:
      description: The error information.
      allOf:
        - $ref: '#/components/schemas/feedback'
    create-quote-on-ramp-request:
      type: object
      properties:
        type:
          description: The type of the quote.
          type: string
          enum:
            - on-ramp
        origin:
          type: object
          discriminator:
            propertyName: type
            mapping:
              external-account: '#/components/schemas/create-quote-node-external-account'
              apm: '#/components/schemas/create-quote-node-apm-origin'
          oneOf:
            - $ref: '#/components/schemas/create-quote-node-external-account'
              title: External account
            - $ref: '#/components/schemas/create-quote-node-apm-origin'
              title: APM
        destination:
          type: object
          discriminator:
            propertyName: type
            mapping:
              crypto-address: '#/components/schemas/create-quote-node-crypto-address'
              external-account: '#/components/schemas/create-quote-node-external-account-crypto'
          oneOf:
            - $ref: '#/components/schemas/create-quote-node-crypto-address'
              title: Crypto address
            - $ref: '#/components/schemas/create-quote-node-external-account-crypto'
              title: External account
        denomination:
          $ref: '#/components/schemas/create-quote-denomination'
      required:
        - type
        - origin
        - destination
        - denomination
    create-quote-off-ramp-request:
      type: object
      properties:
        type:
          description: The type of the quote.
          type: string
          enum:
            - off-ramp
        origin:
          $ref: '#/components/schemas/create-quote-node-crypto-outpoint'
        destination:
          type: object
          discriminator:
            propertyName: type
            mapping:
              external-account: '#/components/schemas/create-quote-node-external-account'
          oneOf:
            - $ref: '#/components/schemas/create-quote-node-external-account'
              title: External account
        denomination:
          $ref: '#/components/schemas/create-quote-denomination'
      required:
        - type
        - origin
        - destination
        - denomination
    quote-on-ramp:
      allOf:
        - $ref: '#/components/schemas/quote-base'
        - type: object
          properties:
            type:
              description: The type of the quote.
              type: string
              enum:
                - on-ramp
            pricing:
              $ref: '#/components/schemas/order-pricing'
              description: The pricing mode of the quote.
            origin:
              description: The origin of the quote.
              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/quote-node-external-account-card
                              apm: >-
                                #/components/schemas/quote-node-external-account-apm
                          oneOf:
                            - $ref: >-
                                #/components/schemas/quote-node-external-account-card
                              title: External Account - Card
                            - $ref: >-
                                #/components/schemas/quote-node-external-account-apm
                              title: External Account - APM
                        - $ref: '#/components/schemas/quote-node-apm-origin'
                          title: APM
                  required:
                    - node
            destination:
              description: The destination of the quote.
              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
    quote-off-ramp:
      allOf:
        - $ref: '#/components/schemas/quote-base'
        - type: object
          properties:
            type:
              description: The type of the quote.
              type: string
              enum:
                - off-ramp
            pricing:
              description: The pricing mode of the quote.
              type: string
              enum:
                - estimated
            origin:
              description: The origin of the quote.
              allOf:
                - $ref: '#/components/schemas/order-endpoint-base'
                - type: object
                  properties:
                    node:
                      $ref: '#/components/schemas/order-node-crypto-outpoint'
                      description: The node of the endpoint.
                  required:
                    - node
            destination:
              description: The destination of the quote.
              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/quote-node-external-account-card
                          oneOf:
                            - $ref: >-
                                #/components/schemas/quote-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-quote-node-external-account:
      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
      required:
        - type
        - id
    create-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
    create-quote-node-crypto-address:
      type: object
      properties:
        type:
          description: The type of the node.
          type: string
          enum:
            - crypto-address
        asset:
          allOf:
            - $ref: '#/components/schemas/string-no-edge-spaces'
            - description: The asset to be used in the operation.
              type: string
              maxLength: 20
        network:
          allOf:
            - $ref: '#/components/schemas/string-no-edge-spaces'
            - description: The network that the crypto address is on.
              type: string
              maxLength: 50
        address:
          allOf:
            - $ref: '#/components/schemas/string-no-edge-spaces'
            - description: The crypto address.
              type: string
              maxLength: 256
        reference:
          allOf:
            - $ref: '#/components/schemas/string-no-edge-spaces'
            - description: >-
                The additional identifier (e.g., destination tag, memo, or
                message) required for some networks such as XRP (Ripple), XLM
                (Stellar), EOS, and others. If the network does not require a
                tag, this field can be omitted.
              type: string
              maxLength: 255
      required:
        - type
        - asset
        - network
        - address
    create-quote-node-external-account-crypto:
      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
        network:
          allOf:
            - $ref: '#/components/schemas/string-no-edge-spaces'
            - description: The network used with the crypto external account.
              type: string
              maxLength: 50
      required:
        - type
        - id
    create-quote-denomination:
      type: object
      properties:
        asset:
          description: The asset in which the order is denominated.
          type: string
        amount:
          allOf:
            - $ref: '#/components/schemas/non-zero-decimal-amount'
            - description: The amount of the order.
        target:
          description: >-
            Whether this exact amount should be paid by the origin or received
            by the destination.
          type: string
          enum:
            - origin
            - destination
          default: origin
      required:
        - asset
        - amount
    create-quote-node-crypto-outpoint:
      type: object
      additionalProperties: false
      properties:
        type:
          description: The type of the node.
          type: string
          enum:
            - crypto-address
        asset:
          allOf:
            - $ref: '#/components/schemas/string-no-edge-spaces'
            - description: The asset to be used in the operation.
              type: string
              maxLength: 20
        network:
          allOf:
            - $ref: '#/components/schemas/string-no-edge-spaces'
            - description: The network that the crypto address is on.
              type: string
              maxLength: 50
      required:
        - type
        - asset
        - network
    quote-base:
      type: object
      properties:
        id:
          description: The id of the quote.
          type: string
          format: uuid
        type:
          $ref: '#/components/schemas/order-type'
        pricing:
          $ref: '#/components/schemas/order-pricing'
          description: The pricing mode of the quote.
        origin:
          type: object
        destination:
          type: object
        denomination:
          $ref: '#/components/schemas/order-denomination'
          description: The denomination of the quote.
        fees:
          $ref: '#/components/schemas/order-fees'
          description: The fees of the quote.
        requirements:
          $ref: '#/components/schemas/quote-requirements'
          description: >-
            The requirements the user must address when attempting to create the
            order with this quote.
        refreshAt:
          description: The time at which the quote can be refreshed.
          type: string
          format: date-time
        expiresAt:
          description: The time at which the quote expires.
          type: string
          format: date-time
      required:
        - id
        - type
        - origin
        - destination
        - denomination
        - fees
        - requirements
        - expiresAt
        - refreshAt
    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
    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
    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-node-crypto-outpoint:
      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.
      required:
        - type
        - network
    string-no-edge-spaces:
      type: string
      pattern: ^\S.*\S$|^\S$
    non-zero-decimal-amount:
      type: string
      pattern: ^(?!0+(\.0+)?$)\d+(\.\d+)?$
    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
    quote-requirements:
      type: array
      items:
        type: object
        properties:
          name:
            description: The code of the requirement.
            type: string
            enum:
              - authorize:3ds
              - authorize:apple-pay
              - authorize:google-pay
              - authorize:paypal
              - authorize:venmo
              - travel-rule
          quoteId:
            description: >-
              The id of the quote for which the requirement must be fulfilled
              (e.g., the deposit quote to authorize).
            type: string
            format: uuid
        required:
          - name
          - quoteId
    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-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-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
  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.

````