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

# List trades

> List trades for a specific account, ordered by `executed_at`, newest first.

Keep the same account and filters between pages. Continue while `next_page_token` is present.



## OpenAPI

````yaml https://d2588n1sy4m36o.cloudfront.net/uat/merged/openapi.json?mintlify-view=derivatives get /v1/accounts/{account_id}/trades
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: Derivatives transfers
    description: >-
      Move funds between an account's spot balance and the same owner's futures
      balance.
    x-displayName: Derivatives 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: Market data stream
    description: Live market data for derivatives instruments.
    x-displayName: Market data stream
  - name: Derivatives instruments
    description: Discover instruments available for trading by asset type.
    x-displayName: Derivatives instruments
  - name: Derivatives tickers
    x-group: Derivatives market data
    description: Read market-data snapshots for supported trading instruments.
    x-displayName: Derivatives tickers
  - name: Derivatives order books
    x-group: Derivatives market data
    description: Read level-two market depth for supported trading instruments.
    x-displayName: Derivatives order books
  - name: Derivatives OHLC
    x-group: Derivatives market data
    description: Read historical candlestick market data for supported trading instruments.
    x-displayName: Derivatives OHLC
  - name: Derivatives orders
    description: Submit and inspect orders by asset type.
    x-displayName: Derivatives orders
  - name: Derivatives trades
    description: Inspect executions by asset type.
    x-displayName: Derivatives trades
  - name: Derivatives leverage
    description: Read and update per-instrument leverage preferences for trading accounts.
    x-displayName: Derivatives leverage
  - 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.


      In webhook payloads, `account_id` and `user_id` are in groups of four
      characters, with a space between the groups. For example, `WCQY T95Y CUL2
      A7NX`. The REST APIs send the same identifier without spaces, for example
      `WCQYT95YCUL2A7NX`. Remove the spaces before you compare a webhook
      identifier with a REST identifier.


      Amounts in webhook payloads are decimal strings, in the ledger precision
      of the asset. Compare amounts as decimal numbers, not as strings.
    x-displayName: Webhooks
