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

> Executes a quote that is still `offered` and not expired.

Execution may finish asynchronously, after this response returns. Use [Get quote](/api-reference/swaps/get-quote) to check the final status.



## OpenAPI

````yaml https://d2588n1sy4m36o.cloudfront.net/uat/merged/openapi.json post /v1/accounts/{account_id}/quotes/{quote_id}/execute
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}/quotes/{quote_id}/execute:
    parameters:
      - $ref: '#/components/parameters/AccountId'
      - $ref: '#/components/parameters/Swaps_QuoteId'
    post:
      tags:
        - Swaps
      summary: Execute quote
      description: >-
        Executes a quote that is still `offered` and not expired.


        Execution may finish asynchronously, after this response returns. Use
        [Get quote](/api-reference/swaps/get-quote) to check the final status.
      operationId: executeQuote
      responses:
        '200':
          description: ''
          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/Swaps_QuoteExecution'
              examples:
                quote-execution-started:
                  summary: Quote execution started
                  value:
                    data:
                      id: BQ5U74K-XV6GP-TTQ567
                      status: executing
          links:
            GetQuote:
              operationId: getQuote
              parameters:
                account_id: $request.path.account_id
                quote_id: $request.path.quote_id
              description: Check the quote's final status.
        '400':
          description: ''
          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/BadRequestError'
                  - $ref: >-
                      #/components/schemas/Swaps_OnchainExecutionUnsupportedError
              examples:
                invalid-request:
                  $ref: '#/components/examples/swap-quote-validation'
                onchain-execution-unsupported:
                  $ref: '#/components/examples/swap-onchain-execution-unsupported'
        '401':
          $ref: '#/components/responses/SwapQuoteUnauthenticatedResponse'
        '403':
          description: ''
          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/ForbiddenError'
                  - $ref: '#/components/schemas/Swaps_TradeLockedError'
                  - $ref: '#/components/schemas/Swaps_AcquisitionLimitExceededError'
                  - $ref: '#/components/schemas/Swaps_SuitabilityLimitExceededError'
                  - $ref: >-
                      #/components/schemas/Swaps_PatternDayTradingProtectionError
                  - $ref: '#/components/schemas/Swaps_PotentialWashTradeError'
              examples:
                caller-is-not-allowed:
                  $ref: '#/components/examples/swap-quote-forbidden'
                trade-is-locked:
                  $ref: '#/components/examples/swap-quote-trade-locked'
                acquisition-limit-exceeded:
                  $ref: '#/components/examples/swap-acquisition-limit-exceeded'
                suitability-limit-exceeded:
                  $ref: '#/components/examples/swap-suitability-limit-exceeded'
                pattern-day-trading-protection:
                  $ref: '#/components/examples/swap-pattern-day-trading-protection'
                potential-wash-trade:
                  $ref: '#/components/examples/swap-potential-wash-trade'
        '404':
          description: ''
          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/Swaps_QuoteNotFoundError'
              examples:
                quote-not-found:
                  $ref: '#/components/examples/swap-quote-not-found'
        '409':
          description: ''
          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/Swaps_InsufficientFundsError'
                  - $ref: '#/components/schemas/Swaps_QuoteCancelledError'
                  - $ref: '#/components/schemas/Swaps_QuoteExecutionFailedError'
                  - $ref: '#/components/schemas/Swaps_InsufficientMarginError'
                  - $ref: '#/components/schemas/Swaps_SellOnlyAssetError'
                  - $ref: '#/components/schemas/Swaps_FractionalExtendedHoursError'
                  - $ref: '#/components/schemas/Swaps_IpoAssetError'
                  - $ref: '#/components/schemas/Swaps_OtcRegularHoursOnlyError'
                  - $ref: '#/components/schemas/Swaps_OtcSellOnlyError'
                  - $ref: '#/components/schemas/Swaps_EquityMarketClosedError'
                  - $ref: '#/components/schemas/Swaps_IllegalOrderTypeAfterHoursError'
                  - $ref: '#/components/schemas/Swaps_InsufficientLiquidityError'
              examples:
                insufficient-funds:
                  $ref: '#/components/examples/swap-insufficient-funds'
                quote-cancelled:
                  $ref: '#/components/examples/swap-quote-cancelled'
                quote-execution-failed:
                  $ref: '#/components/examples/swap-quote-execution-failed'
                insufficient-margin:
                  $ref: '#/components/examples/swap-insufficient-margin'
                sell-only-asset:
                  $ref: '#/components/examples/swap-sell-only-asset'
                fractional-trading-during-extended-hours:
                  $ref: '#/components/examples/swap-fractional-extended-hours'
                ipo-asset:
                  $ref: '#/components/examples/swap-ipo-asset'
                otc-regular-hours-only:
                  $ref: '#/components/examples/swap-otc-regular-hours-only'
                otc-sell-only:
                  $ref: '#/components/examples/swap-otc-sell-only'
                equity-market-closed:
                  $ref: '#/components/examples/swap-equity-market-closed'
                illegal-order-type-after-hours:
                  $ref: '#/components/examples/swap-illegal-order-type-after-hours'
                insufficient-liquidity:
                  $ref: '#/components/examples/swap-quote-insufficient-liquidity'
        '410':
          description: ''
          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/Swaps_QuoteExpiredError'
              examples:
                quote-expired:
                  $ref: '#/components/examples/swap-quote-expired'
        '429':
          $ref: '#/components/responses/SwapQuoteResourceExhaustedResponse'
        '500':
          $ref: '#/components/responses/SwapQuoteInternalResponse'
        '503':
          description: ''
          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/swap-quote-service-unavailable'
        '504':
          $ref: '#/components/responses/SwapQuoteDeadlineExceededResponse'
      security:
        - ApiKey: []
          ApiSign: []
          ApiNonce: []
