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

# Execute on-demand conversion

> Executes an on-demand conversion for the selected account. The service calculates the missing amount and processes the conversion in the background.

An `Idempotency-Key` identifies one execution request. Reusing it returns a conflict error and does not execute a new conversion.



## OpenAPI

````yaml https://d2588n1sy4m36o.cloudfront.net/uat/merged/openapi.json post /v1/accounts/{account_id}/on-demand-conversions
openapi: 3.1.0
info:
  title: PWS Public API
  version: '1'
  description: >-
    Integrate with Payward Services to onboard users, manage accounts and funds,
    trade assets, and receive event notifications.
  contact:
    name: Payward Services
servers:
  - url: https://api.sandbox.services.payward.com
security: []
tags:
  - name: Assets
    description: List the assets PWS is willing to swap.
    x-displayName: Assets
  - name: Conversions
    description: >-
      Rule-driven and on-demand fiat ↔ crypto value movement, including
      conversion rules and deposits.
    x-displayName: Conversions
  - name: Auto Earn
    description: >-
      Manage Auto Earn preferences and retrieve allocation and reward
      information.
    x-displayName: Auto Earn
  - name: Bonded Earn
    description: >-
      Allocate funds to and deallocate funds from bonded earn strategies, review
      allocations, and track request status.
    x-displayName: Bonded Earn
  - name: Funding
    description: >-
      Discover deposit and withdrawal options, manage deposit addresses, and
      move funds between accounts.
    x-displayName: Funding
  - name: Derivative transfers
    description: >-
      Move funds between an account's spot balance and the same owner's futures
      balance.
    x-displayName: Derivative transfers
  - name: Portfolio
    description: 'Inspect a customer''s portfolio: balances, valuations, and transactions.'
    x-displayName: Portfolio
  - name: Ramp
    description: >-
      Support Ramp flows with discovery, quotes, limits, and hosted checkout
      experiences.
    x-displayName: Ramp
  - name: Reports
    description: Settlement and reconciliation reports for the partner.
    x-displayName: Reports
  - name: Swaps
    description: Account-funded quotes that lock a price until they expire or are executed.
    x-displayName: Swaps
  - name: Onchain quotes
    description: Wallet-funded quotes that return the data needed to settle onchain.
    x-displayName: Onchain quotes
  - name: Price trigger swaps
    description: Swaps that wait for a target price before submitting a trade.
    x-displayName: Price trigger swaps
  - name: Travel Rule verifications
    description: Travel Rule address ownership verification flows.
    x-displayName: Travel Rule verifications
  - name: Users
    description: >-
      User onboarding and status flows that the partner manages.


      - **Create User** provisions an account-owned user from an external
      reference and optional email.

      - **Get User** retrieves the user's profile, verification status, and
      required actions.


      Use the returned user `id` for calls that require the user's identifier.
    x-displayName: Users
  - name: Verifications
    description: Identity verification (KYC) submission and status for end users.
    x-displayName: Verifications
  - name: Webhooks
    description: >-
      Register HTTPS destinations to receive event deliveries, rotate signing
      secrets, and inspect, update, or delete existing subscriptions. Each
      subscription is owned by the authenticated partner; deliveries are signed
      with HMAC-SHA256 and retried on transient failures.
    x-displayName: Webhooks