paths:
  /v1/accounts/{account_id}/trades:
    servers:
      - url: https://api.sandbox.services.payward.com
    parameters:
      - $ref: '#/components/parameters/AccountId'
    get:
      tags:
        - Derivatives trades
      summary: List trades
      description: >-
        List trades for a specific account, ordered by `executed_at`, newest
        first.


        Keep the same account and filters between pages. Continue while
        `next_page_token` is present.
      operationId: listTrades
      parameters:
        - $ref: '#/components/parameters/TradingTrades_AssetTypeFilter'
        - $ref: '#/components/parameters/TradingTrades_PageSize'
        - $ref: '#/components/parameters/PageToken'
        - $ref: '#/components/parameters/TradingTrades_ClientOrderIdFilter'
        - in: query
          name: order_id
          description: >-
            Filter trades by the server-issued order identifier returned as `id`
            when creating or retrieving an order in the selected account. Treat
            it as an opaque value and pass it unchanged.
          examples:
            us-derivatives:
              value: FOPCDC6-PQIPJ-JLEIRY
            international-eea-derivatives:
              value: a4f30a55-4d63-55f9-b774-f9f9e628067e
          schema:
            type: string
            minLength: 1
            maxLength: 64
            example: FOPCDC6-PQIPJ-JLEIRY
        - in: query
          name: symbol
          description: Filter trades by instrument symbol, ignoring case.
          example: PBTCUCZ0.BTNL
          schema:
            type: string
            minLength: 1
            maxLength: 64
            pattern: ^\S+$
            example: PBTCUCZ0.BTNL
        - in: query
          name: start_timestamp
          description: >-
            Exclusive lower bound for `executed_at`. Sub-millisecond values are
            rejected. Must not be later than `end_timestamp`.
          example: '2026-08-03T10:00:02.123Z'
          schema:
            $ref: '#/components/schemas/DateTime'
            example: '2026-08-03T10:00:02.123Z'
        - in: query
          name: end_timestamp
          description: >-
            Inclusive upper bound for `executed_at`. Sub-millisecond values are
            rejected.
          example: '2026-08-03T10:00:02.124Z'
          schema:
            $ref: '#/components/schemas/DateTime'
            example: '2026-08-03T10:00:02.124Z'
      responses:
        '200':
          description: Trades for the selected asset type.
          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:
                    description: Trades matching the selected filters.
                    type: array
                    items:
                      $ref: '#/components/schemas/TradingTrades_Trade'
                  next_page_token:
                    description: >-
                      Opaque token for retrieving the next page. Absent when
                      there are no more results.
                    type: string
                    minLength: 1
                    maxLength: 256
              examples:
                us-derivatives:
                  value:
                    data:
                      - asset_type: perpetual
                        trade_id: FTCVJAW-YMSRO-EOHMXH
                        order_id: FOPCDC6-PQIPJ-JLEIRY
                        symbol: PBTCUCZ0.BTNL
                        side: buy
                        quantity: '2'
                        price: '66290'
                        notional: '1325.8'
                        fee: '2.10'
                        executed_at: '2026-08-03T10:00:02.124Z'
                international-eea-derivatives:
                  value:
                    data:
                      - asset_type: perpetual
                        trade_id: 19eb71d9-0637-5250-b3a4-f7798b14f96b
                        order_id: a4f30a55-4d63-55f9-b774-f9f9e628067e
                        client_order_id: a9ac0cba-f6d6-41cb-a248-344dbbdd12dd
                        symbol: PF_ETHUSD
                        side: buy
                        quantity: '0.5'
                        price: '2449.3'
                        notional: '1224.65'
                        fee: '0.33677875'
                        realized_pnl: '0'
                        executed_at: '2026-08-31T13:28:10.354Z'
                      - asset_type: perpetual
                        trade_id: 00496d4e-7ebb-55af-9b34-b37b0479eb1a
                        order_id: 15b28b48-9b4e-55df-8c4d-18f93dafc385
                        client_order_id: fed22f14-2b9b-467d-91da-cf1f1c61c3c7
                        symbol: PF_XBTUSD
                        side: buy
                        quantity: '0.0718'
                        price: '78582'
                        notional: '5642.1876'
                        fee: '1.55160159'
                        realized_pnl: '-12.5'
                        executed_at: '2026-08-26T10:39:36.491Z'
                    next_page_token: >-
                      CAEQFBokYTUxNmQ4Y2EtMGRmNS00YmYxLTg4Y2MtNTcwODkzZGM1MTI2HHzlwUO6CmqhSh6dkFzghThkxRQZJxwXM0SzNk0cJk0
                empty:
                  value:
                    data: []
        '400':
          description: >-
            The account, asset type, symbol, order ID, client order ID,
            timestamps, or pagination parameters are invalid.
          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:
                gateway-validation-failed:
                  value:
                    error:
                      type: service_error
                      status: 400
                      instance: 4bf92f3577b34da6a3ce929d0e0e4736
                      code: gateway
                invalid-client-order-id:
                  value:
                    error:
                      type: derivatives_error
                      status: 400
                      instance: 4bf92f3577b34da6a3ce929d0e0e4736
                      code: bad_request
                      causes:
                        - field: client_order_id
                          message: must be a valid UUID
                invalid-page-token:
                  value:
                    error:
                      type: derivatives_error
                      status: 400
                      instance: 4bf92f3577b34da6a3ce929d0e0e4736
                      code: bad_request
                      causes:
                        - field: page_token
                          message: The page token is invalid for this collection.
                invalid-time-range:
                  value:
                    error:
                      type: derivatives_error
                      status: 400
                      instance: 4bf92f3577b34da6a3ce929d0e0e4736
                      code: bad_request
                      causes:
                        - field: start_timestamp
                          message: >-
                            The start timestamp must be earlier than or equal to
                            the end timestamp.
        '401':
          description: Authentication failed.
          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/spot-derivatives-unauthenticated'
                gateway-authentication-failed:
                  $ref: >-
                    #/components/examples/spot-derivatives-gateway-unauthenticated
        '403':
          description: The caller is not allowed to perform this operation.
          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:
                access-denied:
                  $ref: '#/components/examples/spot-derivatives-forbidden'
                gateway-access-denied:
                  $ref: '#/components/examples/spot-derivatives-gateway-forbidden'
        '429':
          description: The request was rate limited.
          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/spot-derivatives-resource-exhausted'
        '500':
          description: An unexpected server-side error occurred.
          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/spot-derivatives-internal'
        '503':
          description: The requested capability is temporarily 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/spot-derivatives-unavailable'
        '504':
          description: The request deadline elapsed.
          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/spot-derivatives-deadline-exceeded'
      security:
        - ApiKey: []
          ApiSign: []
          ApiTimestamp: []
      x-codeSamples:
        - lang: bash
          label: Filter by symbol
          source: |
            curl --request GET \
              --url 'https://api.sandbox.services.payward.com/v1/accounts/WVSD33HRMGSZUBM7/trades?asset_type=perpetual&page_size=20&symbol=PBTCUCZ0.BTNL' \
              --header "API-Key: $PWS_API_KEY" \
              --header "API-Timestamp: $PWS_API_TIMESTAMP" \
              --header "API-Sign: $PWS_API_SIGN"
        - lang: bash
          label: Filter by order ID (US)
          source: |
            curl --request GET \
              --url 'https://api.sandbox.services.payward.com/v1/accounts/WVSD33HRMGSZUBM7/trades?asset_type=perpetual&order_id=FOPCDC6-PQIPJ-JLEIRY&page_size=20' \
              --header "API-Key: $PWS_API_KEY" \
              --header "API-Timestamp: $PWS_API_TIMESTAMP" \
              --header "API-Sign: $PWS_API_SIGN"
        - lang: bash
          label: Filter by order ID (International/EEA)
          source: |
            curl --request GET \
              --url 'https://api.sandbox.services.payward.com/v1/accounts/WVSD33HRMGSZUBM7/trades?asset_type=perpetual&order_id=a4f30a55-4d63-55f9-b774-f9f9e628067e&page_size=20' \
              --header "API-Key: $PWS_API_KEY" \
              --header "API-Timestamp: $PWS_API_TIMESTAMP" \
              --header "API-Sign: $PWS_API_SIGN"
        - lang: bash
          label: Filter by execution time
          source: |
            curl --request GET \
              --url 'https://api.sandbox.services.payward.com/v1/accounts/WVSD33HRMGSZUBM7/trades?asset_type=perpetual&page_size=20&start_timestamp=2026-08-01T00:00:00Z&end_timestamp=2026-10-01T00:00:00Z' \
              --header "API-Key: $PWS_API_KEY" \
              --header "API-Timestamp: $PWS_API_TIMESTAMP" \
              --header "API-Sign: $PWS_API_SIGN"
        - lang: bash
          label: Next page (same time filters)
          source: |
            curl --request GET \
              --url "https://api.sandbox.services.payward.com/v1/accounts/WVSD33HRMGSZUBM7/trades?asset_type=perpetual&page_token=$NEXT_PAGE_TOKEN&start_timestamp=2026-08-01T00:00:00Z&end_timestamp=2026-10-01T00:00:00Z" \
              --header "API-Key: $PWS_API_KEY" \
              --header "API-Timestamp: $PWS_API_TIMESTAMP" \
              --header "API-Sign: $PWS_API_SIGN"