components:
  parameters:
    AccountId:
      name: account_id
      in: path
      required: true
      example: WVSD33HRMGSZUBM7
      schema:
        $ref: '#/components/schemas/AccountId'
    Swaps_QuoteId:
      name: quote_id
      in: path
      description: Unique identifier of the quote.
      required: true
      example: BQ5U74K-XV6GP-TTQ567
      schema:
        type: string
        minLength: 1
        maxLength: 64
  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
  schemas:
    Swaps_QuoteExecution:
      description: Result of executing a quote.
      type: object
      required:
        - id
        - status
      properties:
        id:
          description: Unique identifier of the executed quote.
          type: string
        status:
          $ref: '#/components/schemas/Swaps_QuoteStatus'
          description: Lifecycle status after the execution attempt.
    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
    Swaps_OnchainExecutionUnsupportedError:
      title: Onchain Execution Unsupported
      description: The quote cannot be executed through the onchain execution path.
      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: 400
                    code:
                      type: string
                      enum:
                        - onchain_execution_unsupported
    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
    Swaps_TradeLockedError:
      title: Trade Locked
      description: The trade cannot proceed because the source or destination is locked.
      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:
                        - trade_locked
    Swaps_AcquisitionLimitExceededError:
      title: Acquisition Limit Exceeded
      description: The trade would exceed an acquisition limit that applies to the account.
      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:
                        - acquisition_limit_exceeded
    Swaps_SuitabilityLimitExceededError:
      title: Suitability Limit Exceeded
      description: The trade would exceed a suitability limit that applies to the account.
      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:
                        - suitability_limit_exceeded
    Swaps_PatternDayTradingProtectionError:
      title: Pattern Day Trading Protection
      description: The trade was blocked by pattern day trading protection.
      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:
                        - pattern_day_trading_protection
    Swaps_PotentialWashTradeError:
      title: Potential Wash Trade
      description: The trade was blocked because it could be a wash trade.
      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:
                        - potential_wash_trade
    Swaps_QuoteNotFoundError:
      description: No quote exists for the supplied quote identifier.
      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: 404
                    code:
                      type: string
                      enum:
                        - quote_not_found
    Swaps_InsufficientFundsError:
      title: Insufficient Funds
      description: The account does not have sufficient funds to execute the quote.
      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:
                        - insufficient_funds
    Swaps_QuoteCancelledError:
      title: Quote Canceled
      description: The quote has been canceled and can no longer be executed.
      allOf:
        - $ref: '#/components/schemas/PwsGeneralErrorEnvelope'
        - type: object
          required:
            - error
          properties:
            error:
              allOf:
                - $ref: '#/components/schemas/PwsGeneralError'
                - type: object
                  required:
                    - status
                    - code
                    - causes
                  properties:
                    status:
                      type: integer
                      format: int32
                      const: 409
                    code:
                      type: string
                      enum:
                        - quote_cancelled
                    causes:
                      type: array
                      minItems: 1
                      maxItems: 1
                      items:
                        $ref: '#/components/schemas/Swaps_QuoteCancelledCause'
    Swaps_QuoteExecutionFailedError:
      title: Quote Execution Failed
      description: The quote could not be executed because its execution failed.
      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:
                        - quote_execution_failed
    Swaps_InsufficientMarginError:
      title: Insufficient Margin
      description: The account does not have sufficient margin to execute the quote.
      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:
                        - insufficient_margin
    Swaps_SellOnlyAssetError:
      title: Sell Only Asset
      description: The destination asset is currently sell-only and cannot be acquired.
      allOf:
        - $ref: '#/components/schemas/PwsGeneralErrorEnvelope'
        - type: object
          required:
            - error
          properties:
            error:
              allOf:
                - $ref: '#/components/schemas/PwsGeneralError'
                - type: object
                  required:
                    - status
                    - code
                    - causes
                  properties:
                    status:
                      type: integer
                      format: int32
                      const: 409
                    code:
                      type: string
                      enum:
                        - sell_only_asset
                    causes:
                      type: array
                      minItems: 1
                      maxItems: 32
                      description: One cause for each asset that is currently sell-only.
                      items:
                        $ref: '#/components/schemas/Swaps_SellOnlyAssetCause'
    Swaps_FractionalExtendedHoursError:
      title: Fractional Extended Hours
      description: Fractional equity trading is unavailable outside regular market hours.
      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:
                        - fractional_extended_hours
    Swaps_IpoAssetError:
      title: IPO Asset
      description: >-
        The asset cannot be traded while it is in its initial public offering
        period.
      allOf:
        - $ref: '#/components/schemas/PwsGeneralErrorEnvelope'
        - type: object
          required:
            - error
          properties:
            error:
              allOf:
                - $ref: '#/components/schemas/PwsGeneralError'
                - type: object
                  required:
                    - status
                    - code
                    - causes
                  properties:
                    status:
                      type: integer
                      format: int32
                      const: 409
                    code:
                      type: string
                      enum:
                        - ipo_asset
                    causes:
                      type: array
                      minItems: 1
                      maxItems: 1
                      items:
                        $ref: '#/components/schemas/Swaps_IpoAssetCause'
    Swaps_OtcRegularHoursOnlyError:
      title: OTC Regular Hours Only
      description: The OTC asset can only be traded during regular market hours.
      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:
                        - otc_regular_hours_only
    Swaps_OtcSellOnlyError:
      title: OTC Sell Only
      description: The OTC asset is currently sell-only and cannot be acquired.
      allOf:
        - $ref: '#/components/schemas/PwsGeneralErrorEnvelope'
        - type: object
          required:
            - error
          properties:
            error:
              allOf:
                - $ref: '#/components/schemas/PwsGeneralError'
                - type: object
                  required:
                    - status
                    - code
                    - causes
                  properties:
                    status:
                      type: integer
                      format: int32
                      const: 409
                    code:
                      type: string
                      enum:
                        - otc_sell_only
                    causes:
                      type: array
                      minItems: 1
                      maxItems: 1
                      items:
                        $ref: '#/components/schemas/Swaps_OtcSellOnlyCause'
    Swaps_EquityMarketClosedError:
      title: Equity Market Closed
      description: The equity market is closed and the trade cannot be submitted.
      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:
                        - equity_market_closed
    Swaps_IllegalOrderTypeAfterHoursError:
      title: Illegal Order Type After Hours
      description: The requested order type is unavailable outside regular market hours.
      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:
                        - illegal_order_type_after_hours
    Swaps_InsufficientLiquidityError:
      title: Insufficient Liquidity
      description: The requested trade cannot be quoted because liquidity is insufficient.
      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:
                        - insufficient_liquidity
    Swaps_QuoteExpiredError:
      description: The quote has expired and can no longer be executed.
      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: 410
                    code:
                      type: string
                      enum:
                        - quote_expired
    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
    AccountId:
      description: Globally unique public identifier for an account.
      type: string
      minLength: 14
      maxLength: 42
    Swaps_QuoteStatus:
      description: >-
        Current lifecycle status of a quote. `offered` quotes can be executed;
        `executed`, `expired`, and `failed` are final states.
      type: string
      enum:
        - offered
        - executing
        - executed
        - expired
        - failed
        - pending
    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
    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
    Swaps_QuoteCancelledCause:
      description: Details about a quote that has been canceled.
      type: object
      required:
        - field
        - message
        - reason
      properties:
        field:
          description: Dot-notation path to the quote identifier.
          type: string
        message:
          description: Human-readable explanation of the quote state.
          type: string
        reason:
          title: QuoteCancellationReason
          type: string
          enum:
            - market_moved
            - expired
            - unknown
          description: Public reason why the quote was canceled.
    Swaps_SellOnlyAssetCause:
      description: Details about one asset that is currently sell-only.
      type: object
      required:
        - field
        - message
        - symbol
      properties:
        field:
          description: Dot-notation path to the affected asset symbol.
          type: string
        message:
          description: Human-readable explanation of the trading restriction.
          type: string
        symbol:
          type: string
          minLength: 1
          maxLength: 64
          pattern: ^[-A-Za-z0-9._/]+$
          description: Symbol of an asset that is currently sell-only.
    Swaps_IpoAssetCause:
      description: Details about an asset in its initial public offering period.
      type: object
      required:
        - field
        - message
        - symbol
      properties:
        field:
          description: Dot-notation path to the affected asset symbol.
          type: string
        message:
          description: Human-readable explanation of the trading restriction.
          type: string
        symbol:
          type: string
          minLength: 1
          maxLength: 64
          pattern: ^[-A-Za-z0-9._/]+$
          description: Symbol of the asset in its initial public offering period.
    Swaps_OtcSellOnlyCause:
      description: Details about an OTC asset that is currently sell-only.
      type: object
      required:
        - field
        - message
        - symbol
      properties:
        field:
          description: Dot-notation path to the affected asset symbol.
          type: string
        message:
          description: Human-readable explanation of the trading restriction.
          type: string
        symbol:
          type: string
          minLength: 1
          maxLength: 64
          pattern: ^[-A-Za-z0-9._/]+$
          description: Symbol of the OTC asset that is currently sell-only.
    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
    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
    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
  examples:
    swap-quote-validation:
      summary: Quote request validation failed
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 400
          code: bad_request
          causes:
            - field: amount
              message: >-
                Exactly one of from.amount or to.amount must be set, but both
                were provided
    swap-onchain-execution-unsupported:
      summary: Onchain quote cannot be executed here
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 400
          code: onchain_execution_unsupported
    swap-quote-forbidden:
      summary: Caller is not allowed
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 403
          code: forbidden
    swap-quote-trade-locked:
      summary: Trade is locked
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 403
          code: trade_locked
    swap-acquisition-limit-exceeded:
      summary: Acquisition limit exceeded
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 403
          code: acquisition_limit_exceeded
    swap-suitability-limit-exceeded:
      summary: Suitability limit exceeded
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 403
          code: suitability_limit_exceeded
    swap-pattern-day-trading-protection:
      summary: Pattern day trading protection applied
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 403
          code: pattern_day_trading_protection
    swap-potential-wash-trade:
      summary: Potential wash trade detected
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 403
          code: potential_wash_trade
    swap-quote-not-found:
      summary: Quote not found
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 404
          code: quote_not_found
    swap-insufficient-funds:
      summary: Insufficient funds
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 409
          code: insufficient_funds
    swap-quote-cancelled:
      summary: Quote was canceled
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 409
          code: quote_cancelled
          causes:
            - field: quote_id
              message: The quote was cancelled.
              reason: market_moved
    swap-quote-execution-failed:
      summary: Quote execution failed
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 409
          code: quote_execution_failed
    swap-insufficient-margin:
      summary: Insufficient margin
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 409
          code: insufficient_margin
    swap-sell-only-asset:
      summary: Asset is sell-only
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 409
          code: sell_only_asset
          causes:
            - field: symbol
              message: The asset is currently sell-only.
              symbol: TSLAx
    swap-fractional-extended-hours:
      summary: Fractional trading is unavailable during extended hours
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 409
          code: fractional_extended_hours
    swap-ipo-asset:
      summary: Asset is in its initial public offering period
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 409
          code: ipo_asset
          causes:
            - field: symbol
              message: The asset is in its initial public offering period.
              symbol: TSLAx
    swap-otc-regular-hours-only:
      summary: OTC asset can only be traded during regular market hours
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 409
          code: otc_regular_hours_only
    swap-otc-sell-only:
      summary: OTC asset is sell-only
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 409
          code: otc_sell_only
          causes:
            - field: symbol
              message: The OTC asset is currently sell-only.
              symbol: ABC
    swap-equity-market-closed:
      summary: Equity market is closed
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 409
          code: equity_market_closed
    swap-illegal-order-type-after-hours:
      summary: Order type is unavailable outside regular market hours
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 409
          code: illegal_order_type_after_hours
    swap-quote-insufficient-liquidity:
      summary: Insufficient liquidity
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 409
          code: insufficient_liquidity
    swap-quote-expired:
      summary: Quote expired
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 410
          code: quote_expired
    swap-quote-service-unavailable:
      summary: Service unavailable
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 503
          code: unavailable
    swap-quote-unauthenticated:
      summary: Authentication failed
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 401
          code: unauthenticated
    swap-quote-resource-exhausted:
      summary: Rate limit exceeded
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 429
          code: resource_exhausted
    swap-quote-internal:
      summary: Internal error
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 500
          code: internal
    swap-quote-deadline-exceeded:
      summary: Request deadline exceeded
      value:
        error:
          type: quote_error
          instance: 5f4d2a8e-91a4-4d6c-8a17-9b1e2c3f4a5b
          status: 504
          code: deadline_exceeded
  responses:
    SwapQuoteUnauthenticatedResponse:
      description: ''
      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/swap-quote-unauthenticated'
    SwapQuoteResourceExhaustedResponse:
      description: ''
      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/swap-quote-resource-exhausted'
    SwapQuoteInternalResponse:
      description: ''
      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/swap-quote-internal'
    SwapQuoteDeadlineExceededResponse:
      description: ''
      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/swap-quote-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.

````