paths:
  /v1/accounts/{account_id}/on-demand-conversions:
    post:
      tags:
        - Conversions
      summary: Execute on-demand conversion
      description: >-
        Executes an on-demand conversion for the selected account. The service
        calculates the missing amount and processes the conversion in the
        background.


        An `Idempotency-Key` identifies one execution request. Reusing it
        returns a conflict error and does not execute a new conversion.
      operationId: executeOnDemandConversion
      parameters:
        - $ref: '#/components/parameters/AccountId'
        - $ref: '#/components/parameters/RequiredIdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - from
                - to
              properties:
                from:
                  $ref: '#/components/schemas/Conversions_OnDemandConversionSource'
                to:
                  $ref: >-
                    #/components/schemas/Conversions_OnDemandConversionDestination
              oneOf:
                - title: Source amount
                  description: >-
                    Provide `from.amount` to specify how much to debit. Omit
                    `to.amount`; the service calculates the amount delivered to
                    the destination.
                  type: object
                  required:
                    - from
                  properties:
                    from:
                      type: object
                      required:
                        - amount
                      properties:
                        amount:
                          type: string
                          minLength: 1
                          maxLength: 64
                    to:
                      type: object
                      not:
                        required:
                          - amount
                - title: Destination amount
                  description: >-
                    Provide `to.amount` to specify how much to deliver. Omit
                    `from.amount`; the service calculates the amount debited
                    from the source.
                  type: object
                  required:
                    - to
                  properties:
                    from:
                      type: object
                      not:
                        required:
                          - amount
                    to:
                      type: object
                      required:
                        - amount
                      properties:
                        amount:
                          type: string
                          minLength: 1
                          maxLength: 64
            examples:
              execute-on-demand-conversion:
                summary: Execute a balance-to-wallet conversion
                value:
                  from:
                    symbol: USD
                    type: balance
                    amount: '1000.00'
                  to:
                    symbol: ETH
                    type: wallet
                    wallet:
                      via: ethereum
                      address: '0xabcdef1234567890abcdef1234567890abcdef12'
                      memo: destination-memo
                      tag: destination-tag
              execute-on-demand-ach-pay-in:
                summary: Execute an ACH-funded conversion to a wallet
                value:
                  from:
                    symbol: USD
                    type: bank
                    amount: '100.00'
                    bank_account:
                      via: ach
                      account_link_id: AL7H1R6R6B6H1R6R6B6H1R6R6B
                  to:
                    symbol: USDC
                    type: wallet
                    wallet:
                      via: ethereum
                      address: '0xabcdef1234567890abcdef1234567890abcdef12'
              execute-on-demand-rfp-pay-in:
                summary: Execute an RfP-funded conversion to a wallet
                value:
                  from:
                    symbol: USD
                    type: bank
                    amount: '100.00'
                    bank_account:
                      via: rfp
                      account_link_id: AL7H1R6R6B6H1R6R6B6H1R6R6B
                  to:
                    symbol: USDC
                    type: wallet
                    wallet:
                      via: ethereum
                      address: '0xabcdef1234567890abcdef1234567890abcdef12'
      responses:
        '201':
          description: On-demand conversion created.
          headers:
            X-Trace-Id:
              $ref: '#/components/headers/TraceId'
            Strict-Transport-Security:
              $ref: '#/components/headers/StrictTransportSecurity'
            Cache-Control:
              $ref: '#/components/headers/CacheControl'
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/Conversions_OnDemandConversion'
              examples:
                execute-on-demand-conversion-ok:
                  summary: >-
                    ExecuteOnDemandConversion returns the initial conversion
                    state
                  value:
                    data:
                      id: 00000000-0000-0000-0000-000000000009
                      status: converting
                      from:
                        symbol: USD
                        amount: '1000.00'
                        type: balance
                        status: pending
                      to:
                        symbol: ETH
                        amount: '0.40000000'
                        type: wallet
                        status: pending
                        wallet:
                          via: ethereum
                          address: '0xabcdef1234567890abcdef1234567890abcdef12'
                          memo: destination-memo
                          tag: destination-tag
                      rate:
                        base:
                          symbol: USD
                        quote:
                          symbol: ETH
                        price: '0.0004'
                      fees:
                        from:
                          symbol: EUR
                          amount: '0.50'
                        trade:
                          symbol: EUR
                          amount: '0.25'
                        to:
                          symbol: BTC
                          amount: '0.00001'
                      created_at: '2026-07-31T00:00:00Z'
                      updated_at: '2026-07-31T00:00:00Z'
        '400':
          $ref: '#/components/responses/ConversionsBadRequestResponse'
          description: >-
            The request contains an invalid amount, unsupported asset or
            destination, invalid wallet address or network, an amount below the
            applicable minimum, a target amount that cannot be fulfilled, an
            unsupported bank rail, a rail and currency mismatch, or missing bank
            destination fields.
        '401':
          $ref: '#/components/responses/ConversionsUnauthenticatedResponse'
          description: Authentication required.
        '403':
          $ref: '#/components/responses/ConversionsForbiddenResponse'
          description: Forbidden.
        '409':
          $ref: '#/components/responses/ConversionsOnDemandConflictResponse'
          description: >-
            The conversion cannot be created with the supplied account state or
            idempotency key.
        '429':
          $ref: '#/components/responses/ConversionsResourceExhaustedResponse'
          description: Rate limit exceeded.
        '500':
          $ref: '#/components/responses/ConversionsInternalResponse'
          description: Internal server error.
        '503':
          $ref: '#/components/responses/ConversionsUnavailableResponse'
          description: A required dependency is unavailable.
        '504':
          $ref: '#/components/responses/ConversionsDeadlineExceededResponse'
          description: Deadline exceeded.
      security:
        - ApiKey: []
          ApiSign: []
          ApiNonce: []