components:
  parameters:
    AccountId:
      name: account_id
      in: path
      required: true
      example: WVSD33HRMGSZUBM7
      schema:
        $ref: '#/components/schemas/AccountId'
    TradingTrades_AssetTypeFilter:
      name: asset_type
      in: query
      required: false
      example: perpetual
      schema:
        $ref: '#/components/schemas/TradingTrades_AssetType'
        default: perpetual
        example: perpetual
    TradingTrades_PageSize:
      name: page_size
      in: query
      description: >-
        Maximum number of results to return. Ignored when `page_token` is
        present.
      required: false
      style: form
      example: 20
      schema:
        type: integer
        format: int32
        minimum: 1
        maximum: 100
        default: 20
        example: 20
    PageToken:
      name: page_token
      in: query
      description: >-
        Opaque token returned as `next_page_token` in the previous response.
        Omit to request the first page.
      required: false
      schema:
        type: string
        minLength: 1
        maxLength: 256
      style: form
      example: MjoyRHuBXSgoe0mDHt-iFALROW46EGdvk_trgja31Vwr7H4
    TradingTrades_ClientOrderIdFilter:
      name: client_order_id
      in: query
      description: >-
        **Available for the International/EEA offering.**


        Filter by the reference supplied when creating an order. Use a
        lowercase, hyphenated UUID. Reused references can match multiple orders
        and fills. Other filters still apply.
      required: false
      example: 550e8400-e29b-41d4-a716-446655440000
      schema:
        $ref: '#/components/schemas/TradingTrades_ClientOrderId'
        example: 550e8400-e29b-41d4-a716-446655440000
  schemas:
    DateTime:
      description: RFC 3339 timestamp.
      type: string
      format: date-time
    TradingTrades_Trade:
      description: A trade resulting from a full or partial order fill.
      type: object
      required:
        - asset_type
        - trade_id
        - order_id
        - symbol
        - side
        - quantity
        - price
        - fee
        - executed_at
      properties:
        asset_type:
          $ref: '#/components/schemas/TradingTrades_AssetType'
          example: perpetual
        trade_id:
          description: Server-issued trade identifier.
          type: string
          example: FTCVJAW-YMSRO-EOHMXH
        order_id:
          description: >-
            Identifier of the order that produced this trade. An order filled in
            parts can produce multiple trades with the same `order_id`.
          type: string
          example: FOPCDC6-PQIPJ-JLEIRY
        client_order_id:
          description: >-
            **Available for the International/EEA offering.**


            Partner-provided order reference, shared by all fills. Omitted when
            unavailable.
          type: string
          minLength: 1
          maxLength: 64
          example: 550e8400-e29b-41d4-a716-446655440000
        symbol:
          description: Instrument symbol.
          type: string
          example: PBTCUCZ0.BTNL
        side:
          $ref: '#/components/schemas/TradingTrades_OrderSide'
          example: buy
        quantity:
          description: >-
            Executed quantity, in contracts. See the instrument's
            `contract_size`.
          type: string
          example: '2'
        price:
          $ref: '#/components/schemas/Price'
          description: Execution price.
          example: '66290'
        notional:
          description: >-
            Value of this trade, in the instrument's quote asset and excluding
            fees.


            The calculation includes the instrument's `contract_size`, which
            specifies how much of the base asset each contract represents. For
            example, 2 contracts of 0.01 BTC each, filled at USD 80,000 per BTC,
            have a notional value of USD 1,600.


            **US offering:** Historical trades use the current contract size.


            Omitted when unavailable.
          type: string
          minLength: 1
          maxLength: 256
          pattern: ^[0-9]+(\.[0-9]+)?$
          example: '1325.8'
        fee:
          description: >-
            Fee charged for this trade in the instrument's quote asset. Excludes
            funding payments. A negative value is a rebate.
          type: string
          example: '2.10'
        realized_pnl:
          description: >-
            **Available only for the International/EEA offering.**


            Realized PnL from this trade, in the instrument's quote asset.
            Excludes fees and funding. Omitted when unavailable.
          type: string
          minLength: 1
          maxLength: 256
          pattern: ^-?[0-9]+(\.[0-9]+)?$
          example: '-12.5'
        executed_at:
          description: Time the trade was executed.
          type: string
          format: date-time
          example: '2026-08-03T10:00:02.124Z'
    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
    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
    AccountId:
      description: Globally unique public identifier for an account.
      type: string
      minLength: 14
      maxLength: 42
    TradingTrades_AssetType:
      description: Classification of the trading instrument.
      type: string
      enum:
        - perpetual
    TradingTrades_ClientOrderId:
      description: Partner-provided reference for tracking an order.
      type: string
      format: uuid
      example: 550e8400-e29b-41d4-a716-446655440000
    TradingTrades_OrderSide:
      description: Direction of the order.
      type: string
      enum:
        - buy
        - sell
    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]+)?$
    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
    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
  examples:
    spot-derivatives-unauthenticated:
      summary: Authentication required
      value:
        error:
          type: derivatives_error
          status: 401
          instance: 4bf92f3577b34da6a3ce929d0e0e4736
          code: unauthenticated
    spot-derivatives-gateway-unauthenticated:
      summary: Gateway authentication failed
      value:
        error:
          type: service_error
          status: 401
          instance: 4bf92f3577b34da6a3ce929d0e0e4736
          code: gateway
    spot-derivatives-forbidden:
      summary: Access denied
      value:
        error:
          type: derivatives_error
          status: 403
          instance: 4bf92f3577b34da6a3ce929d0e0e4736
          code: forbidden
    spot-derivatives-gateway-forbidden:
      summary: Gateway access denied
      value:
        error:
          type: service_error
          status: 403
          instance: 4bf92f3577b34da6a3ce929d0e0e4736
          code: gateway
    spot-derivatives-resource-exhausted:
      summary: Rate limit exceeded
      value:
        error:
          type: derivatives_error
          status: 429
          instance: 4bf92f3577b34da6a3ce929d0e0e4736
          code: resource_exhausted
    spot-derivatives-internal:
      summary: Internal service error
      value:
        error:
          type: derivatives_error
          status: 500
          instance: 4bf92f3577b34da6a3ce929d0e0e4736
          code: internal
    spot-derivatives-unavailable:
      summary: Service unavailable
      value:
        error:
          type: derivatives_error
          status: 503
          instance: 4bf92f3577b34da6a3ce929d0e0e4736
          code: unavailable
    spot-derivatives-deadline-exceeded:
      summary: Request deadline exceeded
      value:
        error:
          type: derivatives_error
          status: 504
          instance: 4bf92f3577b34da6a3ce929d0e0e4736
          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 API secret.
    ApiTimestamp:
      type: apiKey
      in: header
      name: API-Timestamp
      description: >-
        Time the request was signed, as Unix milliseconds. Included in the
        request signature. Requests signed too far from the server's time are
        rejected.

````