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

> Simulate an on-ramp or off-ramp order to estimate its amounts, rates and fees.

**Create simulation** estimates the amounts, rates and fees of an on-ramp or off-ramp order before you create a quote. Use it, for example, to show the fees of each card or payment method before the user picks one or signs up.

A simulation is only an estimate:

* It is not stored and cannot be used to create an order. To place the order, call [Create quote](https://developer.uphold.com/rest-apis/on-off-ramp-api/orders/create-quote.md) and pass its ID to [Create order](https://developer.uphold.com/rest-apis/on-off-ramp-api/orders/create-order.md).
* A simulation can succeed where a quote for the same order fails, since it does not check the user's capabilities, amount limits, rail features or external account status.
* Rates and fees can change between the simulation and the quote. Always present the quote values to the user before they confirm the order.

## Origin and destination

The request accepts the node types of [Create quote](https://developer.uphold.com/rest-apis/on-off-ramp-api/orders/create-quote.md), plus simulated nodes that have no `id`. An on-ramp goes from a card or APM to a crypto destination, and an off-ramp goes from a crypto address to a card. The nodes follow these rules:

* Card, APM and crypto nodes must use a [rail](https://developer.uphold.com/rest-apis/on-off-ramp-api/assets/list-rails.md) enabled for your organization. For a simulated node, the rail must match its asset and its method, or its network for crypto nodes, and its card network when you send one. Otherwise, the request fails with a `404`.
* Unlike a quote, a simulation doesn't check the rail's features, so it also estimates a deposit or withdrawal the rail doesn't allow.
* An invalid node, such as a node of an external account type that isn't allowed for that side of the order, fails with a `409` `transaction_node_invalid` error. As an off-ramp destination, a card **External account** must be a debit card, since withdrawals only go to debit cards, or it fails in the same way.

Each node is either plain or simulated. 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) and the [denomination](https://developer.uphold.com/rest-apis/on-off-ramp-api/orders/create-quote.md#denomination).

### Plain nodes

**External account** and **APM** nodes work as in a quote:

* An **External account** references an external account of the user by `id`: a card or APM external account for on-ramp origins, a crypto external account for on-ramp destinations, and a card external account for off-ramp destinations.
* External accounts belong to users, so referencing one requires [acting on behalf of a user](https://developer.uphold.com/rest-apis/authentication.md#subjects). Organization-wide clients do it with the `X-On-Behalf-Of` header, while single-user clients already act on behalf of their user and don't need the header.
* An **APM** node without an `asset` also requires acting on behalf of a user, in the same way. Its asset is then the currency of the method in the user's country. If the method isn't available in the user's country, no rail matches it and the response is `404`.

### Simulated nodes

Simulated nodes, such as **Card external account (simulated)**, describe the node without an `id`. You can send them with or without acting on behalf of a user:

| Node | What to send |
| - | - |
| `external-account` with `via: card` | The `asset` and the card `method`, which sets the fees, e.g. `{ "type": "external-account", "via": "card", "asset": "USD", "method": "debit-card" }`. The method is `credit-card` or `debit-card` for on-ramp origins, and only `debit-card` for off-ramp destinations. The card `network` (e.g. `visa`) is optional. |
| `external-account` with `via: apm` | For on-ramp origins. The `method` and the `asset`, e.g. `{ "type": "external-account", "via": "apm", "method": "paypal", "asset": "USD" }`. The response also returns the method as its `network`, as it does for an APM **External account**. |
| `external-account` with `via: crypto` | For on-ramp destinations. The `asset` and the `network`, which stand for any address of the network, e.g. `{ "type": "external-account", "via": "crypto", "asset": "BTC", "network": "bitcoin" }`. |
| `apm` | For on-ramp origins. The `method` and the `asset`, e.g. `{ "type": "apm", "method": "paypal", "asset": "USD" }`. |
| `crypto-address` | For on-ramp destinations and off-ramp origins. The `asset` and the `network`, which stand for any address of the network, e.g. `{ "type": "crypto-address", "asset": "BTC", "network": "bitcoin" }`. As an on-ramp destination, it takes no `address` or `reference`. |

## Response

The `simulation` object contains:

* The order `type`.
* The estimated `origin` and `destination`, each with its `asset`, `amount`, `rate` and `node`.
* The `denomination`.
* The estimated `fees`.
* `simulatedAt`, the time at which the rates of the simulation were quoted.

APM and crypto address nodes are returned as sent in the request. External account nodes return:

* The `id`, if you sent one.
* `via`, which says how the order is made.
* The `network` used, when there is one. A simulated card sent without a `network` is returned without it.
* The card `method`, if you sent one, or the `method` of an APM.

The asset of an external account node is returned in `origin.asset` or `destination.asset`, not in the node. Networks are matched in any case and returned in lowercase, e.g. `Bitcoin` is returned as `bitcoin`.

Unlike quotes, simulations have no `id`, `pricing`, `expiresAt`, `refreshAt` or `requirements`. Check the requirements on the quote before you create the order.

## Precision

The more the simulation knows about the user and the external accounts, the closer it is to the quote. Fees and amounts are less precise in these cases:

| Case | What changes |
| - | - |
| Not acting on behalf of a user | Fees come from your organization's default plan for individual users, not from the plan of a specific user, such as a business user. Rates can also differ slightly, since they don't include the spread adjustment for the user's country. |
| `Card external account (simulated)` | The estimate does not depend on the card `network` (e.g. `visa`), which is returned in the response, but must match a card rail of your organization. A quote for a real card on that network can differ if the network affects the card's fees. |
| `Crypto address` or `Crypto external account (simulated)` as an on-ramp destination | Transfers to another Uphold user's address are free. These nodes take no address, so the simulation always includes the network fee. A crypto `External account` uses its saved address. |


## OpenAPI

````yaml _media/specs/on-off-ramp-openapi.mintlify.json post /on-off-ramp/orders/simulation
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/simulation:
    post:
      tags:
        - Orders
      summary: Create simulation
      description: >-
        Simulate an on-ramp or off-ramp order to estimate its amounts, rates and
        fees.
      operationId: on-off-ramp.create-simulation
      requestBody:
        $ref: '#/components/requestBodies/create-simulation-request-body'
      responses:
        '200':
          $ref: '#/components/responses/create-simulation-response'
        '404':
          $ref: '#/components/responses/create-simulation-not-found-response'
        '409':
          $ref: '#/components/responses/create-simulation-conflict-response'
      security:
        - OAuth2:
            - on-off-ramp.orders.quotes:simulate
components:
  requestBodies:
    create-simulation-request-body:
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/create-simulation-request'
          examples:
            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 a card to a crypto external account (simulated nodes):
              value:
                type: on-ramp
                origin:
                  type: external-account
                  via: card
                  asset: USD
                  network: visa
                  method: debit-card
                destination:
                  type: external-account
                  via: crypto
                  asset: BTC
                  network: bitcoin
                denomination:
                  asset: USD
                  amount: '100.00'
                  target: origin
            On-ramp - 100 USD from an alternative payment method to a crypto external account:
              value:
                type: on-ramp
                origin:
                  type: apm
                  method: paypal
                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 BTC (simulated nodes):
              value:
                type: on-ramp
                origin:
                  type: apm
                  method: paypal
                  asset: USD
                destination:
                  type: crypto-address
                  asset: BTC
                  network: bitcoin
                denomination:
                  asset: USD
                  amount: '100.00'
                  target: origin
            On-ramp - 100 USD from an alternative payment method external account to a crypto external account (simulated nodes):
              value:
                type: on-ramp
                origin:
                  type: external-account
                  via: apm
                  method: paypal
                  asset: USD
                destination:
                  type: external-account
                  via: crypto
                  asset: BTC
                  network: bitcoin
                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
            Off-ramp - BTC to 100 USD in a card (simulated nodes):
              value:
                type: off-ramp
                origin:
                  type: crypto-address
                  asset: BTC
                  network: bitcoin
                destination:
                  type: external-account
                  via: card
                  asset: USD
                  method: debit-card
                denomination:
                  asset: USD
                  amount: '100.00'
                  target: destination
  responses:
    create-simulation-response:
      description: Order simulated.
      content:
        application/json:
          schema:
            type: object
            properties:
              simulation:
                $ref: '#/components/schemas/simulation'
            required:
              - simulation
          examples:
            On-ramp Simulation - Card to Crypto External Account:
              value:
                simulation:
                  type: on-ramp
                  origin:
                    asset: USD
                    amount: '100.00'
                    rate: '89253.38317267768950981583'
                    node:
                      type: external-account
                      id: 7dc5c846-5ac2-4853-b67f-005cb83d4017
                      via: card
                      network: visa
                  destination:
                    asset: BTC
                    amount: '0.00106987'
                    rate: '0.00001120405708392375'
                    node:
                      type: external-account
                      id: 5606d0a7-ff4d-ce4f-8675-dea65619122e
                      via: crypto
                      network: bitcoin
                  denomination:
                    asset: USD
                    amount: '100.00'
                    rate: '1.00'
                    target: origin
                  fees:
                    - type: deposit
                      code: credit-card-deposit
                      asset: USD
                      amount: '1.00'
                      percentage: '1'
                    - type: network
                      code: crypto-network
                      asset: USD
                      amount: '3.51'
                  simulatedAt: '2026-10-28T16:26:42.799Z'
            On-ramp Simulation - Card to Crypto External Account (Simulated Nodes):
              value:
                simulation:
                  type: on-ramp
                  origin:
                    asset: USD
                    amount: '100.00'
                    rate: '89253.38317267768950981583'
                    node:
                      type: external-account
                      via: card
                      network: visa
                      method: debit-card
                  destination:
                    asset: BTC
                    amount: '0.00106987'
                    rate: '0.00001120405708392375'
                    node:
                      type: external-account
                      via: crypto
                      network: bitcoin
                  denomination:
                    asset: USD
                    amount: '100.00'
                    rate: '1.00'
                    target: origin
                  fees:
                    - type: deposit
                      code: credit-card-deposit
                      asset: USD
                      amount: '1.00'
                      percentage: '1'
                    - type: network
                      code: crypto-network
                      asset: USD
                      amount: '3.51'
                  simulatedAt: '2026-10-28T16:26:42.799Z'
            On-ramp Simulation - APM to Crypto External Account:
              value:
                simulation:
                  type: on-ramp
                  origin:
                    asset: USD
                    amount: '100.00'
                    rate: '89253.38317267768950981583'
                    node:
                      type: apm
                      method: paypal
                  destination:
                    asset: BTC
                    amount: '0.00106987'
                    rate: '0.00001120405708392375'
                    node:
                      type: external-account
                      id: 5606d0a7-ff4d-ce4f-8675-dea65619122e
                      via: crypto
                      network: bitcoin
                  denomination:
                    asset: USD
                    amount: '100.00'
                    rate: '1.00'
                    target: origin
                  fees:
                    - type: deposit
                      code: alternative-payment-method-deposit
                      asset: USD
                      amount: '1.00'
                      percentage: '1'
                    - type: network
                      code: crypto-network
                      asset: USD
                      amount: '3.51'
                  simulatedAt: '2026-10-28T16:26:42.799Z'
            On-ramp Simulation - APM to Crypto Address (Simulated Nodes):
              value:
                simulation:
                  type: on-ramp
                  origin:
                    asset: USD
                    amount: '100.00'
                    rate: '89253.38317267768950981583'
                    node:
                      type: apm
                      method: paypal
                      asset: USD
                  destination:
                    asset: BTC
                    amount: '0.00106987'
                    rate: '0.00001120405708392375'
                    node:
                      type: crypto-address
                      asset: BTC
                      network: bitcoin
                  denomination:
                    asset: USD
                    amount: '100.00'
                    rate: '1.00'
                    target: origin
                  fees:
                    - type: deposit
                      code: alternative-payment-method-deposit
                      asset: USD
                      amount: '1.00'
                      percentage: '1'
                    - type: network
                      code: crypto-network
                      asset: USD
                      amount: '3.51'
                  simulatedAt: '2026-10-28T16:26:42.799Z'
            On-ramp Simulation - APM External Account to Crypto External Account (Simulated Nodes):
              value:
                simulation:
                  type: on-ramp
                  origin:
                    asset: USD
                    amount: '100.00'
                    rate: '89253.38317267768950981583'
                    node:
                      type: external-account
                      via: apm
                      network: paypal
                      method: paypal
                  destination:
                    asset: BTC
                    amount: '0.00106987'
                    rate: '0.00001120405708392375'
                    node:
                      type: external-account
                      via: crypto
                      network: bitcoin
                  denomination:
                    asset: USD
                    amount: '100.00'
                    rate: '1.00'
                    target: origin
                  fees:
                    - type: deposit
                      code: alternative-payment-method-deposit
                      asset: USD
                      amount: '1.00'
                      percentage: '1'
                    - type: network
                      code: crypto-network
                      asset: USD
                      amount: '3.51'
                  simulatedAt: '2026-10-28T16:26:42.799Z'
            Off-ramp Simulation:
              value:
                simulation:
                  type: off-ramp
                  origin:
                    asset: BTC
                    amount: '0.00113173'
                    rate: '0.00001120405708392375'
                    node:
                      type: crypto-address
                      asset: BTC
                      network: bitcoin
                  destination:
                    asset: USD
                    amount: '100.00'
                    rate: '89253.38317267768950981583'
                    node:
                      type: external-account
                      id: 7dc5c846-5ac2-4853-b67f-005cb83d4017
                      via: card
                      network: visa
                  denomination:
                    asset: USD
                    amount: '100.00'
                    rate: '1.00'
                    target: destination
                  fees:
                    - type: withdrawal
                      code: credit-card-withdrawal
                      asset: BTC
                      amount: '0.00001132'
                      percentage: '1'
                  simulatedAt: '2026-10-28T16:26:42.799Z'
            Off-ramp Simulation (Simulated Nodes):
              value:
                simulation:
                  type: off-ramp
                  origin:
                    asset: BTC
                    amount: '0.00113173'
                    rate: '0.00001120405708392375'
                    node:
                      type: crypto-address
                      asset: BTC
                      network: bitcoin
                  destination:
                    asset: USD
                    amount: '100.00'
                    rate: '89253.38317267768950981583'
                    node:
                      type: external-account
                      via: card
                      method: debit-card
                  denomination:
                    asset: USD
                    amount: '100.00'
                    rate: '1.00'
                    target: destination
                  fees:
                    - type: withdrawal
                      code: credit-card-withdrawal
                      asset: BTC
                      amount: '0.00001132'
                      percentage: '1'
                  simulatedAt: '2026-10-28T16:26:42.799Z'
      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-simulation-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 Origin Node Not Found:
              value:
                code: entity_not_found
                message: A rail for the specified origin node cannot be found
                details:
                  entity: rail
                  context: body
                  property: origin
            Rail For Destination Node Not Found:
              value:
                code: entity_not_found
                message: A rail for the specified destination node cannot be found
                details:
                  entity: rail
                  context: body
                  property: destination
            Rail For Origin Asset And Network Not Found:
              value:
                code: entity_not_found
                message: >-
                  A rail for the specified origin asset and network cannot be
                  found
                details:
                  entity: rail
                  context: body
                  property: origin
            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-simulation-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
            Node Id Without User:
              value:
                code: transaction_node_invalid
                message: The origin node id requires acting on behalf of a user
            Node Asset Missing Without User:
              value:
                code: transaction_node_invalid
                message: >-
                  The origin node requires an asset when not acting on behalf of
                  a user
            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
            Origin External Account Network Not Supported:
              value:
                code: transaction_node_invalid
                message: >-
                  The origin external account does not support the specified
                  network
            Destination External Account Network Not Supported:
              value:
                code: transaction_node_invalid
                message: >-
                  The destination external account does not support the
                  specified network
            Destination Card Not A Debit Card:
              value:
                code: transaction_node_invalid
                message: The destination card must be a debit card
            Origin And Destination Combination Not Allowed:
              value:
                code: transaction_node_invalid
                message: The origin and destination node combination is not allowed
            Asset Pair Not Supported:
              value:
                code: asset_pair_not_supported
                message: Rates are not available for the requested asset pair
            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-simulation-request:
      type: object
      discriminator:
        propertyName: type
        mapping:
          on-ramp: '#/components/schemas/create-simulation-on-ramp-request'
          off-ramp: '#/components/schemas/create-simulation-off-ramp-request'
      oneOf:
        - $ref: '#/components/schemas/create-simulation-on-ramp-request'
          title: On-ramp
        - $ref: '#/components/schemas/create-simulation-off-ramp-request'
          title: Off-ramp
    simulation:
      type: object
      discriminator:
        propertyName: type
        mapping:
          on-ramp: '#/components/schemas/simulation-on-ramp'
          off-ramp: '#/components/schemas/simulation-off-ramp'
      oneOf:
        - $ref: '#/components/schemas/simulation-on-ramp'
          title: On-ramp
        - $ref: '#/components/schemas/simulation-off-ramp'
          title: Off-ramp
    error:
      description: The error information.
      allOf:
        - $ref: '#/components/schemas/feedback'
    create-simulation-on-ramp-request:
      type: object
      properties:
        type:
          description: The type of the simulation.
          type: string
          enum:
            - on-ramp
        origin:
          $ref: '#/components/schemas/simulation-on-ramp-origin-node'
        destination:
          $ref: '#/components/schemas/simulation-on-ramp-destination-node'
        denomination:
          $ref: '#/components/schemas/create-simulation-denomination'
      required:
        - type
        - origin
        - destination
        - denomination
    create-simulation-off-ramp-request:
      type: object
      properties:
        type:
          description: The type of the simulation.
          type: string
          enum:
            - off-ramp
        origin:
          $ref: '#/components/schemas/quote-node-crypto-outpoint'
        destination:
          $ref: '#/components/schemas/simulation-off-ramp-destination-node'
        denomination:
          $ref: '#/components/schemas/create-simulation-denomination'
      required:
        - type
        - origin
        - destination
        - denomination
    simulation-on-ramp:
      allOf:
        - $ref: '#/components/schemas/simulation-base'
        - type: object
          properties:
            type:
              description: The type of the simulation.
              type: string
              enum:
                - on-ramp
            origin:
              description: The origin of the simulation.
              allOf:
                - $ref: '#/components/schemas/simulation-endpoint'
                - type: object
                  properties:
                    node:
                      $ref: >-
                        #/components/schemas/simulation-on-ramp-origin-response-node
                      description: >-
                        The node of the endpoint, as sent in the request.
                        External accounts also include how the operation is made
                        (`via`) and its network, but not their asset, which is
                        the `asset` of the endpoint.
                  required:
                    - node
            destination:
              description: The destination of the simulation.
              allOf:
                - $ref: '#/components/schemas/simulation-endpoint'
                - type: object
                  properties:
                    node:
                      $ref: >-
                        #/components/schemas/simulation-on-ramp-destination-response-node
                      description: >-
                        The node of the endpoint, as sent in the request.
                        External accounts also include how the operation is made
                        (`via`) and its network, but not their asset, which is
                        the `asset` of the endpoint.
                  required:
                    - node
          required:
            - type
            - origin
            - destination
    simulation-off-ramp:
      allOf:
        - $ref: '#/components/schemas/simulation-base'
        - type: object
          properties:
            type:
              description: The type of the simulation.
              type: string
              enum:
                - off-ramp
            origin:
              description: The origin of the simulation.
              allOf:
                - $ref: '#/components/schemas/simulation-endpoint'
                - type: object
                  properties:
                    node:
                      $ref: '#/components/schemas/quote-node-crypto-outpoint'
                      description: The node of the endpoint, as sent in the request.
                  required:
                    - node
            destination:
              description: The destination of the simulation.
              allOf:
                - $ref: '#/components/schemas/simulation-endpoint'
                - type: object
                  properties:
                    node:
                      $ref: >-
                        #/components/schemas/simulation-off-ramp-destination-response-node
                      description: >-
                        The node of the endpoint, as sent in the request.
                        External accounts also include how the operation is made
                        (`via`) and its network, but not their asset, which is
                        the `asset` of the endpoint.
                  required:
                    - node
          required:
            - type
            - 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
    simulation-on-ramp-origin-node:
      type: object
      discriminator:
        propertyName: type
        mapping:
          external-account: >-
            #/components/schemas/simulation-on-ramp-origin-node-external-account-any
          apm: '#/components/schemas/simulation-node-apm-origin-any'
      oneOf:
        - $ref: >-
            #/components/schemas/simulation-on-ramp-origin-node-external-account-any
        - $ref: '#/components/schemas/simulation-node-apm-origin-any'
      required:
        - type
    simulation-on-ramp-destination-node:
      type: object
      discriminator:
        propertyName: type
        mapping:
          external-account: >-
            #/components/schemas/simulation-on-ramp-destination-node-external-account-any
          crypto-address: '#/components/schemas/simulation-node-crypto-address'
      oneOf:
        - $ref: >-
            #/components/schemas/simulation-on-ramp-destination-node-external-account-any
        - $ref: '#/components/schemas/simulation-node-crypto-address'
      required:
        - type
    create-simulation-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
    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
    simulation-off-ramp-destination-node:
      type: object
      discriminator:
        propertyName: type
        mapping:
          external-account: >-
            #/components/schemas/simulation-off-ramp-destination-node-external-account-any
      oneOf:
        - $ref: >-
            #/components/schemas/simulation-off-ramp-destination-node-external-account-any
      required:
        - type
    simulation-base:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/order-type'
        origin:
          type: object
        destination:
          type: object
        denomination:
          $ref: '#/components/schemas/order-denomination'
        fees:
          $ref: '#/components/schemas/order-fees'
        simulatedAt:
          description: The time at which the rates of the simulation were quoted.
          type: string
          format: date-time
      required:
        - type
        - origin
        - destination
        - denomination
        - fees
        - simulatedAt
    simulation-endpoint:
      type: object
      properties:
        asset:
          description: The asset of the endpoint.
          type: string
        amount:
          description: The estimated amount of the endpoint.
          type: string
        rate:
          description: >-
            The estimated rate of the endpoint against its counter-part (origin
            to destination and vice-versa).
          type: string
      required:
        - asset
        - amount
        - rate
    simulation-on-ramp-origin-response-node:
      oneOf:
        - $ref: '#/components/schemas/simulation-node-external-account-response'
          title: External account
        - $ref: '#/components/schemas/simulation-node-apm-origin'
          title: APM
        - $ref: '#/components/schemas/simulation-node-apm-origin-simulated'
          title: APM (simulated)
    simulation-on-ramp-destination-response-node:
      oneOf:
        - $ref: '#/components/schemas/simulation-node-external-account-response'
          title: External account
        - $ref: '#/components/schemas/simulation-node-crypto-address'
          title: Crypto address
    simulation-off-ramp-destination-response-node:
      oneOf:
        - $ref: '#/components/schemas/simulation-node-external-account-response'
          title: External account
    simulation-on-ramp-origin-node-external-account-any:
      type: object
      properties:
        type:
          enum:
            - external-account
      oneOf:
        - $ref: '#/components/schemas/simulation-node-external-account'
        - $ref: >-
            #/components/schemas/simulation-on-ramp-origin-node-external-account-simulated
    simulation-node-apm-origin-any:
      type: object
      properties:
        type:
          enum:
            - apm
      oneOf:
        - $ref: '#/components/schemas/simulation-node-apm-origin'
        - $ref: '#/components/schemas/simulation-node-apm-origin-simulated'
    simulation-on-ramp-destination-node-external-account-any:
      type: object
      properties:
        type:
          enum:
            - external-account
      oneOf:
        - $ref: '#/components/schemas/simulation-node-external-account'
        - $ref: >-
            #/components/schemas/simulation-node-external-account-crypto-simulated
    simulation-node-crypto-address:
      title: Crypto address
      description: Any address of the network.
      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 crypto network.
              type: string
              maxLength: 50
      required:
        - type
        - asset
        - network
    non-zero-decimal-amount:
      type: string
      pattern: ^(?!0+(\.0+)?$)\d+(\.\d+)?$
    string-no-edge-spaces:
      type: string
      pattern: ^\S.*\S$|^\S$
    simulation-off-ramp-destination-node-external-account-any:
      type: object
      properties:
        type:
          enum:
            - external-account
      oneOf:
        - $ref: '#/components/schemas/simulation-node-external-account'
        - $ref: >-
            #/components/schemas/simulation-node-external-account-card-destination-simulated
    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:
      description: The denomination of the order.
      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:
      description: The fees of the order.
      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
    simulation-node-external-account-response:
      type: object
      additionalProperties: false
      properties:
        type:
          description: The type of the node.
          type: string
          enum:
            - external-account
        id:
          description: The external account id, when provided in the request.
          type: string
          format: uuid
        via:
          description: How the operation is made, the type of external account.
          type: string
          enum:
            - apm
            - card
            - crypto
        network:
          description: The network used for the operation.
          type: string
        method:
          description: >-
            The alternative payment method, when `via` is `apm`, or the card
            method sent in the request, when `via` is `card`.
          type: string
      required:
        - type
        - via
    simulation-node-apm-origin:
      title: APM
      type: object
      additionalProperties: false
      properties:
        type:
          description: The type of the node.
          type: string
          enum:
            - apm
        method:
          description: >-
            The alternative payment method to be used in the operation. Its
            asset is the currency of the payment method in the user's country.
          enum:
            - apple-pay
            - google-pay
            - paypal
            - venmo
      required:
        - type
        - method
    simulation-node-apm-origin-simulated:
      title: APM (simulated)
      type: object
      additionalProperties: false
      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
        asset:
          $ref: '#/components/schemas/simulation-node-apm-asset'
      required:
        - type
        - method
        - asset
    simulation-node-external-account:
      title: External account
      allOf:
        - $ref: '#/components/schemas/quote-node-external-account'
        - type: object
          properties:
            network:
              allOf:
                - $ref: '#/components/schemas/string-no-edge-spaces'
                - description: >-
                    The network used for the operation with the external
                    account.
                  type: string
                  maxLength: 50
      unevaluatedProperties: false
    simulation-on-ramp-origin-node-external-account-simulated:
      type: object
      discriminator:
        propertyName: via
        mapping:
          card: >-
            #/components/schemas/simulation-node-external-account-card-origin-simulated
          apm: >-
            #/components/schemas/simulation-node-external-account-apm-origin-simulated
      oneOf:
        - $ref: >-
            #/components/schemas/simulation-node-external-account-card-origin-simulated
        - $ref: >-
            #/components/schemas/simulation-node-external-account-apm-origin-simulated
      required:
        - via
    simulation-node-external-account-crypto-simulated:
      title: Crypto external account (simulated)
      type: object
      additionalProperties: false
      properties:
        type:
          description: The type of the node.
          type: string
          enum:
            - external-account
        via:
          description: How the operation is made, the type of external account.
          type: string
          enum:
            - crypto
        asset:
          allOf:
            - $ref: '#/components/schemas/string-no-edge-spaces'
            - description: >-
                The asset of the crypto address. Can also be used when acting on
                behalf of a user.
              type: string
              maxLength: 20
        network:
          allOf:
            - $ref: '#/components/schemas/string-no-edge-spaces'
            - description: The crypto network.
              type: string
              maxLength: 50
      required:
        - type
        - via
        - asset
        - network
    simulation-node-external-account-card-destination-simulated:
      title: Card external account (simulated)
      type: object
      additionalProperties: false
      properties:
        type:
          description: The type of the node.
          type: string
          enum:
            - external-account
        via:
          description: How the operation is made, the type of external account.
          type: string
          enum:
            - card
        asset:
          $ref: '#/components/schemas/simulation-node-card-asset'
        network:
          $ref: '#/components/schemas/simulation-node-card-network'
        method:
          description: >-
            The card method. Withdrawals can only be made to debit cards. The
            organization must have a card rail on it for the asset, whatever its
            features.
          type: string
          enum:
            - debit-card
      required:
        - type
        - via
        - asset
        - method
    simulation-node-apm-asset:
      allOf:
        - $ref: '#/components/schemas/string-no-edge-spaces'
        - description: >-
            The asset of the payment method. Can also be used when acting on
            behalf of a user.
          type: string
          maxLength: 20
    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
    simulation-node-external-account-card-origin-simulated:
      title: Card external account (simulated)
      type: object
      additionalProperties: false
      properties:
        type:
          description: The type of the node.
          type: string
          enum:
            - external-account
        via:
          description: How the operation is made, the type of external account.
          type: string
          enum:
            - card
        asset:
          $ref: '#/components/schemas/simulation-node-card-asset'
        network:
          $ref: '#/components/schemas/simulation-node-card-network'
        method:
          description: >-
            The card method, which sets the fees of the card. The organization
            must have a card rail on it for the asset, whatever its features.
          type: string
          enum:
            - credit-card
            - debit-card
      required:
        - type
        - via
        - asset
        - method
    simulation-node-external-account-apm-origin-simulated:
      title: APM external account (simulated)
      type: object
      additionalProperties: false
      properties:
        type:
          description: The type of the node.
          type: string
          enum:
            - external-account
        via:
          description: How the operation is made, the type of external account.
          type: string
          enum:
            - apm
        method:
          description: >-
            The alternative payment method of the external account. The
            organization must have an APM rail on it for the asset, whatever its
            features.
          type: string
          enum:
            - apple-pay
            - google-pay
            - paypal
            - venmo
        asset:
          $ref: '#/components/schemas/simulation-node-apm-asset'
      required:
        - type
        - via
        - method
        - asset
    simulation-node-card-asset:
      allOf:
        - $ref: '#/components/schemas/string-no-edge-spaces'
        - description: >-
            The asset of the external account. Can also be used when acting on
            behalf of a user.
          type: string
          maxLength: 20
    simulation-node-card-network:
      allOf:
        - $ref: '#/components/schemas/string-no-edge-spaces'
        - description: >-
            The card network (e.g. `visa`). It does not change the estimate and
            is returned in the response, but the organization must have a card
            rail on it, whatever its features.
          type: string
          maxLength: 50
  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.
            on-off-ramp.orders.quotes:simulate: Grants access to simulate order quotes.

````