components:
  parameters:
    AccountId:
      name: account_id
      in: path
      required: true
      example: WVSD33HRMGSZUBM7
      schema:
        $ref: '#/components/schemas/AccountId'
    RequiredIdempotencyKey:
      name: Idempotency-Key
      in: header
      required: true
      schema:
        $ref: '#/components/schemas/IdempotencyKey'
      example: 550e8400-e29b-41d4-a716-446655440000
  schemas:
    Conversions_OnDemandConversionSource:
      description: Source side of an on-demand conversion.
      discriminator:
        propertyName: type
        mapping:
          balance: '#/components/schemas/Conversions_OnDemandConversionBalanceSource'
          bank: '#/components/schemas/Conversions_OnDemandConversionBankSource'
      oneOf:
        - $ref: '#/components/schemas/Conversions_OnDemandConversionBalanceSource'
          title: OnDemandConversionBalanceSource
        - $ref: '#/components/schemas/Conversions_OnDemandConversionBankSource'
          title: OnDemandConversionBankSource
    Conversions_OnDemandConversionDestination:
      description: Destination side of an on-demand conversion.
      discriminator:
        propertyName: type
        mapping:
          wallet: '#/components/schemas/Conversions_OnDemandConversionWalletDestination'
          bank: '#/components/schemas/Conversions_OnDemandConversionBankDestination'
      oneOf:
        - $ref: '#/components/schemas/Conversions_OnDemandConversionWalletDestination'
          title: OnDemandConversionWalletDestination
        - $ref: '#/components/schemas/Conversions_OnDemandConversionBankDestination'
          title: OnDemandConversionBankDestination
    Conversions_OnDemandConversion:
      description: >-
        Details of an on-demand conversion. It includes the amount debited from
        the source, the amount delivered to the destination, the exchange rate,
        destination details, and fees. Transaction references are included when
        available. A linked bank source remains pending while funding is in
        progress. An RfP conversion includes `next_action` while its payer must
        authorize the payment. A wallet destination may include a saved memo or
        tag; when present, those fields are returned in every response.
      type: object
      required:
        - id
        - status
        - from
        - to
        - rate
        - fees
        - created_at
        - updated_at
      properties:
        id:
          description: Unique identifier for this on-demand conversion.
          type: string
          format: uuid
        status:
          $ref: '#/components/schemas/Conversions_OnDemandConversionStatus'
        from:
          $ref: '#/components/schemas/Conversions_OnDemandConversionEndpoint'
        to:
          $ref: '#/components/schemas/Conversions_OnDemandConversionEndpoint'
        rate:
          $ref: '#/components/schemas/Conversions_OnDemandConversionRate'
        fees:
          $ref: '#/components/schemas/Conversions_OnDemandConversionFees'
        transaction_references:
          $ref: >-
            #/components/schemas/Conversions_OnDemandConversionTransactionReferences
        created_at:
          $ref: '#/components/schemas/DateTime'
          description: Time at which the on-demand conversion was created.
        updated_at:
          $ref: '#/components/schemas/DateTime'
          description: Time at which the on-demand conversion was last updated.
        next_action:
          $ref: '#/components/schemas/Conversions_OnDemandConversionNextAction'
        expires_at:
          $ref: '#/components/schemas/DateTime'
          description: >-
            Time at which the locked price and fees expire. Returned when
            `status` is `prepared` or `canceled`.
        cancellation_reason:
          $ref: >-
            #/components/schemas/Conversions_OnDemandConversionCancellationReason
          description: >-
            Why the on-demand conversion was canceled. Returned when `status` is
            `canceled`.
    AccountId:
      description: Globally unique public identifier for an account.
      type: string
      minLength: 14
      maxLength: 42
    IdempotencyKey:
      description: >-
        Client-generated canonical UUIDv4 that uniquely identifies a request for
        safe retries.
      type: string
      format: uuid
      pattern: >-
        ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$
      example: 550e8400-e29b-41d4-a716-446655440000
    Conversions_OnDemandConversionBalanceSource:
      description: Balance source for an on-demand conversion.
      type: object
      additionalProperties: false
      required:
        - symbol
        - type
      properties:
        symbol:
          $ref: '#/components/schemas/AssetSymbol'
          description: Asset symbol debited from the selected account balance.
        type:
          title: OnDemandConversionBalanceType
          description: Type of source. Always `balance`.
          type: string
          enum:
            - balance
        amount:
          description: >-
            Amount to debit from the selected account balance. Provide this or
            `to.amount`, but not both.
          type: string
          minLength: 1
          maxLength: 64
    Conversions_OnDemandConversionBankSource:
      description: Linked bank account source for an on-demand conversion (bank pay-in).
      type: object
      additionalProperties: false
      required:
        - symbol
        - type
        - bank_account
      properties:
        symbol:
          $ref: '#/components/schemas/AssetSymbol'
          description: Funding currency symbol.
        type:
          title: OnDemandConversionBankSourceType
          description: Type of source. Always `bank`.
          type: string
          enum:
            - bank
        amount:
          description: >-
            Amount fixed by the caller. Bank-funded conversions fix the from
            side.
          type: string
          minLength: 1
          maxLength: 64
        bank_account:
          $ref: '#/components/schemas/Conversions_OnDemandConversionBankAccountSource'
    Conversions_OnDemandConversionWalletDestination:
      description: Crypto wallet destination for an on-demand conversion.
      type: object
      additionalProperties: false
      required:
        - symbol
        - type
        - wallet
      properties:
        symbol:
          $ref: '#/components/schemas/AssetSymbol'
          description: Asset symbol delivered to the wallet.
        type:
          title: OnDemandConversionWalletDestinationType
          description: Type of destination. Always `wallet`.
          type: string
          enum:
            - wallet
        wallet:
          $ref: '#/components/schemas/Conversions_OnDemandConversionWalletTarget'
        amount:
          description: >-
            Amount to deliver to the wallet. Provide this or `from.amount`, but
            not both.
          type: string
          minLength: 1
          maxLength: 64
    Conversions_OnDemandConversionBankDestination:
      description: Bank account destination for an on-demand conversion.
      type: object
      additionalProperties: false
      required:
        - symbol
        - type
        - bank_account
      properties:
        symbol:
          $ref: '#/components/schemas/AssetSymbol'
          description: Fiat asset symbol delivered to the bank account.
        type:
          title: OnDemandConversionBankDestinationType
          description: Type of destination. Always `bank`.
          type: string
          enum:
            - bank
        bank_account:
          $ref: '#/components/schemas/Conversions_OnDemandConversionBankAccountTarget'
        amount:
          description: >-
            Amount to deliver to the bank account. Provide this or
            `from.amount`, but not both.
          type: string
          minLength: 1
          maxLength: 64
    Conversions_OnDemandConversionStatus:
      description: >-
        Current lifecycle status of an on-demand conversion. `prepared` means
        the price and fees are locked and the conversion waits to be executed by
        the customer. `canceled` means the conversion was canceled before
        execution. `converting` means the conversion is in progress, including
        while an RfP conversion is waiting for payer authorization. `settling`
        means the converted asset is being delivered to the destination.
        `completed` means the conversion finished successfully. `failed` means
        the conversion could not be completed.
      type: string
      enum:
        - converting
        - settling
        - failed
        - completed
        - prepared
        - canceled
    Conversions_OnDemandConversionEndpoint:
      description: Amount and details returned for one side of an on-demand conversion.
      discriminator:
        propertyName: type
        mapping:
          balance: '#/components/schemas/Conversions_OnDemandConversionBalanceEndpoint'
          wallet: '#/components/schemas/Conversions_OnDemandConversionWalletEndpoint'
          bank: '#/components/schemas/Conversions_OnDemandConversionBankEndpoint'
      oneOf:
        - $ref: '#/components/schemas/Conversions_OnDemandConversionBalanceEndpoint'
          title: OnDemandConversionBalanceEndpoint
        - $ref: '#/components/schemas/Conversions_OnDemandConversionWalletEndpoint'
          title: OnDemandConversionWalletEndpoint
        - $ref: '#/components/schemas/Conversions_OnDemandConversionBankEndpoint'
          title: OnDemandConversionBankEndpoint
    Conversions_OnDemandConversionRate:
      description: Exchange rate applied to an on-demand conversion.
      type: object
      required:
        - base
        - quote
        - price
      properties:
        base:
          $ref: '#/components/schemas/Conversions_OnDemandConversionRateAsset'
          description: Base asset of the rate pair.
        quote:
          $ref: '#/components/schemas/Conversions_OnDemandConversionRateAsset'
          description: Quote asset of the rate pair.
        price:
          $ref: '#/components/schemas/Price'
          description: Price of one unit of the base asset denominated in the quote asset.
    Conversions_OnDemandConversionFees:
      description: Breakdown of all fees charged for an on-demand conversion.
      type: object
      additionalProperties: false
      required:
        - from
        - trade
        - to
      properties:
        to:
          $ref: '#/components/schemas/Conversions_OnDemandConversionFee'
          description: >-
            Withdrawal or payout fee charged on the destination side of the
            conversion.
        from:
          $ref: '#/components/schemas/Conversions_OnDemandConversionFee'
          description: Funding or deposit fee charged on the source side of the conversion.
        trade:
          $ref: '#/components/schemas/Conversions_OnDemandConversionFee'
          description: Platform conversion fee charged by the trading leg.
    Conversions_OnDemandConversionTransactionReferences:
      description: Transaction references produced by the conversion, when available.
      type: object
      additionalProperties: false
      properties:
        to:
          $ref: >-
            #/components/schemas/Conversions_OnDemandConversionTransactionReference
          description: >-
            Transaction reference for the destination side of the conversion,
            when available.
    DateTime:
      description: RFC 3339 timestamp.
      type: string
      format: date-time
    Conversions_OnDemandConversionNextAction:
      description: >-
        Present while a payer must authorize an RfP payment. Omitted after the
        payment is authorized, canceled, expired, or failed.
      type: object
      additionalProperties: false
      required:
        - type
        - widget_url
        - expires_at
      properties:
        type:
          title: OnDemandConversionNextActionType
          description: Action the payer must complete. Always `hosted_payment`.
          type: string
          enum:
            - hosted_payment
        widget_url:
          description: >-
            Kraken-hosted payment widget URL. It is not a Plaid URL and contains
            no Plaid Link token.
          type: string
          format: uri
          minLength: 1
          maxLength: 2048
        expires_at:
          $ref: '#/components/schemas/DateTime'
          description: >-
            Time when the payer can no longer authorize this payment. This is
            independent of the conversion quote expiry.
    Conversions_OnDemandConversionCancellationReason:
      description: >-
        Why the on-demand conversion was canceled. New reasons can be added, so
        accept an unknown reason.

        - `expired`: `expires_at` passed before execution.

        - `market_moved`: the market moved too far from the locked price.

        - `price_unavailable`: the locked price could no longer be honored.
      type: string
      enum:
        - expired
        - market_moved
        - price_unavailable
    BadRequestError:
      title: Bad Request
      description: Request validation failed or the request could not be processed.
      oneOf:
        - title: Bad Request
          allOf:
            - $ref: '#/components/schemas/PwsValidationErrorEnvelope'
            - type: object
              required:
                - error
              properties:
                error:
                  allOf:
                    - $ref: '#/components/schemas/PwsValidationError'
                    - type: object
                      required:
                        - status
                        - code
                      properties:
                        status:
                          type: integer
                          format: int32
                          const: 400
                        code:
                          type: string
                          enum:
                            - bad_request
        - title: Gateway
          description: >-
            Gateway-level validation failure returned before the request reaches
            the service.
          allOf:
            - $ref: '#/components/schemas/PwsValidationErrorEnvelope'
            - type: object
              required:
                - error
              properties:
                error:
                  allOf:
                    - $ref: '#/components/schemas/PwsValidationError'
                    - type: object
                      required:
                        - status
                        - code
                      properties:
                        type:
                          type: string
                          const: service_error
                        status:
                          type: integer
                          format: int32
                          const: 400
                        code:
                          type: string
                          const: gateway
    UnauthenticatedError:
      title: Unauthenticated
      description: Authentication credentials are missing, invalid, or not accepted.
      oneOf:
        - title: Unauthenticated
          allOf:
            - $ref: '#/components/schemas/PwsGeneralErrorEnvelope'
            - type: object
              required:
                - error
              properties:
                error:
                  allOf:
                    - $ref: '#/components/schemas/PwsGeneralError'
                    - type: object
                      required:
                        - status
                        - code
                      properties:
                        status:
                          type: integer
                          format: int32
                          const: 401
                        code:
                          type: string
                          enum:
                            - unauthenticated
        - title: Gateway
          description: Authentication failure returned by the API gateway.
          allOf:
            - $ref: '#/components/schemas/PwsGeneralErrorEnvelope'
            - type: object
              required:
                - error
              properties:
                error:
                  allOf:
                    - $ref: '#/components/schemas/PwsGeneralError'
                    - type: object
                      required:
                        - status
                        - code
                      properties:
                        type:
                          type: string
                          const: service_error
                        status:
                          type: integer
                          format: int32
                          const: 401
                        code:
                          type: string
                          const: gateway
    ForbiddenError:
      title: Forbidden
      description: The caller is not allowed to perform this operation.
      oneOf:
        - title: Forbidden
          allOf:
            - $ref: '#/components/schemas/PwsGeneralErrorEnvelope'
            - type: object
              required:
                - error
              properties:
                error:
                  allOf:
                    - $ref: '#/components/schemas/PwsGeneralError'
                    - type: object
                      required:
                        - status
                        - code
                      properties:
                        status:
                          type: integer
                          format: int32
                          const: 403
                        code:
                          type: string
                          enum:
                            - forbidden
        - title: Gateway
          description: Authorization failure returned by the API gateway.
          allOf:
            - $ref: '#/components/schemas/PwsGeneralErrorEnvelope'
            - type: object
              required:
                - error
              properties:
                error:
                  allOf:
                    - $ref: '#/components/schemas/PwsGeneralError'
                    - type: object
                      required:
                        - status
                        - code
                      properties:
                        type:
                          type: string
                          const: service_error
                        status:
                          type: integer
                          format: int32
                          const: 403
                        code:
                          type: string
                          const: gateway
    Conversions_OnDemandConversionIdempotencyKeyAlreadyUsedError:
      description: >-
        The idempotency key was already used to create another on-demand
        conversion.
      allOf:
        - $ref: '#/components/schemas/PwsGeneralErrorEnvelope'
        - type: object
          required:
            - error
            - conversion_id
          properties:
            conversion_id:
              description: >-
                UUID of the conversion previously created with this idempotency
                key.
              type: string
              format: uuid
            error:
              allOf:
                - $ref: '#/components/schemas/PwsGeneralError'
                - type: object
                  required:
                    - status
                    - code
                  properties:
                    status:
                      type: integer
                      const: 409
                    code:
                      type: string
                      enum:
                        - idempotency_key_already_used
    Conversions_ConversionInsufficientFundsErrorResponse:
      description: >-
        The account does not have enough available funds for the requested
        conversion.
      allOf:
        - $ref: '#/components/schemas/PwsGeneralErrorEnvelope'
        - type: object
          required:
            - error
          properties:
            error:
              allOf:
                - $ref: '#/components/schemas/PwsGeneralError'
                - type: object
                  required:
                    - status
                    - code
                  properties:
                    status:
                      type: integer
                      format: int32
                      const: 409
                    code:
                      type: string
                      enum:
                        - conversion_insufficient_funds
    ResourceExhaustedError:
      description: The request was rate limited or a resource quota was exhausted.
      allOf:
        - $ref: '#/components/schemas/PwsGeneralErrorEnvelope'
        - type: object
          required:
            - error
          properties:
            error:
              allOf:
                - $ref: '#/components/schemas/PwsGeneralError'
                - type: object
                  required:
                    - status
                    - code
                  properties:
                    status:
                      type: integer
                      format: int32
                      const: 429
                    code:
                      type: string
                      enum:
                        - resource_exhausted
    InternalError:
      description: An unexpected server-side error occurred.
      allOf:
        - $ref: '#/components/schemas/PwsGeneralErrorEnvelope'
        - type: object
          required:
            - error
          properties:
            error:
              allOf:
                - $ref: '#/components/schemas/PwsGeneralError'
                - type: object
                  required:
                    - status
                    - code
                  properties:
                    status:
                      type: integer
                      format: int32
                      const: 500
                    code:
                      type: string
                      enum:
                        - internal
    UnavailableError:
      description: The service is temporarily unavailable.
      allOf:
        - $ref: '#/components/schemas/PwsGeneralErrorEnvelope'
        - type: object
          required:
            - error
          properties:
            error:
              allOf:
                - $ref: '#/components/schemas/PwsGeneralError'
                - type: object
                  required:
                    - status
                    - code
                  properties:
                    status:
                      type: integer
                      format: int32
                      const: 503
                    code:
                      type: string
                      enum:
                        - unavailable
    DeadlineExceededError:
      description: The request deadline was exceeded before a response could be produced.
      allOf:
        - $ref: '#/components/schemas/PwsGeneralErrorEnvelope'
        - type: object
          required:
            - error
          properties:
            error:
              allOf:
                - $ref: '#/components/schemas/PwsGeneralError'
                - type: object
                  required:
                    - status
                    - code
                  properties:
                    status:
                      type: integer
                      format: int32
                      const: 504
                    code:
                      type: string
                      enum:
                        - deadline_exceeded
    AssetSymbol:
      description: Symbol identifying an asset within its asset category.
      type: string
      minLength: 1
      maxLength: 16
    Conversions_OnDemandConversionBankAccountSource:
      description: Linked bank account that funds an on-demand conversion.
      discriminator:
        propertyName: via
        mapping:
          ach: '#/components/schemas/Conversions_OnDemandConversionAchBankAccount'
          rfp: '#/components/schemas/Conversions_OnDemandConversionRfpBankAccount'
      oneOf:
        - $ref: '#/components/schemas/Conversions_OnDemandConversionAchBankAccount'
          title: OnDemandConversionAchBankAccount
        - $ref: '#/components/schemas/Conversions_OnDemandConversionRfpBankAccount'
          title: OnDemandConversionRfpBankAccount
    Conversions_OnDemandConversionWalletTarget:
      description: Destination wallet details for an on-demand conversion.
      type: object
      additionalProperties: false
      required:
        - via
        - address
      properties:
        via:
          description: Network name from the List deposit methods `network` field.
          type: string
          minLength: 1
          maxLength: 32
        address:
          description: Destination wallet address on the selected network.
          type: string
          minLength: 1
          maxLength: 256
        memo:
          description: Optional memo required by some destination networks.
          type: string
          minLength: 1
          maxLength: 64
        tag:
          description: Optional tag required by some destination networks.
          type: string
          minLength: 1
          maxLength: 64
    Conversions_OnDemandConversionBankAccountTarget:
      description: >-
        Bank payout details. Each rail supports a specific payout currency and
        requires specific bank details: ACH and RTP support USD and use an
        Account Link ID; SEPA supports EUR and uses an IBAN, with an optional
        BIC; FPS supports GBP and uses a sort code and account number. These
        forms are mutually exclusive.
      discriminator:
        propertyName: via
        mapping:
          ach: '#/components/schemas/Conversions_OnDemandConversionAchBankAccount'
          rtp: '#/components/schemas/Conversions_OnDemandConversionRtpBankAccount'
          sepa: '#/components/schemas/Conversions_OnDemandConversionSepaBankAccount'
          fps: '#/components/schemas/Conversions_OnDemandConversionFpsBankAccount'
      oneOf:
        - $ref: '#/components/schemas/Conversions_OnDemandConversionAchBankAccount'
          title: OnDemandConversionAchBankAccount
        - $ref: '#/components/schemas/Conversions_OnDemandConversionRtpBankAccount'
          title: OnDemandConversionRtpBankAccount
        - $ref: '#/components/schemas/Conversions_OnDemandConversionSepaBankAccount'
          title: OnDemandConversionSepaBankAccount
        - $ref: '#/components/schemas/Conversions_OnDemandConversionFpsBankAccount'
          title: OnDemandConversionFpsBankAccount
    Conversions_OnDemandConversionBalanceEndpoint:
      description: >-
        Balance source side of an on-demand conversion and its current
        settlement status.
      type: object
      additionalProperties: false
      required:
        - symbol
        - type
        - amount
        - status
      properties:
        symbol:
          $ref: '#/components/schemas/AssetSymbol'
          description: Asset symbol for this conversion side.
        type:
          title: OnDemandConversionBalanceEndpointType
          description: Type of source side. Always `balance`.
          type: string
          enum:
            - balance
        amount:
          description: Amount debited from the selected account balance.
          type: string
          minLength: 1
          maxLength: 64
        status:
          title: OnDemandConversionSettlementStatus
          description: Current settlement status of this conversion side.
          type: string
          enum:
            - pending
            - held
            - settled
            - failed
    Conversions_OnDemandConversionWalletEndpoint:
      description: >-
        Wallet destination side of an on-demand conversion and its current
        settlement status.
      type: object
      additionalProperties: false
      required:
        - symbol
        - type
        - wallet
        - amount
        - status
      properties:
        symbol:
          $ref: '#/components/schemas/AssetSymbol'
          description: Asset symbol for this conversion side.
        type:
          title: OnDemandConversionWalletEndpointType
          description: Type of destination side. Always `wallet`.
          type: string
          enum:
            - wallet
        wallet:
          $ref: '#/components/schemas/Conversions_OnDemandConversionWalletTarget'
        amount:
          description: Amount delivered to the destination wallet.
          type: string
          minLength: 1
          maxLength: 64
        status:
          title: OnDemandConversionSettlementStatus
          description: Current settlement status of this conversion side.
          type: string
          enum:
            - pending
            - held
            - settled
            - failed
    Conversions_OnDemandConversionBankEndpoint:
      description: >-
        Bank source or destination side of an on-demand conversion and its
        current settlement status.
      type: object
      additionalProperties: false
      required:
        - symbol
        - type
        - bank_account
        - amount
        - status
      properties:
        symbol:
          $ref: '#/components/schemas/AssetSymbol'
          description: Fiat asset symbol for this conversion side.
        type:
          title: OnDemandConversionBankEndpointType
          description: Type of conversion side. Always `bank`.
          type: string
          enum:
            - bank
        bank_account:
          $ref: '#/components/schemas/Conversions_OnDemandConversionBankAccount'
        amount:
          description: Amount debited from or delivered to the bank account.
          type: string
          minLength: 1
          maxLength: 64
        status:
          title: OnDemandConversionSettlementStatus
          description: Current settlement status of this conversion side.
          type: string
          enum:
            - pending
            - held
            - settled
            - failed
    Conversions_OnDemandConversionRateAsset:
      description: Asset in an on-demand conversion rate pair.
      type: object
      required:
        - symbol
      properties:
        symbol:
          description: Asset ticker symbol for the rate pair.
          type: string
    Price:
      description: >-
        Price of one unit of an asset or instrument in the applicable quote
        units.
      type: string
      minLength: 1
      maxLength: 64
      pattern: ^[0-9]+(\.[0-9]+)?$
    Conversions_OnDemandConversionFee:
      description: A single fee charged for an on-demand conversion.
      type: object
      additionalProperties: false
      required:
        - symbol
        - amount
      properties:
        symbol:
          $ref: '#/components/schemas/AssetSymbol'
          description: Asset ticker symbol the fee is denominated in.
        amount:
          description: Fee amount as a decimal string.
          type: string
          minLength: 1
          maxLength: 64
    Conversions_OnDemandConversionTransactionReference:
      description: Transaction references for one conversion leg.
      type: object
      additionalProperties: false
      properties:
        transaction_id:
          description: Internal transaction identifier.
          type: string
          minLength: 1
          maxLength: 256
        blockchain_transaction_id:
          description: Blockchain transaction identifier, when available.
          type: string
          minLength: 1
          maxLength: 256
    PwsValidationErrorEnvelope:
      description: Error envelope for request validation failures.
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/PwsValidationError'
          description: Validation error details.
    PwsValidationError:
      description: Standard PWS API error object for request validation failures.
      type: object
      required:
        - type
        - status
        - instance
        - code
      properties:
        type:
          description: Machine-readable error class.
          type: string
        status:
          description: HTTP status code returned for this error.
          type: integer
          format: int32
        instance:
          description: Request identifier for this specific error occurrence.
          type: string
        code:
          description: Stable machine-readable error code.
          type: string
        doc_url:
          description: Optional link to documentation for this error.
          type: string
          format: uri
        causes:
          description: Validation failures that contributed to the error.
          type: array
          items:
            $ref: '#/components/schemas/PwsErrorCause'
    PwsGeneralErrorEnvelope:
      description: Error envelope for operational or domain failures.
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/PwsGeneralError'
          description: General error details.
    PwsGeneralError:
      description: Standard PWS API error object for non-validation failures.
      allOf:
        - $ref: '#/components/schemas/PwsErrorBase'
        - type: object
          properties:
            causes:
              description: Additional error details, when present.
              type: array
              items:
                type: object
                additionalProperties: true
    Conversions_OnDemandConversionAchBankAccount:
      description: Linked ACH bank account used to fund or receive an on-demand conversion.
      type: object
      additionalProperties: false
      required:
        - via
        - account_link_id
      properties:
        via:
          title: OnDemandConversionLinkedAchVia
          description: Bank rail. Always `ach`.
          type: string
          enum:
            - ach
        account_link_id:
          description: Public Account Link identifier for the ACH account.
          type: string
          minLength: 1
          maxLength: 128
    Conversions_OnDemandConversionRfpBankAccount:
      description: >-
        Linked bank account used to fund an on-demand conversion by Request for
        Payment.
      type: object
      additionalProperties: false
      required:
        - via
        - account_link_id
      properties:
        via:
          title: OnDemandConversionLinkedRfpVia
          description: Bank rail. Always `rfp`.
          type: string
          enum:
            - rfp
        account_link_id:
          description: Public Account Link identifier for the RfP account.
          type: string
          minLength: 1
          maxLength: 128
    Conversions_OnDemandConversionRtpBankAccount:
      description: RTP bank account destination.
      type: object
      additionalProperties: false
      required:
        - via
        - account_link_id
      properties:
        via:
          title: OnDemandConversionLinkedRtpVia
          description: Bank rail. Always `rtp` for this destination.
          type: string
          enum:
            - rtp
        account_link_id:
          description: Public Account Link identifier for the RTP account.
          type: string
          minLength: 1
          maxLength: 128
    Conversions_OnDemandConversionSepaBankAccount:
      description: SEPA bank account destination.
      type: object
      additionalProperties: false
      required:
        - via
        - iban
      properties:
        via:
          title: OnDemandConversionRawSepaVia
          description: Bank rail. Always `sepa` for this destination.
          type: string
          enum:
            - sepa
        iban:
          description: International Bank Account Number for the SEPA destination.
          type: string
          minLength: 14
          maxLength: 42
        bic:
          description: Optional Bank Identifier Code for the SEPA destination.
          type: string
          minLength: 8
          maxLength: 11
    Conversions_OnDemandConversionFpsBankAccount:
      description: FPS bank account destination.
      type: object
      additionalProperties: false
      required:
        - via
        - sort_code
        - account_number
      properties:
        via:
          title: OnDemandConversionRawFpsVia
          description: Bank rail. Always `fps` for this destination.
          type: string
          enum:
            - fps
        sort_code:
          description: UK sort code for the FPS destination.
          type: string
          minLength: 6
          maxLength: 8
        account_number:
          description: Account number for the FPS destination.
          type: string
          minLength: 1
          maxLength: 34
    Conversions_OnDemandConversionBankAccount:
      description: Bank account used by a source or destination conversion side.
      discriminator:
        propertyName: via
        mapping:
          ach: '#/components/schemas/Conversions_OnDemandConversionAchBankAccount'
          rtp: '#/components/schemas/Conversions_OnDemandConversionRtpBankAccount'
          sepa: '#/components/schemas/Conversions_OnDemandConversionSepaBankAccount'
          fps: '#/components/schemas/Conversions_OnDemandConversionFpsBankAccount'
          rfp: '#/components/schemas/Conversions_OnDemandConversionRfpBankAccount'
      oneOf:
        - $ref: '#/components/schemas/Conversions_OnDemandConversionAchBankAccount'
          title: OnDemandConversionAchBankAccount
        - $ref: '#/components/schemas/Conversions_OnDemandConversionRtpBankAccount'
          title: OnDemandConversionRtpBankAccount
        - $ref: '#/components/schemas/Conversions_OnDemandConversionSepaBankAccount'
          title: OnDemandConversionSepaBankAccount
        - $ref: '#/components/schemas/Conversions_OnDemandConversionFpsBankAccount'
          title: OnDemandConversionFpsBankAccount
        - $ref: '#/components/schemas/Conversions_OnDemandConversionRfpBankAccount'
          title: OnDemandConversionRfpBankAccount
    PwsErrorCause:
      description: A single request validation failure.
      type: object
      required:
        - field
        - message
      properties:
        field:
          description: Dot-notation path to the offending request field.
          type: string
        message:
          description: Human-readable explanation of the failed validation rule.
          type: string
    PwsErrorBase:
      description: Common fields present on every PWS API error object.
      type: object
      required:
        - type
        - status
        - instance
        - code
      properties:
        type:
          description: Machine-readable error class.
          type: string
        status:
          description: HTTP status code returned for this error.
          type: integer
          format: int32
        instance:
          description: Request identifier for this specific error occurrence.
          type: string
        code:
          description: Stable machine-readable error code.
          type: string
        doc_url:
          description: Optional link to documentation for this error.
          type: string
          format: uri
  headers:
    TraceId:
      description: Trace identifier for the request. Include it when contacting support.
      schema:
        type: string
        example: 4bf92f3577b34da6a3ce929d0e0e4736
    StrictTransportSecurity:
      description: Enforces HTTPS for the duration specified by `max-age`.
      schema:
        type: string
        example: max-age=31536000; includeSubDomains; preload
    CacheControl:
      description: Prevents caching of sensitive financial data. Always `no-store`.
      schema:
        type: string
        enum:
          - no-store
        example: no-store
  responses:
    ConversionsBadRequestResponse:
      description: Validation error.
      headers:
        X-Trace-Id:
          $ref: '#/components/headers/TraceId'
        Strict-Transport-Security:
          $ref: '#/components/headers/StrictTransportSecurity'
        Cache-Control:
          $ref: '#/components/headers/CacheControl'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/BadRequestError'
          examples:
            invalid-request:
              $ref: '#/components/examples/conversions-bad-request'
    ConversionsUnauthenticatedResponse:
      description: Authentication required.
      headers:
        X-Trace-Id:
          $ref: '#/components/headers/TraceId'
        Strict-Transport-Security:
          $ref: '#/components/headers/StrictTransportSecurity'
        Cache-Control:
          $ref: '#/components/headers/CacheControl'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UnauthenticatedError'
          examples:
            authentication-failed:
              $ref: '#/components/examples/conversions-unauthenticated'
    ConversionsForbiddenResponse:
      description: Forbidden.
      headers:
        X-Trace-Id:
          $ref: '#/components/headers/TraceId'
        Strict-Transport-Security:
          $ref: '#/components/headers/StrictTransportSecurity'
        Cache-Control:
          $ref: '#/components/headers/CacheControl'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ForbiddenError'
          examples:
            caller-is-not-allowed:
              $ref: '#/components/examples/conversions-forbidden'
    ConversionsOnDemandConflictResponse:
      description: >-
        The conversion cannot be created with the supplied account state or
        idempotency key.
      headers:
        X-Trace-Id:
          $ref: '#/components/headers/TraceId'
        Strict-Transport-Security:
          $ref: '#/components/headers/StrictTransportSecurity'
        Cache-Control:
          $ref: '#/components/headers/CacheControl'
      content:
        application/json:
          schema:
            oneOf:
              - $ref: >-
                  #/components/schemas/Conversions_OnDemandConversionIdempotencyKeyAlreadyUsedError
                title: Idempotency key already used
              - $ref: >-
                  #/components/schemas/Conversions_ConversionInsufficientFundsErrorResponse
                title: Insufficient funds
          examples:
            idempotency-key-already-used:
              $ref: '#/components/examples/conversions-idempotency-key-already-used'
            insufficient-funds:
              $ref: '#/components/examples/conversions-insufficient-funds'
    ConversionsResourceExhaustedResponse:
      description: Rate limit exceeded.
      headers:
        X-Trace-Id:
          $ref: '#/components/headers/TraceId'
        Strict-Transport-Security:
          $ref: '#/components/headers/StrictTransportSecurity'
        Cache-Control:
          $ref: '#/components/headers/CacheControl'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ResourceExhaustedError'
          examples:
            rate-limit-exceeded:
              $ref: '#/components/examples/conversions-resource-exhausted'
    ConversionsInternalResponse:
      description: Internal server error.
      headers:
        X-Trace-Id:
          $ref: '#/components/headers/TraceId'
        Strict-Transport-Security:
          $ref: '#/components/headers/StrictTransportSecurity'
        Cache-Control:
          $ref: '#/components/headers/CacheControl'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InternalError'
          examples:
            internal-error:
              $ref: '#/components/examples/conversions-internal'
    ConversionsUnavailableResponse:
      description: Service unavailable.
      headers:
        X-Trace-Id:
          $ref: '#/components/headers/TraceId'
        Strict-Transport-Security:
          $ref: '#/components/headers/StrictTransportSecurity'
        Cache-Control:
          $ref: '#/components/headers/CacheControl'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UnavailableError'
          examples:
            service-unavailable:
              $ref: '#/components/examples/conversions-unavailable'
    ConversionsDeadlineExceededResponse:
      description: Request deadline exceeded.
      headers:
        X-Trace-Id:
          $ref: '#/components/headers/TraceId'
        Strict-Transport-Security:
          $ref: '#/components/headers/StrictTransportSecurity'
        Cache-Control:
          $ref: '#/components/headers/CacheControl'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/DeadlineExceededError'
          examples:
            request-deadline-exceeded:
              $ref: '#/components/examples/conversions-deadline-exceeded'
  examples:
    conversions-bad-request:
      summary: Invalid request
      value:
        error:
          type: conversions_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 400
          code: bad_request
          causes:
            - field: account_id
              message: must be a valid account identifier
    conversions-unauthenticated:
      summary: Authentication failed
      value:
        error:
          type: conversions_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 401
          code: unauthenticated
    conversions-forbidden:
      summary: Caller is not allowed
      value:
        error:
          type: conversions_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 403
          code: forbidden
    conversions-idempotency-key-already-used:
      summary: Idempotency key already used
      value:
        error:
          type: conversions_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 409
          code: idempotency_key_already_used
        conversion_id: 00000000-0000-0000-0000-000000000001
    conversions-insufficient-funds:
      summary: Insufficient funds
      value:
        error:
          type: conversions_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 409
          code: conversion_insufficient_funds
    conversions-resource-exhausted:
      summary: Rate limit exceeded
      value:
        error:
          type: conversions_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 429
          code: resource_exhausted
    conversions-internal:
      summary: Internal server error
      value:
        error:
          type: conversions_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 500
          code: internal
    conversions-unavailable:
      summary: Service unavailable
      value:
        error:
          type: conversions_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 503
          code: unavailable
    conversions-deadline-exceeded:
      summary: Request deadline exceeded
      value:
        error:
          type: conversions_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 504
          code: deadline_exceeded
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: API-Key
      description: Your public API key. Identifies the partner making the request.
    ApiSign:
      type: apiKey
      in: header
      name: API-Sign
      description: HMAC signature over the request, computed with your private key.
    ApiNonce:
      type: apiKey
      in: header
      name: API-Nonce
      description: Monotonically increasing nonce included in the request signature.

````