# Code generated by redocly bundle from api.yml. DO NOT EDIT.
openapi: 3.0.0
info:
  title: REST API
  version: '2026-07-15'
  description: Public REST API for interacting with UDX as a member. Every request resolves to a specific, dated API version via the UDX-Version header; omit it and you get the oldest version this API has ever shipped, so an integration that never sets it keeps working exactly as it always has.
servers:
  - url: https://{hostname}
    description: UDX REST endpoint supplied during member onboarding.
    variables:
      hostname:
        default: api.example.com
        description: Replace with the hostname supplied by UDX for the target environment.
security:
  - signatureKeyId: []
    signatureTimestamp: []
    signature: []
  - bearerAuth: []
tags:
  - name: Users
    description: Interactive user session bootstrap.
  - name: API Keys
    description: Programmatic credential management.
  - name: Rate Limits
    description: The authenticated member's REST request capacity.
  - name: Markets
    description: Market catalog, order books, candlesticks, and trades.
  - name: Combos
    description: Multi-leg markets.
  - name: Orders
    description: Place, amend, cancel, and query orders.
  - name: RFQs
    description: Request quotes from market makers.
  - name: Quotes
    description: Respond to RFQs and manage quotes.
  - name: Portfolio
    description: Account balances, positions, fills, settlements, accounts, and transfers.
paths:
  /users/me:
    get:
      summary: Get the Current User
      tags:
        - Users
      operationId: getCurrentUser
      description: Returns the caller's current UDX user and member details, including the pseudonymous `rfq_participant_id` the user is known by to RFQ counterparties. Accepts an interactive bearer session or an API key with the `read` scope; an API key resolves to the user that owns it.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
      responses:
        '200':
          description: The active direct-access user.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserResponse'
              example:
                user:
                  id: '7391077406361930804'
                  member_id: '3517456229634185646'
                  rfq_participant_id: 4d127cce3bc675c9
        '401':
          description: No valid credential was provided.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                title: Unauthorized
                status: 401
                detail: invalid authentication credentials
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '403':
          description: The identity is not admitted to direct UDX access, or the API key lacks the `read` scope.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                title: Forbidden
                status: 403
                detail: direct UDX access is not available
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '500':
          $ref: '#/components/responses/ErrInternal'
  /users:
    get:
      summary: List Users
      tags:
        - Users
      operationId: listUsers
      description: Returns the caller's member's users — the identities that can hold grants on the member's accounts.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - $ref: '#/components/parameters/PaginationLimit'
        - $ref: '#/components/parameters/PaginationPage'
        - $ref: '#/components/parameters/UsersSort'
        - $ref: '#/components/parameters/PaginationOrder'
      responses:
        '200':
          description: One page of the caller's member's users.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsersListResponse'
              examples:
                several_users:
                  summary: Multiple users
                  value:
                    users:
                      - id: '7391077406361930804'
                        status: active
                        created_at: '2026-07-15T12:00:00.000000Z'
                      - id: '1194626289313312742'
                        status: suspended
                        created_at: '2026-07-16T09:30:00.000000Z'
                    next_page_url: null
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '403':
          description: The credential lacks the `read` scope.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                title: Forbidden
                status: 403
                detail: insufficient permissions
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '429':
          $ref: '#/components/responses/MemberRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
  /api_keys:
    get:
      summary: List API Keys
      tags:
        - API Keys
      operationId: listAPIKeys
      description: Returns a page of the caller's own non-revoked API keys. Choose the initial page with limit, sort, and order. When next_page_url is non-null, follow that relative URL unchanged to retrieve the next page; it preserves the effective query and carries the opaque cursor. Requires the keys:manage scope.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - $ref: '#/components/parameters/PaginationLimit'
        - $ref: '#/components/parameters/PaginationPage'
        - $ref: '#/components/parameters/APIKeysSort'
        - $ref: '#/components/parameters/PaginationOrder'
      responses:
        '200':
          description: The caller's API keys.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIKeysListResponse'
              examples:
                empty:
                  summary: No API Keys yet
                  value:
                    api_keys: []
                    next_page_url: null
                several_keys:
                  summary: Multiple keys
                  value:
                    api_keys:
                      - id: '7425944046791590247'
                        name: readonly dashboard
                        scopes:
                          - read
                        account_id: '6820943174116859281'
                        created_at: '2026-06-15T09:30:00.000000Z'
                      - id: '3517456229634185646'
                        name: trading bot
                        scopes:
                          - read
                          - trade
                        account_id: null
                        created_at: '2026-06-01T12:00:00.000000Z'
                    next_page_url: /api_keys?limit=2&order=desc&page=eyJ2IjoxLCJzIjoiMjAyNi0wNi0wMVQxMjowMDowMC4wMDAwMDBaIiwiaWQiOiIzNTE3NDU2MjI5NjM0MTg1NjQ2In0&sort=created_at
        '400':
          description: Request doesn't conform to this spec.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              examples:
                malformed_request:
                  summary: Malformed request
                  value:
                    title: Bad Request
                    status: 400
                    detail: invalid request parameters
                    instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
                unknown_version:
                  summary: Unknown UDX-Version
                  value:
                    title: Bad Request
                    status: 400
                    detail: 'unknown UDX-Version "1999-01-01"; supported versions: 2026-07-15'
                    instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '401':
          description: No valid credential was provided.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              examples:
                invalid_credentials:
                  summary: Authentication failed
                  value:
                    title: Unauthorized
                    status: 401
                    detail: invalid authentication credentials
                    instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '403':
          description: The credential lacks the `keys:manage` scope.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                title: Forbidden
                status: 403
                detail: insufficient permissions
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '429':
          $ref: '#/components/responses/MemberRateLimitExceeded'
        '500':
          description: Something went wrong on UDX's side.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                title: Internal Server Error
                status: 500
                detail: internal error
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
    post:
      summary: Create an API Key
      tags:
        - API Keys
      operationId: createAPIKey
      description: Persists a new API key from a caller-supplied public key. The caller generates (or already holds) the keypair — UDX never receives the private key. The public key must be RSA with a modulus between 2048 and 4096 bits, inclusive.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - $ref: '#/components/parameters/IdempotencyKeyHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAPIKeyRequest'
            examples:
              unrestricted_key:
                summary: Unrestricted key
                value:
                  name: trading bot
                  public_key: |-
                    -----BEGIN PUBLIC KEY-----
                    MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs73XRQ6kA8x4YhlozC6B
                    F0+5iLfTU/MuYmvTCSaLH8/pgJBS+mggm5QeC0OkazwNMc1fzyx2n7OUFeN9Qm/M
                    fyELPozTSSvPGebwUhsKyOZGKtO92HsejU075xnVsYWiYU+OA6DDxc5tR4mhMxS3
                    DnHkwCQ1P2Z6SkaiYVQ2mMrGewT7TGlUYaZo+FI0svpJzMsJ5tNqjdh/9dsUC7WM
                    ATwMcoERX2Zb66ylk8dCw8rOoIE07/MTQfoH/z/++7rz+Jqt+KmnfKvSOOIr/WnE
                    RLuBnd7OyKq7uCLGcWGq79FEa1ToWNcHAsLReElUU0shkqjRjaD1iKm83zh4XLWf
                    gQIDAQAB
                    -----END PUBLIC KEY-----
                  scopes:
                    - read
                    - trade
              account_restricted_key:
                summary: Account-restricted key
                value:
                  name: readonly dashboard
                  public_key: |-
                    -----BEGIN PUBLIC KEY-----
                    MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs73XRQ6kA8x4YhlozC6B
                    F0+5iLfTU/MuYmvTCSaLH8/pgJBS+mggm5QeC0OkazwNMc1fzyx2n7OUFeN9Qm/M
                    fyELPozTSSvPGebwUhsKyOZGKtO92HsejU075xnVsYWiYU+OA6DDxc5tR4mhMxS3
                    DnHkwCQ1P2Z6SkaiYVQ2mMrGewT7TGlUYaZo+FI0svpJzMsJ5tNqjdh/9dsUC7WM
                    ATwMcoERX2Zb66ylk8dCw8rOoIE07/MTQfoH/z/++7rz+Jqt+KmnfKvSOOIr/WnE
                    RLuBnd7OyKq7uCLGcWGq79FEa1ToWNcHAsLReElUU0shkqjRjaD1iKm83zh4XLWf
                    gQIDAQAB
                    -----END PUBLIC KEY-----
                  scopes:
                    - read
                  account_id: '6820943174116859281'
      responses:
        '201':
          description: The created API key's metadata.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
            UDX-Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIKeyResponse'
              examples:
                unrestricted_key:
                  summary: Unrestricted key
                  value:
                    api_key:
                      id: '3517456229634185646'
                      name: trading bot
                      scopes:
                        - read
                        - trade
                      account_id: null
                      created_at: '2026-06-01T12:00:00.000000Z'
                account_restricted_key:
                  summary: Account-restricted key
                  value:
                    api_key:
                      id: '7425944046791590247'
                      name: readonly dashboard
                      scopes:
                        - read
                      account_id: '6820943174116859281'
                      created_at: '2026-06-15T09:30:00.000000Z'
        '400':
          description: Request doesn't conform to this spec.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              examples:
                malformed_public_key:
                  summary: Malformed or unsupported public key
                  value:
                    title: Bad Request
                    status: 400
                    detail: public_key must be a single PEM-encoded RSA public key with a modulus between 2048 and 4096 bits
                    instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
                missing_required_field:
                  summary: Missing required field
                  value:
                    title: Bad Request
                    status: 400
                    detail: invalid request parameters
                    instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
                malformed_json_body:
                  summary: Malformed JSON
                  value:
                    title: Bad Request
                    status: 400
                    detail: invalid request parameters
                    instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
                unknown_version:
                  summary: Unknown UDX-Version
                  value:
                    title: Bad Request
                    status: 400
                    detail: 'unknown UDX-Version "1999-01-01"; supported versions: 2026-07-15'
                    instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '401':
          description: No valid credential was provided.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              examples:
                invalid_credentials:
                  summary: Authentication failed
                  value:
                    title: Unauthorized
                    status: 401
                    detail: invalid authentication credentials
                    instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '403':
          description: The caller cannot access `account_id`, or the credential lacks the `keys:manage` scope.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              examples:
                account_access_denied:
                  summary: No Grant on the requested account_id
                  value:
                    title: Forbidden
                    status: 403
                    detail: account access denied
                    instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
                insufficient_permissions:
                  summary: Caller lacks keys:manage
                  value:
                    title: Forbidden
                    status: 403
                    detail: insufficient permissions
                    instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '409':
          $ref: '#/components/responses/IdempotencyInProgress'
        '422':
          $ref: '#/components/responses/IdempotencyKeyReused'
        '429':
          $ref: '#/components/responses/MutationRateLimitExceeded'
        '500':
          description: Something went wrong on UDX's side.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                title: Internal Server Error
                status: 500
                detail: internal error
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
  /api_keys/{id}:
    delete:
      summary: Revoke an API Key
      tags:
        - API Keys
      operationId: revokeAPIKey
      description: Soft-deletes an API key. The key stops appearing in list results and is rejected on its very next authenticated request. Revocation is permanent — a revoked key can never be reinstated. A key may always revoke itself without the keys:manage scope; revoking any other key requires it.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - $ref: '#/components/parameters/IdempotencyKeyHeader'
        - name: id
          in: path
          required: true
          description: The public identifier of the API key to revoke.
          schema:
            $ref: '#/components/schemas/EntityId'
      responses:
        '204':
          description: The key was revoked. No body is returned.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
            UDX-Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
        '401':
          description: No valid credential was provided.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              examples:
                invalid_credentials:
                  summary: Authentication failed
                  value:
                    title: Unauthorized
                    status: 401
                    detail: invalid authentication credentials
                    instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '403':
          description: The credential lacks the `keys:manage` scope.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                title: Forbidden
                status: 403
                detail: insufficient permissions
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '404':
          description: The API key doesn't exist or doesn't belong to the caller, or was already revoked.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                title: Not Found
                status: 404
                detail: api key not found
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '409':
          $ref: '#/components/responses/IdempotencyInProgress'
        '422':
          $ref: '#/components/responses/IdempotencyKeyReused'
        '429':
          $ref: '#/components/responses/MutationRateLimitExceeded'
        '500':
          description: Something went wrong on UDX's side.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                title: Internal Server Error
                status: 500
                detail: internal error
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
  /rate_limit_profile:
    get:
      summary: Get the Caller's Rate Limit Profile
      operationId: getRateLimitProfile
      tags:
        - Rate Limits
      description: 'Returns the authenticated member''s current rate limit profile: the read, write, and cancel bucket refill rate, capacity, and unit cost. Every user, account, and API key owned by the member shares this same capacity — creating another key does not increase it. See the rate limits guide for shared capacity and retry behavior.'
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
      responses:
        '200':
          description: The caller's current member rate limit profile.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitProfileResponse'
              example:
                rate_limit_profile:
                  profile_key: tier_0
                  profile_version: 1
                  buckets:
                    - bucket: read
                      refill_tokens_per_minute: 900
                      capacity: 30
                      unit_cost: 1
                    - bucket: write
                      refill_tokens_per_minute: 450
                      capacity: 15
                      unit_cost: 1
                    - bucket: cancel
                      refill_tokens_per_minute: 150
                      capacity: 5
                      unit_cost: 1
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '429':
          $ref: '#/components/responses/MemberRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
  /markets:
    get:
      summary: List Markets
      operationId: listMarkets
      tags:
        - Markets
      description: Returns a page of markets. Choose the initial page with limit, sort, and order; when next_page_url is non-null, follow that relative URL unchanged for the next page.
      security: []
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - $ref: '#/components/parameters/PaginationLimit'
        - $ref: '#/components/parameters/PaginationPage'
        - $ref: '#/components/parameters/MarketsSort'
        - $ref: '#/components/parameters/PaginationOrder'
      responses:
        '200':
          description: A page of markets.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
            Cache-Control:
              $ref: '#/components/headers/PublicMarketCache'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarketsListResponse'
              examples:
                several_markets:
                  summary: A page of markets
                  value:
                    markets:
                      - ticker: UDX-EXAMPLE-MARKET
                        event_ticker: UDX-EXAMPLE-EVENT
                        description: Will the example resolve YES?
                        status: open
                        event_date: '2026-06-21'
                        tick_size: '0.01'
                        minimum_price: '0.01'
                        maximum_price: '0.99'
                        expires_at: '2026-06-21T00:00:00.000000Z'
                        volume: '12500'
                        open_interest: '3400'
                    next_page_url: /markets?limit=10&order=asc&page=eyJ2IjoxfQ&sort=event_date
                empty:
                  summary: No markets
                  value:
                    markets: []
                    next_page_url: null
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '429':
          $ref: '#/components/responses/UnauthenticatedRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
  /markets/{ticker}:
    get:
      summary: Get a Market
      operationId: getMarket
      tags:
        - Markets
      description: Returns one market and its current status by ticker.
      security: []
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - name: ticker
          in: path
          required: true
          description: The market's ticker.
          schema:
            $ref: '#/components/schemas/Ticker'
      responses:
        '200':
          description: The requested market.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
            Cache-Control:
              $ref: '#/components/headers/PublicMarketCache'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarketResponse'
              example:
                market:
                  ticker: UDX-EXAMPLE-MARKET
                  event_ticker: UDX-EXAMPLE-EVENT
                  description: Will the example resolve YES?
                  status: open
                  event_date: '2026-06-21'
                  tick_size: '0.01'
                  minimum_price: '0.01'
                  maximum_price: '0.99'
                  expires_at: '2026-06-21T00:00:00.000000Z'
                  volume: '12500'
                  open_interest: '3400'
        '404':
          $ref: '#/components/responses/ErrNotFound'
        '429':
          $ref: '#/components/responses/UnauthenticatedRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
  /markets/{ticker}/orderbook:
    get:
      summary: Get a Market's Order Book
      operationId: getMarketOrderbook
      tags:
        - Markets
      description: Returns the current aggregated order book (price levels) for a market, priced from the YES side.
      security: []
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - name: ticker
          in: path
          required: true
          description: The market's ticker.
          schema:
            $ref: '#/components/schemas/Ticker'
        - name: depth
          in: query
          required: false
          description: Maximum number of price levels to return per side.
          schema:
            type: integer
            format: int32
            minimum: 1
            maximum: 1000
            description: Levels per side.
            example: 10
      responses:
        '200':
          description: The market's aggregated order book.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
            Cache-Control:
              $ref: '#/components/headers/LiveMarketDataNoStore'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderbookResponse'
              example:
                orderbook:
                  ticker: UDX-EXAMPLE-MARKET
                  bids:
                    - - '0.54'
                      - '120'
                    - - '0.53'
                      - '300'
                  asks:
                    - - '0.56'
                      - '80'
                    - - '0.57'
                      - '250'
        '404':
          $ref: '#/components/responses/ErrNotFound'
        '429':
          $ref: '#/components/responses/UnauthenticatedRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
  /markets/{ticker}/candlesticks:
    get:
      summary: Get a Market's Candlesticks
      operationId: getMarketCandlesticks
      tags:
        - Markets
      description: Returns historical OHLC (open/high/low/close) price candlesticks for a market over a time range, bucketed into fixed-duration periods.
      security: []
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - name: ticker
          in: path
          required: true
          description: The market's ticker.
          schema:
            $ref: '#/components/schemas/Ticker'
        - name: period_ends_after
          in: query
          required: true
          description: Only return periods ending after this instant.
          schema:
            type: string
            format: date-time
            maxLength: 40
            description: An exclusive lower bound for the period end. UDX timestamps use RFC 3339; requests require an explicit UTC offset and zero to six fractional digits; responses use UTC with exactly six fractional digits.
            example: '2026-01-01T00:00:00.000000Z'
        - name: period_ends_before
          in: query
          required: true
          description: Only return periods ending before this instant.
          schema:
            type: string
            format: date-time
            maxLength: 40
            description: An exclusive upper bound for the period end. UDX timestamps use RFC 3339; requests require an explicit UTC offset and zero to six fractional digits; responses use UTC with exactly six fractional digits.
            example: '2026-01-31T23:59:59.000000Z'
        - name: period_interval
          in: query
          required: true
          description: 'Candlestick period length: 1m, 1h, or 1d.'
          schema:
            type: string
            enum:
              - 1m
              - 1h
              - 1d
            description: Period length.
            example: 1h
        - $ref: '#/components/parameters/PaginationLimit'
        - $ref: '#/components/parameters/PaginationPage'
        - $ref: '#/components/parameters/CandlesticksSort'
        - $ref: '#/components/parameters/PaginationOrder'
      responses:
        '200':
          description: A page of candlesticks for the market.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CandlesticksListResponse'
              example:
                candlesticks:
                  - period_ends_at: '2026-01-01T00:01:00.000000Z'
                    open: '0.54'
                    high: '0.56'
                    low: '0.53'
                    close: '0.55'
                    volume: '420'
                    trade_count: 12
                next_page_url: null
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '404':
          $ref: '#/components/responses/ErrNotFound'
        '429':
          $ref: '#/components/responses/UnauthenticatedRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
  /markets/{ticker}/trades:
    get:
      summary: Get a Market's Recent Trades
      operationId: getMarketTrades
      tags:
        - Markets
      description: Returns recent public trades for a market, newest first.
      security: []
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - name: ticker
          in: path
          required: true
          description: The market's ticker.
          schema:
            $ref: '#/components/schemas/Ticker'
        - name: executed_after
          in: query
          required: false
          description: Only return trades executed after this instant.
          schema:
            $ref: '#/components/schemas/TimestampRangeAfter'
        - name: executed_before
          in: query
          required: false
          description: Only return trades executed before this instant.
          schema:
            $ref: '#/components/schemas/TimestampRangeBefore'
        - $ref: '#/components/parameters/PaginationLimit'
        - $ref: '#/components/parameters/PaginationPage'
        - $ref: '#/components/parameters/TradesSort'
        - $ref: '#/components/parameters/PaginationOrder'
      responses:
        '200':
          description: A page of recent trades for the market.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
            Cache-Control:
              $ref: '#/components/headers/LiveMarketDataNoStore'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TradesListResponse'
              example:
                trades:
                  - trade_id: BP1ZQ131E04J
                    ticker: UDX-EXAMPLE-MARKET
                    price: '0.55'
                    quantity: '40'
                    taker_side: buy
                    executed_at: '2026-01-01T00:00:00.000000Z'
                next_page_url: null
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '404':
          $ref: '#/components/responses/ErrNotFound'
        '429':
          $ref: '#/components/responses/UnauthenticatedRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
  /combos:
    get:
      summary: List Combos
      operationId: listCombos
      tags:
        - Combos
      description: Returns a page of multi-leg (combo) markets — markets composed of two or more legs.
      security: []
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - $ref: '#/components/parameters/PaginationLimit'
        - $ref: '#/components/parameters/PaginationPage'
        - $ref: '#/components/parameters/CombosSort'
        - $ref: '#/components/parameters/PaginationOrder'
      responses:
        '200':
          description: A page of combo markets.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
            Cache-Control:
              $ref: '#/components/headers/PublicMarketCache'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CombosListResponse'
              example:
                combos:
                  - ticker: UDX-EXAMPLE-COMBO
                    event_ticker: UDX-EXAMPLE-EVENT
                    description: A two-leg example combo.
                    status: open
                    event_date: '2026-06-21'
                    tick_size: '0.01'
                    minimum_price: '0.01'
                    maximum_price: '0.99'
                    expires_at: '2026-06-21T00:00:00.000000Z'
                    volume: '500'
                    open_interest: '120'
                    legs:
                      - ticker: UDX-EXAMPLE-MARKET-A
                        opposing_side: false
                      - ticker: UDX-EXAMPLE-MARKET-B
                        opposing_side: true
                next_page_url: null
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '429':
          $ref: '#/components/responses/UnauthenticatedRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
  /combos/{ticker}:
    get:
      summary: Get a Combo
      operationId: getCombo
      tags:
        - Combos
      description: Returns a single multi-leg (combo) market by ticker. Returns 404 if the ticker is not a multi-leg market.
      security: []
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - name: ticker
          in: path
          required: true
          description: The combo market's ticker.
          schema:
            $ref: '#/components/schemas/Ticker'
      responses:
        '200':
          description: The combo market.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
            Cache-Control:
              $ref: '#/components/headers/PublicMarketCache'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ComboResponse'
              example:
                combo:
                  ticker: UDX-EXAMPLE-COMBO
                  event_ticker: UDX-EXAMPLE-EVENT
                  description: A two-leg example combo.
                  status: open
                  event_date: '2026-06-21'
                  tick_size: '0.01'
                  minimum_price: '0.01'
                  maximum_price: '0.99'
                  expires_at: '2026-06-21T00:00:00.000000Z'
                  volume: '500'
                  open_interest: '120'
                  legs:
                    - ticker: UDX-EXAMPLE-MARKET-A
                      opposing_side: false
                    - ticker: UDX-EXAMPLE-MARKET-B
                      opposing_side: true
        '404':
          $ref: '#/components/responses/ErrNotFound'
        '429':
          $ref: '#/components/responses/UnauthenticatedRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
  /orders:
    get:
      summary: List Orders
      operationId: listOrders
      tags:
        - Orders
      description: Returns a page of the caller's orders, optionally filtered.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - name: ticker
          in: query
          required: false
          description: Filter by market ticker.
          schema:
            $ref: '#/components/schemas/Ticker'
        - name: status
          in: query
          required: false
          description: Filter by order status.
          schema:
            $ref: '#/components/schemas/OrderStatusFilter'
        - name: created_after
          in: query
          required: false
          description: Only return orders created after this instant.
          schema:
            $ref: '#/components/schemas/TimestampRangeAfter'
        - name: created_before
          in: query
          required: false
          description: Only return orders created before this instant.
          schema:
            $ref: '#/components/schemas/TimestampRangeBefore'
        - $ref: '#/components/parameters/PaginationLimit'
        - $ref: '#/components/parameters/PaginationPage'
        - $ref: '#/components/parameters/OrdersSort'
        - $ref: '#/components/parameters/PaginationOrder'
      responses:
        '200':
          description: A page of the caller's orders.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrdersListResponse'
              example:
                orders:
                  - order_id: BK9BZNTK8022
                    client_order_id: order-20260804-001
                    ticker: UDX-EXAMPLE-MARKET
                    side: buy
                    quantity: '100'
                    price: '0.55'
                    time_in_force: gtc
                    status: partially_filled
                    filled_quantity: '40'
                    remaining_quantity: '60'
                    average_fill_price: '0.54'
                    fees_paid: '0.22'
                    created_at: '2026-01-01T00:00:00.000000Z'
                next_page_url: null
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '403':
          description: The credential lacks the `read` scope.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              examples:
                insufficient_permissions:
                  summary: Caller lacks the read scope
                  value:
                    title: Forbidden
                    status: 403
                    detail: insufficient permissions
                    instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '422':
          $ref: '#/components/responses/OrderHistoryRangeTooBroad'
        '429':
          $ref: '#/components/responses/MemberRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/PublicReadUnavailable'
    post:
      summary: Place an Order
      operationId: createOrder
      tags:
        - Orders
      description: Submits a new order. It matches against the resting book immediately; any unfilled remainder rests per the requested time in force.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - $ref: '#/components/parameters/IdempotencyKeyHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOrderRequest'
            example:
              ticker: UDX-EXAMPLE-MARKET
              client_order_id: order-20260804-001
              side: buy
              quantity: '100'
              price: '0.55'
              time_in_force: gtc
      responses:
        '201':
          description: The placed order.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
            UDX-Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderResponse'
              example:
                order:
                  order_id: BK9BZNTK8022
                  client_order_id: order-20260804-001
                  ticker: UDX-EXAMPLE-MARKET
                  side: buy
                  quantity: '100'
                  price: '0.55'
                  time_in_force: gtc
                  status: resting
                  filled_quantity: '0'
                  remaining_quantity: '100'
                  fees_paid: '0'
                  created_at: '2026-01-01T00:00:00.000000Z'
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '403':
          description: The credential lacks the `trade` scope.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              examples:
                insufficient_permissions:
                  summary: Caller lacks the trade scope
                  value:
                    title: Forbidden
                    status: 403
                    detail: insufficient permissions
                    instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '409':
          $ref: '#/components/responses/IdempotencyInProgress'
        '422':
          $ref: '#/components/responses/IdempotencyKeyReused'
        '429':
          $ref: '#/components/responses/MutationRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
  /orders/{order_id}:
    get:
      summary: Get an Order
      operationId: getOrder
      tags:
        - Orders
      description: Returns one of the caller's orders by its exchange id.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - name: order_id
          in: path
          required: true
          description: Exchange-assigned order identifier.
          schema:
            $ref: '#/components/schemas/ExchangeId'
      responses:
        '200':
          description: The requested order.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderResponse'
              example:
                order:
                  order_id: BK9BZNTK8022
                  client_order_id: order-20260804-001
                  ticker: UDX-EXAMPLE-MARKET
                  side: buy
                  quantity: '100'
                  price: '0.55'
                  time_in_force: gtc
                  status: filled
                  filled_quantity: '100'
                  remaining_quantity: '0'
                  average_fill_price: '0.55'
                  fees_paid: '0.55'
                  created_at: '2026-01-01T00:00:00.000000Z'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '403':
          description: The credential lacks the `read` scope.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              examples:
                insufficient_permissions:
                  summary: Caller lacks the read scope
                  value:
                    title: Forbidden
                    status: 403
                    detail: insufficient permissions
                    instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '404':
          $ref: '#/components/responses/ErrNotFound'
        '429':
          $ref: '#/components/responses/MemberRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
    delete:
      summary: Cancel an Order
      operationId: cancelOrder
      tags:
        - Orders
      description: Cancels a resting order. Returns the order in its canceled state.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - $ref: '#/components/parameters/IdempotencyKeyHeader'
        - name: order_id
          in: path
          required: true
          description: Exchange-assigned order identifier.
          schema:
            $ref: '#/components/schemas/ExchangeId'
        - name: ticker
          in: query
          required: true
          description: The market ticker the order belongs to.
          schema:
            $ref: '#/components/schemas/Ticker'
      responses:
        '200':
          description: The canceled order.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
            UDX-Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderResponse'
              example:
                order:
                  order_id: BK9BZNTK8022
                  client_order_id: order-20260804-001
                  ticker: UDX-EXAMPLE-MARKET
                  side: buy
                  quantity: '100'
                  price: '0.55'
                  time_in_force: gtc
                  status: canceled
                  filled_quantity: '0'
                  remaining_quantity: '0'
                  fees_paid: '0'
                  created_at: '2026-01-01T00:00:00.000000Z'
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '404':
          $ref: '#/components/responses/ErrNotFound'
        '409':
          $ref: '#/components/responses/IdempotencyInProgress'
        '422':
          $ref: '#/components/responses/IdempotencyKeyReused'
        '429':
          $ref: '#/components/responses/MutationRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
  /orders/{order_id}/amend:
    post:
      summary: Amend an Order
      operationId: amendOrder
      tags:
        - Orders
      description: Amends a resting order in place, changing its price and/or quantity. Side and time in force are unchanged. Queue priority is preserved only when quantity strictly decreases at an unchanged price.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - $ref: '#/components/parameters/IdempotencyKeyHeader'
        - name: order_id
          in: path
          required: true
          description: Exchange-assigned order identifier.
          schema:
            $ref: '#/components/schemas/ExchangeId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AmendOrderRequest'
            example:
              ticker: UDX-EXAMPLE-MARKET
              quantity: '80'
              price: '0.56'
      responses:
        '200':
          description: The amended order.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
            UDX-Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderResponse'
              example:
                order:
                  order_id: BK9BZNTK8022
                  client_order_id: order-20260804-001
                  ticker: UDX-EXAMPLE-MARKET
                  side: buy
                  quantity: '80'
                  price: '0.56'
                  time_in_force: gtc
                  status: resting
                  filled_quantity: '0'
                  remaining_quantity: '80'
                  fees_paid: '0'
                  created_at: '2026-01-01T00:00:00.000000Z'
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '404':
          $ref: '#/components/responses/ErrNotFound'
        '409':
          $ref: '#/components/responses/IdempotencyInProgress'
        '422':
          $ref: '#/components/responses/IdempotencyKeyReused'
        '429':
          $ref: '#/components/responses/MutationRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
  /rfqs:
    get:
      summary: List RFQs
      operationId: listRfqs
      tags:
        - RFQs
      description: 'Returns a page of the RFQs visible to the caller''s member, optionally filtered: RFQs the member raised and RFQs soliciting quotes from it. Filter by requester_id to one requester — your own rfq_participant_id for RFQs you raised, or another requester''s to watch their solicitations. An RFQ the caller''s member did not raise omits client_rfq_id (the requester''s private correlation id); quote it with createQuote before its expires_at deadline.'
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - name: requester_id
          in: query
          required: false
          description: Filter by a requester's pseudonymous participant identifier, as carried in requester_id on each RFQ. Use your own rfq_participant_id from GET /users/me to see just the RFQs you raised.
          schema:
            $ref: '#/components/schemas/RfqParticipantId'
        - name: ticker
          in: query
          required: false
          description: Filter by market ticker (single-leg RFQs).
          schema:
            $ref: '#/components/schemas/Ticker'
        - name: status
          in: query
          required: false
          description: Filter by RFQ status.
          schema:
            $ref: '#/components/schemas/RfqStatus'
        - name: created_after
          in: query
          required: false
          description: Only return RFQs created after this instant.
          schema:
            $ref: '#/components/schemas/TimestampRangeAfter'
        - name: created_before
          in: query
          required: false
          description: Only return RFQs created before this instant.
          schema:
            $ref: '#/components/schemas/TimestampRangeBefore'
        - $ref: '#/components/parameters/PaginationLimit'
        - $ref: '#/components/parameters/PaginationPage'
        - $ref: '#/components/parameters/RfqsSort'
        - $ref: '#/components/parameters/PaginationOrder'
      responses:
        '200':
          description: A page of the RFQs visible to the caller's member.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RfqsListResponse'
              example:
                rfqs:
                  - rfq_id: BKA2QM3T4055
                    requester_id: 4d127cce3bc675c9
                    client_rfq_id: rfq-20260804-001
                    legs:
                      - ticker: UDX-EXAMPLE-MARKET
                        opposing_side: false
                    side: buy
                    quantity: '100'
                    status: open
                    created_at: '2026-01-01T00:00:00.000000Z'
                    expires_at: '2026-01-01T00:01:00.000000Z'
                  - rfq_id: BKA2QM3T4099
                    requester_id: 9a51f00d21be44c7
                    legs:
                      - ticker: UDX-EXAMPLE-MARKET
                        opposing_side: false
                    side: sell
                    quantity: '250'
                    status: open
                    created_at: '2026-01-01T00:00:30.000000Z'
                    expires_at: '2026-01-01T00:01:30.000000Z'
                next_page_url: null
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '403':
          description: The credential lacks the `read` scope.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              examples:
                insufficient_permissions:
                  summary: Caller lacks the read scope
                  value:
                    title: Forbidden
                    status: 403
                    detail: insufficient permissions
                    instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '422':
          $ref: '#/components/responses/RfqHistoryRangeTooBroad'
        '429':
          $ref: '#/components/responses/MemberRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/PublicReadUnavailable'
    post:
      summary: Create an RFQ
      operationId: createRfq
      tags:
        - RFQs
      description: Creates a request for quote, soliciting pricing from market makers for one or more legs. Omit side for a two-sided quote.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - $ref: '#/components/parameters/IdempotencyKeyHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRfqRequest'
            example:
              client_rfq_id: rfq-20260804-001
              ticker: UDX-EXAMPLE-MARKET
              quantity: '100'
              side: buy
      responses:
        '201':
          description: The created RFQ.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
            UDX-Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RfqResponse'
              example:
                rfq:
                  rfq_id: BKA2QM3T4055
                  client_rfq_id: rfq-20260804-001
                  legs:
                    - ticker: UDX-EXAMPLE-MARKET
                      opposing_side: false
                  side: buy
                  quantity: '100'
                  status: open
                  created_at: '2026-01-01T00:00:00.000000Z'
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '403':
          description: The credential lacks the `trade` scope.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              examples:
                insufficient_permissions:
                  summary: Caller lacks the trade scope
                  value:
                    title: Forbidden
                    status: 403
                    detail: insufficient permissions
                    instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '409':
          $ref: '#/components/responses/IdempotencyInProgress'
        '422':
          $ref: '#/components/responses/IdempotencyKeyReused'
        '429':
          $ref: '#/components/responses/MutationRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
  /rfqs/{rfq_id}:
    get:
      summary: Get an RFQ
      operationId: getRfq
      tags:
        - RFQs
      description: Returns one RFQ visible to the caller's member by its exchange id — one the member raised, or one soliciting quotes from it.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - name: rfq_id
          in: path
          required: true
          description: Exchange-assigned RFQ identifier.
          schema:
            $ref: '#/components/schemas/ExchangeId'
      responses:
        '200':
          description: The requested RFQ.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RfqResponse'
              example:
                rfq:
                  rfq_id: BKA2QM3T4055
                  client_rfq_id: rfq-20260804-001
                  legs:
                    - ticker: UDX-EXAMPLE-MARKET
                      opposing_side: false
                  side: buy
                  quantity: '100'
                  status: open
                  created_at: '2026-01-01T00:00:00.000000Z'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '403':
          description: The credential lacks the `read` scope.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              examples:
                insufficient_permissions:
                  summary: Caller lacks the read scope
                  value:
                    title: Forbidden
                    status: 403
                    detail: insufficient permissions
                    instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '404':
          $ref: '#/components/responses/ErrNotFound'
        '429':
          $ref: '#/components/responses/MemberRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
  /quotes:
    get:
      summary: List Quotes
      operationId: listQuotes
      tags:
        - Quotes
      description: Returns a page of the caller's quotes, optionally filtered. Each quote is single-sided (a bid or an offer) and identifies both RFQ participants with pseudonymous participant IDs.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - name: rfq_id
          in: query
          required: false
          description: Filter by the RFQ the quotes respond to.
          schema:
            $ref: '#/components/schemas/ExchangeId'
        - name: ticker
          in: query
          required: false
          description: Filter by market ticker.
          schema:
            $ref: '#/components/schemas/Ticker'
        - name: status
          in: query
          required: false
          description: Filter by quote status.
          schema:
            $ref: '#/components/schemas/QuoteStatus'
        - name: created_after
          in: query
          required: false
          description: Only return quotes created after this instant.
          schema:
            $ref: '#/components/schemas/TimestampRangeAfter'
        - name: created_before
          in: query
          required: false
          description: Only return quotes created before this instant.
          schema:
            $ref: '#/components/schemas/TimestampRangeBefore'
        - $ref: '#/components/parameters/PaginationLimit'
        - $ref: '#/components/parameters/PaginationPage'
        - $ref: '#/components/parameters/QuotesSort'
        - $ref: '#/components/parameters/PaginationOrder'
      responses:
        '200':
          description: A page of the caller's quotes.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuotesListResponse'
              example:
                quotes:
                  - quote_id: BKQ7V2M9T081
                    client_quote_id: quote-20260804-001
                    requester_id: 4d127cce3bc675c9
                    quoter_id: 9a51f00d21be44c7
                    rfq_id: BKA2QM3T4055
                    ticker: UDX-EXAMPLE-MARKET
                    side: sell
                    price: '0.56'
                    quantity: '100'
                    status: open
                    created_at: '2026-01-01T00:00:00.000000Z'
                next_page_url: null
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '403':
          description: The credential lacks the `read` scope.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                title: Forbidden
                status: 403
                detail: insufficient permissions
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '422':
          $ref: '#/components/responses/QuoteHistoryRangeTooBroad'
        '429':
          $ref: '#/components/responses/MemberRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
    post:
      summary: Create a Quote
      operationId: createQuote
      tags:
        - Quotes
      description: Submits a single-sided quote (a bid or an offer) in response to an RFQ. To quote both sides, submit two quotes with distinct client_quote_ids. The response identifies both RFQ participants with pseudonymous participant IDs.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - $ref: '#/components/parameters/IdempotencyKeyHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateQuoteRequest'
            example:
              rfq_id: BKA2QM3T4055
              ticker: UDX-EXAMPLE-MARKET
              client_quote_id: quote-20260804-001
              side: sell
              price: '0.56'
              quantity: '100'
      responses:
        '201':
          description: The created quote.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
            UDX-Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuoteResponse'
              example:
                quote:
                  quote_id: BKQ7V2M9T081
                  client_quote_id: quote-20260804-001
                  requester_id: 4d127cce3bc675c9
                  quoter_id: 9a51f00d21be44c7
                  rfq_id: BKA2QM3T4055
                  ticker: UDX-EXAMPLE-MARKET
                  side: sell
                  price: '0.56'
                  quantity: '100'
                  status: open
                  created_at: '2026-01-01T00:00:00.000000Z'
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '403':
          description: The credential lacks the `trade` scope.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              examples:
                insufficient_permissions:
                  summary: Caller lacks the trade scope
                  value:
                    title: Forbidden
                    status: 403
                    detail: insufficient permissions
                    instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '409':
          $ref: '#/components/responses/IdempotencyInProgress'
        '422':
          $ref: '#/components/responses/IdempotencyKeyReused'
        '429':
          $ref: '#/components/responses/MutationRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
  /quotes/{client_quote_id}:
    get:
      summary: Get a Quote
      operationId: getQuote
      tags:
        - Quotes
      description: Returns one of the caller's quotes by its client_quote_id, including pseudonymous participant IDs for the RFQ requester and quote submitter.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - name: client_quote_id
          in: path
          required: true
          description: The caller's correlation id for the quote.
          schema:
            $ref: '#/components/schemas/ClientId'
      responses:
        '200':
          description: The requested quote.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuoteResponse'
              example:
                quote:
                  quote_id: BKQ7V2M9T081
                  client_quote_id: quote-20260804-001
                  requester_id: 4d127cce3bc675c9
                  quoter_id: 9a51f00d21be44c7
                  rfq_id: BKA2QM3T4055
                  ticker: UDX-EXAMPLE-MARKET
                  side: sell
                  price: '0.56'
                  quantity: '100'
                  status: accepted
                  created_at: '2026-01-01T00:00:00.000000Z'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '403':
          description: The credential lacks the `read` scope.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                title: Forbidden
                status: 403
                detail: insufficient permissions
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '404':
          $ref: '#/components/responses/ErrNotFound'
        '429':
          $ref: '#/components/responses/MemberRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
    delete:
      summary: Cancel a Quote
      operationId: cancelQuote
      tags:
        - Quotes
      description: Pulls a quote from the exchange. Returns the quote as it was at cancellation, including pseudonymous participant IDs for the RFQ requester and quote submitter.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - $ref: '#/components/parameters/IdempotencyKeyHeader'
        - name: client_quote_id
          in: path
          required: true
          description: The caller's correlation id for the quote.
          schema:
            $ref: '#/components/schemas/ClientId'
      responses:
        '200':
          description: The canceled quote.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
            UDX-Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuoteResponse'
              example:
                quote:
                  quote_id: BKQ7V2M9T081
                  client_quote_id: quote-20260804-001
                  requester_id: 4d127cce3bc675c9
                  quoter_id: 9a51f00d21be44c7
                  rfq_id: BKA2QM3T4055
                  ticker: UDX-EXAMPLE-MARKET
                  side: sell
                  price: '0.56'
                  quantity: '100'
                  status: cancelled
                  created_at: '2026-01-01T00:00:00.000000Z'
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '403':
          description: The credential lacks the `trade` scope.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              examples:
                insufficient_permissions:
                  summary: Caller lacks the trade scope
                  value:
                    title: Forbidden
                    status: 403
                    detail: insufficient permissions
                    instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '404':
          $ref: '#/components/responses/ErrNotFound'
        '409':
          $ref: '#/components/responses/IdempotencyInProgress'
        '422':
          $ref: '#/components/responses/IdempotencyKeyReused'
        '429':
          $ref: '#/components/responses/MutationRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
  /quotes/{quote_id}/accept:
    post:
      summary: Accept a Quote
      operationId: acceptQuote
      tags:
        - Quotes
      description: 'Accepts a quote by trading against it, as the RFQ initiator (the taker). The quote is addressed by its exchange-assigned quote_id (the path) and its rfq_id (the body) — the pair the taker learns when the quote is delivered, not the maker''s private client_quote_id. side is the side you execute and must be opposite the quote''s side (buy lifts an offer, sell hits a bid); price and quantity must match the quote''s terms. Returns 204 with no body. Acceptance opens the maker''s last-look window: if the maker confirms, the trade completes and appears in get-fills, correlated by the client_order_id you supply; if the maker rejects or the window times out, the quote is rejected and the trade does not execute.'
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - $ref: '#/components/parameters/IdempotencyKeyHeader'
        - name: quote_id
          in: path
          required: true
          description: The exchange-assigned identifier of the quote to accept.
          schema:
            $ref: '#/components/schemas/ExchangeId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AcceptQuoteRequest'
            example:
              rfq_id: BKA2QM3T4055
              side: sell
              price: '0.56'
              quantity: '100'
              client_order_id: order-20260804-001
      responses:
        '204':
          description: The accept was submitted. No body is returned. If the maker confirms during last look, the trade appears in get-fills, correlated by the client_order_id you supplied. If the maker rejects or last look times out, the quote is rejected and the trade does not execute.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
            UDX-Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '403':
          description: The credential lacks the `trade` scope.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              examples:
                insufficient_permissions:
                  summary: Caller lacks the trade scope
                  value:
                    title: Forbidden
                    status: 403
                    detail: insufficient permissions
                    instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '404':
          $ref: '#/components/responses/ErrNotFound'
        '409':
          $ref: '#/components/responses/IdempotencyInProgress'
        '422':
          $ref: '#/components/responses/IdempotencyKeyReused'
        '429':
          $ref: '#/components/responses/MutationRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
  /quotes/{client_quote_id}/reject:
    post:
      summary: Reject an Accepted Quote
      operationId: rejectAcceptedQuote
      tags:
        - Quotes
      description: Rejects a quote after a taker accepts it but before the trade executes, releasing the maker from the quote for the given client_quote_id.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - $ref: '#/components/parameters/IdempotencyKeyHeader'
        - name: client_quote_id
          in: path
          required: true
          description: The caller's correlation id for the quote.
          schema:
            $ref: '#/components/schemas/ClientId'
      responses:
        '204':
          description: The quote was rejected and pulled. No body is returned.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
            UDX-Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '403':
          description: The credential lacks the `trade` scope.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              examples:
                insufficient_permissions:
                  summary: Caller lacks the trade scope
                  value:
                    title: Forbidden
                    status: 403
                    detail: insufficient permissions
                    instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '404':
          $ref: '#/components/responses/ErrNotFound'
        '409':
          $ref: '#/components/responses/IdempotencyInProgress'
        '422':
          $ref: '#/components/responses/IdempotencyKeyReused'
        '429':
          $ref: '#/components/responses/MutationRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
  /quotes/{client_quote_id}/confirm:
    post:
      summary: Confirm an Accepted Quote
      operationId: confirmAcceptedQuote
      tags:
        - Quotes
      description: Confirms a quote after a taker accepts it, committing the maker to the trade for the given client_quote_id.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - $ref: '#/components/parameters/IdempotencyKeyHeader'
        - name: client_quote_id
          in: path
          required: true
          description: The caller's correlation id for the quote.
          schema:
            $ref: '#/components/schemas/ClientId'
      responses:
        '204':
          description: The quote was confirmed. No body is returned.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
            UDX-Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '403':
          description: The credential lacks the `trade` scope.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              examples:
                insufficient_permissions:
                  summary: Caller lacks the trade scope
                  value:
                    title: Forbidden
                    status: 403
                    detail: insufficient permissions
                    instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '404':
          $ref: '#/components/responses/ErrNotFound'
        '409':
          $ref: '#/components/responses/IdempotencyInProgress'
        '422':
          $ref: '#/components/responses/IdempotencyKeyReused'
        '429':
          $ref: '#/components/responses/MutationRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
  /portfolio/balances:
    get:
      summary: Get Balances
      operationId: getBalances
      tags:
        - Portfolio
      description: |-
        Returns the account balance per account. Without an account filter, returns a balance for each of the caller's accounts.

        Balances are a live, point-in-time view projected from the clearinghouse and can briefly differ from the exchange's authoritative figures while trades, settlement, or funding are still being applied. Reconcile against settled statements rather than treating a single read as final.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - name: account_id
          in: query
          required: false
          description: Filter to a single account.
          schema:
            $ref: '#/components/schemas/EntityId'
        - name: ticker
          in: query
          required: false
          description: Scopes buying power to this market.
          schema:
            $ref: '#/components/schemas/Ticker'
        - $ref: '#/components/parameters/PaginationLimit'
        - $ref: '#/components/parameters/PaginationPage'
        - $ref: '#/components/parameters/BalancesSort'
        - $ref: '#/components/parameters/PaginationOrder'
      responses:
        '200':
          description: A page of account balances.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BalancesListResponse'
              example:
                balances:
                  - account_id: '6820943174116859281'
                    balance: '1000.00'
                    available_balance: '820.00'
                    open_orders: '80.00'
                    margin_held: '100.00'
                    updated_at: '2026-01-01T00:00:00.000000Z'
                next_page_url: null
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '403':
          description: The credential lacks the `read` scope.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                title: Forbidden
                status: 403
                detail: insufficient permissions
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '429':
          $ref: '#/components/responses/MemberRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/PublicReadUnavailable'
  /portfolio/positions:
    get:
      summary: Get Positions
      operationId: getPositions
      tags:
        - Portfolio
      description: Returns open positions, optionally filtered by account and/or market.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - name: account_id
          in: query
          required: false
          description: Filter to a single account.
          schema:
            $ref: '#/components/schemas/EntityId'
        - name: ticker
          in: query
          required: false
          description: Filter by market ticker.
          schema:
            $ref: '#/components/schemas/Ticker'
        - $ref: '#/components/parameters/PaginationLimit'
        - $ref: '#/components/parameters/PaginationPage'
        - $ref: '#/components/parameters/PositionsSort'
        - $ref: '#/components/parameters/PaginationOrder'
      responses:
        '200':
          description: A page of open positions.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PositionsListResponse'
              example:
                positions:
                  - account_id: '6820943174116859281'
                    ticker: UDX-EXAMPLE-MARKET
                    position: '60'
                    quantity_bought: '100'
                    quantity_sold: '40'
                    cost: '32.40'
                    realized_pnl: '4.00'
                    updated_at: '2026-01-01T00:00:00.000000Z'
                next_page_url: null
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '403':
          description: The credential lacks the `read` scope.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                title: Forbidden
                status: 403
                detail: insufficient permissions
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '429':
          $ref: '#/components/responses/MemberRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/PublicReadUnavailable'
  /portfolio/fills:
    get:
      summary: List Fills
      operationId: getFills
      tags:
        - Portfolio
      description: |-
        Returns the caller's fills (executions of their own orders), newest first.

        Requires an accepted credential with read access.

        Filter results with:

        - `ticker` for one market;
        - `executed_after` and `executed_before` for a time window; and
        - optional `order_id` for one order.

        Follow `next_page_url` until it is null to retrieve every page.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - name: ticker
          in: query
          required: false
          description: Filter by market ticker.
          schema:
            $ref: '#/components/schemas/Ticker'
        - name: order_id
          in: query
          required: false
          description: Filter to fills of a single order.
          schema:
            $ref: '#/components/schemas/ExchangeId'
        - name: executed_after
          in: query
          required: false
          description: Only return fills executed after this instant.
          schema:
            $ref: '#/components/schemas/TimestampRangeAfter'
        - name: executed_before
          in: query
          required: false
          description: Only return fills executed before this instant.
          schema:
            $ref: '#/components/schemas/TimestampRangeBefore'
        - $ref: '#/components/parameters/PaginationLimit'
        - $ref: '#/components/parameters/PaginationPage'
        - $ref: '#/components/parameters/FillsSort'
        - $ref: '#/components/parameters/PaginationOrder'
      responses:
        '200':
          description: A page of the caller's fills.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FillsListResponse'
              example:
                fills:
                  - trade_id: BP1ZQ131E04J
                    order_id: BK9BZNTK8022
                    client_order_id: order-20260804-001
                    account_id: '6820943174116859281'
                    ticker: UDX-EXAMPLE-COMBO
                    side: buy
                    price: '0.05'
                    quantity: '2'
                    fee: '0.03'
                    is_taker: true
                    executed_at: '2026-01-01T00:00:00.000000Z'
                    legs:
                      - ticker: UDX-EXAMPLE-LEG-A
                        side: buy
                        price: '0.55'
                        quantity: '2'
                      - ticker: UDX-EXAMPLE-LEG-B
                        side: sell
                        price: '0.50'
                        quantity: '2'
                next_page_url: null
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '403':
          description: The credential lacks the `read` scope.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              examples:
                insufficient_permissions:
                  summary: Caller lacks the read scope
                  value:
                    title: Forbidden
                    status: 403
                    detail: insufficient permissions
                    instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '422':
          $ref: '#/components/responses/FillRangeTooBroad'
        '429':
          $ref: '#/components/responses/MemberRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/PublicReadUnavailable'
  /portfolio/settlements:
    get:
      summary: Get Settlements
      operationId: getSettlements
      tags:
        - Portfolio
      description: Returns the caller's settlements — payouts of positions held in markets that have resolved — newest first, optionally filtered by account, market, and settlement-time range. Settlements are ordered by settled_at in the requested direction, tie-broken by account_id and ticker in the same direction.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - name: account_id
          in: query
          required: false
          description: Filter to a single account.
          schema:
            $ref: '#/components/schemas/EntityId'
        - name: ticker
          in: query
          required: false
          description: Filter by market ticker.
          schema:
            $ref: '#/components/schemas/Ticker'
        - name: settled_after
          in: query
          required: false
          description: Only return settlements settled after this instant.
          schema:
            $ref: '#/components/schemas/TimestampRangeAfter'
        - name: settled_before
          in: query
          required: false
          description: Only return settlements settled before this instant.
          schema:
            $ref: '#/components/schemas/TimestampRangeBefore'
        - $ref: '#/components/parameters/PaginationLimit'
        - $ref: '#/components/parameters/PaginationPage'
        - $ref: '#/components/parameters/SettlementsSort'
        - $ref: '#/components/parameters/PaginationOrder'
      responses:
        '200':
          description: A page of settled positions.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SettlementsListResponse'
              example:
                settlements:
                  - account_id: '6820943174116859281'
                    ticker: UDX-EXAMPLE-MARKET
                    quantity: '60'
                    market_result: 'yes'
                    settlement_price: '1.00'
                    payout: '60.00'
                    settled_at: '2026-01-01T00:00:00.000000Z'
                next_page_url: null
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '403':
          description: The credential lacks the `read` scope.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                title: Forbidden
                status: 403
                detail: insufficient permissions
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '422':
          $ref: '#/components/responses/SettlementRangeTooBroad'
        '429':
          $ref: '#/components/responses/MemberRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/PublicReadUnavailable'
  /portfolio/accounts:
    get:
      summary: List Accounts
      operationId: listAccounts
      tags:
        - Portfolio
      description: Returns the caller's non-deleted accounts, including accounts whose setup is pending or failed. Status includes account readiness and the caller's access. An API key must have the `read` scope; a key restricted to one account returns only that account. Follow a non-null next_page_url unchanged to retrieve the next page.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - $ref: '#/components/parameters/PaginationLimit'
        - $ref: '#/components/parameters/PaginationPage'
        - $ref: '#/components/parameters/AccountsSort'
        - $ref: '#/components/parameters/PaginationOrder'
      responses:
        '200':
          description: The current user's non-deleted accounts with active grants.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountsListResponse'
              examples:
                empty:
                  summary: No granted accounts
                  value:
                    accounts: []
                    next_page_url: null
                several_accounts:
                  summary: Multiple granted accounts
                  value:
                    accounts:
                      - id: '6820943174116859281'
                        name: Primary Desk
                        status: active
                      - id: '9214170797177585522'
                        name: New Desk
                        status: pending
                    next_page_url: null
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '403':
          description: The bearer identity is not admitted to direct UDX access, or the API key lacks the `read` scope.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                title: Forbidden
                status: 403
                detail: direct UDX access is not available
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '429':
          $ref: '#/components/responses/MemberRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
    post:
      summary: Create an Account
      operationId: createAccount
      tags:
        - Portfolio
      description: Creates an account for the caller's member and starts its asynchronous setup. An API key must be unrestricted and carry the trade scope; an account-restricted key cannot create an account. A member without an active clearing arrangement is rejected without creating an account.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - $ref: '#/components/parameters/IdempotencyKeyHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAccountRequest'
            example:
              name: market-making desk
      responses:
        '202':
          description: The account was created and its asynchronous setup started. It begins in the pending state. Poll GET /portfolio/accounts with the same authenticated credential until it becomes active. UDX retries failed setup; keep polling a failed account and contact UDX support if it persists. When supplied, reusing the creation idempotency key only replays this response and does not create or repair another account.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
            UDX-Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountResponse'
              example:
                account:
                  id: '9214170797177585522'
                  name: market-making desk
                  status: pending
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '403':
          description: The credential lacks the `trade` scope or is restricted to one account.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                title: Forbidden
                status: 403
                detail: insufficient permissions
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '409':
          $ref: '#/components/responses/IdempotencyInProgress'
        '422':
          $ref: '#/components/responses/IdempotencyKeyReused'
        '429':
          $ref: '#/components/responses/MutationRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
  /portfolio/accounts/{account_id}/grants:
    get:
      summary: List an Account's Grants
      operationId: listAccountGrants
      tags:
        - Portfolio
      description: Returns the grants on an account the caller can reach — which of the member's users hold access to it.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - $ref: '#/components/parameters/GrantAccountId'
        - $ref: '#/components/parameters/PaginationLimit'
        - $ref: '#/components/parameters/PaginationPage'
        - $ref: '#/components/parameters/GrantsSort'
        - $ref: '#/components/parameters/PaginationOrder'
      responses:
        '200':
          description: One page of the account's grants.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GrantsListResponse'
              examples:
                several_grants:
                  summary: Two users hold access
                  value:
                    grants:
                      - id: '4611688217447496062'
                        user_id: '7391077406361930804'
                        status: active
                        created_at: '2026-07-15T12:00:00.000000Z'
                      - id: '5822799328558517173'
                        user_id: '1194626289313312742'
                        status: pending
                        created_at: '2026-08-20T09:30:00.000000Z'
                    next_page_url: null
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '403':
          description: The credential lacks the `grants:manage` scope or is restricted to one account.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                title: Forbidden
                status: 403
                detail: insufficient permissions
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '404':
          $ref: '#/components/responses/GrantAccountNotFound'
        '429':
          $ref: '#/components/responses/MemberRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
    post:
      summary: Grant Account Access
      operationId: createGrant
      tags:
        - Portfolio
      description: Grants one of the member's users access to this account. UDX records the grant immediately; it starts pending while exchange access is set up, so poll the account's grants until the new grant is active.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - $ref: '#/components/parameters/IdempotencyKeyHeader'
        - $ref: '#/components/parameters/GrantAccountId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateGrantRequest'
            example:
              user_id: '1194626289313312742'
      responses:
        '202':
          description: The grant was created. Reusing the creation idempotency key replays this response instead of creating another grant.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
            UDX-Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GrantResponse'
              example:
                grant:
                  id: '5822799328558517173'
                  user_id: '1194626289313312742'
                  status: pending
                  created_at: '2026-08-20T09:30:00.000000Z'
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '403':
          description: The credential lacks the `grants:manage` scope or is restricted to one account.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                title: Forbidden
                status: 403
                detail: insufficient permissions
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '404':
          $ref: '#/components/responses/GrantAccountNotFound'
        '409':
          description: The user already holds a grant on this account, or a request with this idempotency key is still in progress.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                title: Conflict
                status: 409
                detail: user already holds a grant on this account
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '422':
          $ref: '#/components/responses/IdempotencyKeyReused'
        '429':
          $ref: '#/components/responses/MutationRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
  /portfolio/accounts/{account_id}/grants/{grant_id}:
    delete:
      summary: Revoke a Grant
      operationId: revokeGrant
      tags:
        - Portfolio
      description: Revokes a grant on this account, immediately removing that user's access — including through any API key restricted to the account. Revocation is permanent; to restore access, create a new grant.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - $ref: '#/components/parameters/IdempotencyKeyHeader'
        - $ref: '#/components/parameters/GrantAccountId'
        - name: grant_id
          in: path
          required: true
          description: The public identifier of the grant to revoke.
          schema:
            $ref: '#/components/schemas/EntityId'
      responses:
        '204':
          description: The grant was revoked. No body is returned.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
            UDX-Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '403':
          description: The credential lacks the `grants:manage` scope or is restricted to one account.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                title: Forbidden
                status: 403
                detail: insufficient permissions
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '404':
          description: The account or grant doesn't exist or isn't reachable by the caller, or the grant was already revoked.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                title: Not Found
                status: 404
                detail: grant not found
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '409':
          $ref: '#/components/responses/IdempotencyInProgress'
        '422':
          $ref: '#/components/responses/IdempotencyKeyReused'
        '429':
          $ref: '#/components/responses/MutationRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/RequestAdmissionUnavailable'
  /portfolio/transfers:
    post:
      summary: Transfer Between Accounts
      operationId: transferBetweenAccounts
      tags:
        - Portfolio
      description: Transfers cash between two of the caller's accounts, atomically. The caller must be authorized to act on both accounts, and both always belong to the caller's member. An API key must be unrestricted and carry the `transfer` scope; an account-restricted key cannot transfer, because a transfer always spans two accounts. Rejected if it would overdraw the source account, if the amount is zero, or if the source and destination are the same account. An unknown account, or one the caller cannot use, answers the same 400 as any invalid parameter.
      parameters:
        - $ref: '#/components/parameters/VersionHeader'
        - $ref: '#/components/parameters/IdempotencyKeyHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransferRequest'
            example:
              from_account_id: '6820943174116859281'
              to_account_id: '9214170797177585522'
              amount: '250.00'
      responses:
        '200':
          description: The completed transfer. When an idempotency key was supplied, resending the identical request with the same key replays this response, marked with UDX-Idempotent-Replayed — the funds move only once. Without a key, UDX provides no transport replay guarantee.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
            UDX-Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransferResponse'
              example:
                transfer:
                  from_account_id: '6820943174116859281'
                  to_account_id: '9214170797177585522'
                  amount: '250.00'
        '400':
          $ref: '#/components/responses/ErrBadRequest'
        '401':
          $ref: '#/components/responses/ErrUnauthorized'
        '403':
          description: The API key lacks the `transfer` scope or is restricted to one account.
          headers:
            UDX-Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                title: Forbidden
                status: 403
                detail: insufficient permissions
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
        '409':
          $ref: '#/components/responses/IdempotencyInProgress'
        '422':
          $ref: '#/components/responses/IdempotencyKeyReused'
        '429':
          $ref: '#/components/responses/MutationRateLimitExceeded'
        '500':
          $ref: '#/components/responses/ErrInternal'
        '503':
          $ref: '#/components/responses/TransferUnavailable'
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Bearer token for an active signed-in UDX user.
    signatureKeyId:
      type: apiKey
      in: header
      name: UDX-Access-Key
      description: Opaque API key ID.
    signatureTimestamp:
      type: apiKey
      in: header
      name: UDX-Access-Timestamp
      description: Unix time in milliseconds, within 30 seconds of server time.
    signature:
      type: apiKey
      in: header
      name: UDX-Access-Signature
      description: Standard-base64 RSA-PSS/SHA-256 signature with a 32-byte salt. Sign `timestamp + METHOD + path`; for requests with a body, append `hex(SHA256(body))`; append `UDX-Idempotency-Key` when it is present.
  parameters:
    IdempotencyKeyHeader:
      name: UDX-Idempotency-Key
      in: header
      required: false
      description: Optional client-generated key that makes a mutation safe to retry. Reuse it only for a byte-identical retry. When present, it is included in the request signature; omitting it disables UDX idempotency for that request.
      schema:
        type: string
        minLength: 1
        maxLength: 255
        description: A unique, client-generated key identifying this request.
        example: b6f1c2a4-2b7e-4c1a-9c2e-2d1f8a3e4b5c
    VersionHeader:
      name: UDX-Version
      in: header
      required: false
      description: Dated API version (YYYY-MM-DD). Omit to use the oldest supported version. An unknown version returns `400`.
      schema:
        type: string
        maxLength: 10
        description: A dated API version (YYYY-MM-DD).
        example: '2026-07-15'
    PaginationLimit:
      name: limit
      in: query
      required: false
      description: Maximum number of items to return in one page. Defaults to 10 when omitted; must be an integer from 1 to 100. A value outside that range is rejected with 400 rather than silently clamped. A returned next_page_url preserves the effective value.
      schema:
        type: integer
        minimum: 1
        maximum: 100
        default: 10
        description: Page size, 1–100 (default 10).
        example: 10
    PaginationPage:
      name: page
      in: query
      required: false
      description: Opaque token identifying the requested page. Clients should not construct or extract this value; follow next_page_url from the previous response unchanged instead.
      schema:
        type: string
        maxLength: 512
        description: An opaque pagination cursor.
        example: eyJ2IjoxLCJzIjoiMjAyNi0wNi0wMVQxMjowMDowMC4wMDAwMDBaIiwiaWQiOiIzNTE3NDU2MjI5NjM0MTg1NjQ2In0
    APIKeysSort:
      name: sort
      in: query
      required: false
      description: Field to sort by. Defaults to created_at. The API key's identifier is always appended as a tie-breaker, so the order is fully deterministic.
      schema:
        type: string
        enum:
          - created_at
          - name
        default: created_at
        description: A sortable API key field.
        example: created_at
    AccountsSort:
      name: sort
      in: query
      required: false
      description: Field to sort accounts by. Defaults to created_at (creation time). The account identifier is appended as a tie-breaker.
      schema:
        type: string
        enum:
          - created_at
        default: created_at
        description: A sortable account field.
        example: created_at
    UsersSort:
      name: sort
      in: query
      required: false
      description: Field to sort users by. Defaults to created_at (creation time). The user identifier is appended as a tie-breaker.
      schema:
        type: string
        enum:
          - created_at
        default: created_at
        description: A sortable user field.
        example: created_at
    GrantsSort:
      name: sort
      in: query
      required: false
      description: Field to sort grants by. Defaults to created_at (when access was granted). The grant identifier is appended as a tie-breaker.
      schema:
        type: string
        enum:
          - created_at
        default: created_at
        description: A sortable grant field.
        example: created_at
    GrantAccountId:
      name: account_id
      in: path
      required: true
      description: The public identifier of the account whose grants are managed.
      schema:
        $ref: '#/components/schemas/EntityId'
    PaginationOrder:
      name: order
      in: query
      required: false
      description: Sort direction. Defaults to desc. Applies to the default sort field when sort is omitted. Nulls sort last in both directions.
      schema:
        type: string
        enum:
          - asc
          - desc
        default: desc
        description: Sort direction.
        example: desc
    MarketsSort:
      name: sort
      in: query
      required: false
      description: Field to sort markets by. Defaults to event_date. The ticker is always appended as a tie-breaker, so the order is fully deterministic.
      schema:
        type: string
        enum:
          - event_date
          - ticker
        default: event_date
        description: A sortable market field.
        example: event_date
    TradesSort:
      name: sort
      in: query
      required: false
      description: Field to sort trades by. Defaults to executed_at (execution time). The trade_id is appended as a tie-breaker.
      schema:
        type: string
        enum:
          - executed_at
        default: executed_at
        description: A sortable trade field.
        example: executed_at
    CandlesticksSort:
      name: sort
      in: query
      required: false
      description: Field to sort candlesticks by. Defaults to period_ends_at (period end).
      schema:
        type: string
        enum:
          - period_ends_at
        default: period_ends_at
        description: A sortable candlestick field.
        example: period_ends_at
    CombosSort:
      name: sort
      in: query
      required: false
      description: Field to sort combo markets by. Defaults to event_date. The ticker is appended as a tie-breaker.
      schema:
        type: string
        enum:
          - event_date
          - ticker
        default: event_date
        description: A sortable combo field.
        example: event_date
    OrdersSort:
      name: sort
      in: query
      required: false
      description: Field to sort orders by. Defaults to created_at (creation time). The order_id is appended as a tie-breaker.
      schema:
        type: string
        enum:
          - created_at
        default: created_at
        description: A sortable order field.
        example: created_at
    RfqsSort:
      name: sort
      in: query
      required: false
      description: Field to sort RFQs by. Defaults to created_at (creation time). The rfq_id is appended as a tie-breaker.
      schema:
        type: string
        enum:
          - created_at
        default: created_at
        description: A sortable RFQ field.
        example: created_at
    QuotesSort:
      name: sort
      in: query
      required: false
      description: Field to sort quotes by. Defaults to created_at (creation time). The quote_id is appended as a tie-breaker.
      schema:
        type: string
        enum:
          - created_at
        default: created_at
        description: A sortable quote field.
        example: created_at
    BalancesSort:
      name: sort
      in: query
      required: false
      description: Field to sort balances by. Defaults to account_id.
      schema:
        type: string
        enum:
          - account_id
        default: account_id
        description: A sortable balance field.
        example: account_id
    PositionsSort:
      name: sort
      in: query
      required: false
      description: Field to sort positions by. Defaults to ticker. The account is appended as a tie-breaker.
      schema:
        type: string
        enum:
          - ticker
        default: ticker
        description: A sortable position field.
        example: ticker
    FillsSort:
      name: sort
      in: query
      required: false
      description: Field to sort fills by. Defaults to executed_at (execution time). The trade_id is appended as a tie-breaker.
      schema:
        type: string
        enum:
          - executed_at
        default: executed_at
        description: A sortable fill field.
        example: executed_at
    SettlementsSort:
      name: sort
      in: query
      required: false
      description: Field to sort settlements by. Defaults to settled_at (settlement time).
      schema:
        type: string
        enum:
          - settled_at
        default: settled_at
        description: A sortable settlement field.
        example: settled_at
  headers:
    VersionHeader:
      description: API version used for this response.
      schema:
        type: string
        maxLength: 10
        description: A dated API version (YYYY-MM-DD).
        example: '2026-07-15'
    IdempotentReplayed:
      description: '`true` for a replayed response; omitted otherwise.'
      schema:
        type: string
        enum:
          - 'true'
        description: Always the string `true` when present.
        example: 'true'
    RetryAfter:
      description: Whole seconds to wait before retrying.
      schema:
        type: integer
        minimum: 1
        description: A positive delay in whole seconds.
        example: 2
    NoStore:
      description: Prevents caching this response.
      schema:
        type: string
        enum:
          - no-store
        description: Always the cache directive `no-store`.
        example: no-store
    PublicMarketCache:
      description: Caches public market metadata for one second.
      schema:
        type: string
        enum:
          - public, max-age=1, stale-while-revalidate=1
        description: The fixed cache policy for public market metadata.
        example: public, max-age=1, stale-while-revalidate=1
    LiveMarketDataNoStore:
      description: Prevents caching live market data.
      schema:
        type: string
        enum:
          - no-store
        description: Always the cache directive `no-store`.
        example: no-store
  responses:
    IdempotencyInProgress:
      description: This key is still in use or its response cannot be replayed. The mutation may have run; check `detail` before retrying.
      headers:
        UDX-Version:
          $ref: '#/components/headers/VersionHeader'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetails'
          example:
            title: Conflict
            status: 409
            detail: a request with this UDX-Idempotency-Key is already in progress
            instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
    IdempotencyKeyReused:
      description: This key belongs to a different request.
      headers:
        UDX-Version:
          $ref: '#/components/headers/VersionHeader'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetails'
          example:
            title: Unprocessable Entity
            status: 422
            detail: UDX-Idempotency-Key was already used for a different request
            instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
    FillRangeTooBroad:
      description: Too many fills match the time range. Narrow `executed_after` and `executed_before`.
      headers:
        UDX-Version:
          $ref: '#/components/headers/VersionHeader'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/FillRangeTooBroadProblem'
          example:
            type: urn:udx:problem:fill-history-range-too-broad
            title: Unprocessable Entity
            status: 422
            detail: requested fill history is too broad; narrow executed_after and executed_before
            instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
    SettlementRangeTooBroad:
      description: Too many position changes match the time range. Narrow `settled_after` and `settled_before`.
      headers:
        UDX-Version:
          $ref: '#/components/headers/VersionHeader'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/SettlementRangeTooBroadProblem'
          example:
            type: urn:udx:problem:settlement-history-range-too-broad
            title: Unprocessable Entity
            status: 422
            detail: requested settlement history is too broad; narrow settled_after and settled_before
            instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
    OrderHistoryRangeTooBroad:
      description: Too many orders match the time range. Narrow `created_after` and `created_before`; active accounts may need a shorter range.
      headers:
        UDX-Version:
          $ref: '#/components/headers/VersionHeader'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/OrderHistoryRangeTooBroadProblem'
          example:
            type: urn:udx:problem:order-history-range-too-broad
            title: Unprocessable Entity
            status: 422
            detail: requested order history is too broad; narrow created_after and created_before; active accounts may need a shorter time range
            instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
    QuoteHistoryRangeTooBroad:
      description: Too many quotes match the time range. Narrow `created_after` and `created_before`; active makers may need a shorter range.
      headers:
        UDX-Version:
          $ref: '#/components/headers/VersionHeader'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/QuoteHistoryRangeTooBroadProblem'
          example:
            type: urn:udx:problem:quote-history-range-too-broad
            title: Unprocessable Entity
            status: 422
            detail: requested quote history is too broad; narrow created_after and created_before; active makers may need a shorter time range
            instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
    RfqHistoryRangeTooBroad:
      description: Too many RFQs match the time range. Narrow `created_after` and `created_before`; active makers may need a shorter range.
      headers:
        UDX-Version:
          $ref: '#/components/headers/VersionHeader'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/RfqHistoryRangeTooBroadProblem'
          example:
            type: urn:udx:problem:rfq-history-range-too-broad
            title: Unprocessable Entity
            status: 422
            detail: requested RFQ history is too broad; narrow created_after and created_before; active makers may need a shorter time range
            instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
    MemberRateLimitExceeded:
      description: The member rate limit was exceeded. Wait for `Retry-After`.
      headers:
        UDX-Version:
          $ref: '#/components/headers/VersionHeader'
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
        Cache-Control:
          $ref: '#/components/headers/NoStore'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetails'
          example:
            type: urn:udx:problem:member-rate-limit-exceeded
            title: Too Many Requests
            status: 429
            detail: this member has temporarily exceeded its request rate
            instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
    UnauthenticatedRateLimitExceeded:
      description: The public request rate was exceeded. Wait for `Retry-After`.
      headers:
        UDX-Version:
          $ref: '#/components/headers/VersionHeader'
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
        Cache-Control:
          $ref: '#/components/headers/NoStore'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetails'
          example:
            type: urn:udx:problem:unauthenticated-rate-limit-exceeded
            title: Too Many Requests
            status: 429
            detail: this client has temporarily exceeded the public request rate
            instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
    MutationRateLimitExceeded:
      description: The Member's request rate is exhausted. Wait for `Retry-After`.
      headers:
        UDX-Version:
          $ref: '#/components/headers/VersionHeader'
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
        Cache-Control:
          $ref: '#/components/headers/NoStore'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetails'
          example:
            type: urn:udx:problem:member-rate-limit-exceeded
            title: Too Many Requests
            status: 429
            detail: this member has temporarily exceeded its request rate
            instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
    RequestAdmissionUnavailable:
      description: Request admission is unavailable. Retry later.
      headers:
        UDX-Version:
          $ref: '#/components/headers/VersionHeader'
        Cache-Control:
          $ref: '#/components/headers/NoStore'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetails'
          example:
            type: urn:udx:problem:request-admission-unavailable
            title: Service Unavailable
            status: 503
            detail: request admission is temporarily unavailable
            instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
    TransferUnavailable:
      description: 'The transfer could not be resolved to a definite outcome: request admission or account setup is unavailable, or the transfer''s result is unknown. If the request included an idempotency key, check your balances, then retry the identical request with the same key — the funds move at most once. A new key is a new transfer: never mint one to retry an attempt whose outcome is unknown. If no key was supplied, do not retry blindly; reconcile the balances before starting another transfer.'
      headers:
        UDX-Version:
          $ref: '#/components/headers/VersionHeader'
        Cache-Control:
          $ref: '#/components/headers/NoStore'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetails'
          examples:
            transferOutcomeUnknown:
              summary: The transfer result is unknown
              value:
                title: Service Unavailable
                status: 503
                detail: the transfer may or may not have completed; check your balances before retrying
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
            projectionUnavailable:
              summary: Caller setup is not ready
              value:
                title: Service Unavailable
                status: 503
                detail: account setup is still being completed; retry later
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
            memberRateLimitUnavailable:
              summary: Request admission is unavailable
              value:
                title: Service Unavailable
                status: 503
                detail: request admission is temporarily unavailable
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
    PublicReadUnavailable:
      description: Request admission or account setup is unavailable. Retry later.
      headers:
        UDX-Version:
          $ref: '#/components/headers/VersionHeader'
        Cache-Control:
          $ref: '#/components/headers/NoStore'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetails'
          examples:
            projectionUnavailable:
              summary: Caller setup is not ready
              value:
                title: Service Unavailable
                status: 503
                detail: account setup is still being completed; retry later
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
            memberRateLimitUnavailable:
              summary: Request admission is unavailable
              value:
                title: Service Unavailable
                status: 503
                detail: request admission is temporarily unavailable
                instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
    ErrBadRequest:
      description: The request doesn't conform to this spec.
      headers:
        UDX-Version:
          $ref: '#/components/headers/VersionHeader'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetails'
          example:
            title: Bad Request
            status: 400
            detail: request did not pass validation
            instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
    ErrUnauthorized:
      description: No valid credential was provided.
      headers:
        UDX-Version:
          $ref: '#/components/headers/VersionHeader'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetails'
          example:
            title: Unauthorized
            status: 401
            detail: invalid authentication credentials
            instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
    GrantAccountNotFound:
      description: The account doesn't exist or the caller holds no grant on it. The two cases are deliberately indistinguishable.
      headers:
        UDX-Version:
          $ref: '#/components/headers/VersionHeader'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetails'
          example:
            title: Not Found
            status: 404
            detail: account not found
            instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
    ErrNotFound:
      description: The requested resource doesn't exist or isn't visible to the caller.
      headers:
        UDX-Version:
          $ref: '#/components/headers/VersionHeader'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetails'
          example:
            title: Not Found
            status: 404
            detail: not found
            instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
    ErrInternal:
      description: Something went wrong on UDX's side.
      headers:
        UDX-Version:
          $ref: '#/components/headers/VersionHeader'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetails'
          example:
            title: Internal Server Error
            status: 500
            detail: internal error
            instance: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
  schemas:
    TimestampRangeAfter:
      type: string
      format: date-time
      maxLength: 40
      description: An exclusive lower bound for a timestamp. UDX timestamps use RFC 3339; requests require an explicit UTC offset and zero to six fractional digits; responses use UTC with exactly six fractional digits.
      example: '2026-01-01T00:00:00.000000Z'
    TimestampRangeBefore:
      type: string
      format: date-time
      maxLength: 40
      description: An exclusive upper bound for a timestamp. UDX timestamps use RFC 3339; requests require an explicit UTC offset and zero to six fractional digits; responses use UTC with exactly six fractional digits.
      example: '2026-01-31T23:59:59.000000Z'
    FillRangeTooBroadProblem:
      description: A Problem Details response for a fill-history time range that covers too many fills.
      allOf:
        - $ref: '#/components/schemas/ProblemDetails'
        - type: object
          description: A fill-history query whose time range covers too many fills. Narrow its execution-time range.
          required:
            - type
          properties:
            type:
              type: string
              description: The stable category for a fill-history time range that covers too many fills.
              enum:
                - urn:udx:problem:fill-history-range-too-broad
    SettlementRangeTooBroadProblem:
      description: A Problem Details response for a settlement-history time range that covers too many position changes.
      allOf:
        - $ref: '#/components/schemas/ProblemDetails'
        - type: object
          description: A settlement-history query whose time range covers too many position changes. Narrow its settlement-time range.
          required:
            - type
          properties:
            type:
              type: string
              description: The stable category for a settlement-history time range that covers too many position changes.
              enum:
                - urn:udx:problem:settlement-history-range-too-broad
    OrderHistoryRangeTooBroadProblem:
      description: A Problem Details response for an order-history time range that covers too many orders.
      allOf:
        - $ref: '#/components/schemas/ProblemDetails'
        - type: object
          description: An order-history query whose time range covers too many orders. Narrow its creation-time range.
          required:
            - type
          properties:
            type:
              type: string
              description: The stable category for an order-history time range that covers too many orders.
              enum:
                - urn:udx:problem:order-history-range-too-broad
    QuoteHistoryRangeTooBroadProblem:
      description: A Problem Details response for a quote-history time range that covers too many quotes.
      allOf:
        - $ref: '#/components/schemas/ProblemDetails'
        - type: object
          description: A quote-history query whose time range covers too many quotes. Narrow its creation-time range.
          required:
            - type
          properties:
            type:
              type: string
              description: The stable category for a quote-history time range that covers too many quotes.
              enum:
                - urn:udx:problem:quote-history-range-too-broad
    RfqHistoryRangeTooBroadProblem:
      description: A Problem Details response for an RFQ-history time range that covers too many RFQs.
      allOf:
        - $ref: '#/components/schemas/ProblemDetails'
        - type: object
          description: An RFQ-history query whose time range covers too many RFQs. Narrow its creation-time range.
          required:
            - type
          properties:
            type:
              type: string
              description: The stable category for an RFQ-history time range that covers too many RFQs.
              enum:
                - urn:udx:problem:rfq-history-range-too-broad
    APIKeyScope:
      type: string
      description: 'A permission an API key can be granted: read (market/portfolio data), trade (order placement), transfer (moving funds), keys:manage (listing, creating, and revoking other API keys), or grants:manage (managing which users can reach the member''s accounts). The two manage scopes are never granted by omission or a default scope set; see the API key management guide.'
      enum:
        - read
        - trade
        - transfer
        - keys:manage
        - grants:manage
    APIKey:
      type: object
      description: An API key's metadata. Never includes the private key because UDX never receives it.
      required:
        - id
        - name
        - scopes
        - created_at
      properties:
        id:
          allOf:
            - $ref: '#/components/schemas/EntityId'
          description: The API key's public identifier.
        name:
          type: string
          maxLength: 200
          description: The nickname given to this key at creation.
        scopes:
          type: array
          maxItems: 5
          description: The permissions this key was granted at creation. Fixed for its lifetime — a different set of scopes means a new key.
          items:
            $ref: '#/components/schemas/APIKeyScope'
        account_id:
          type: string
          nullable: true
          description: The opaque public identifier of the single account this key is restricted to, or null if it's usable against every account accessible to the caller.
        created_at:
          type: string
          format: date-time
          maxLength: 40
          description: UDX timestamps use RFC 3339; requests require an explicit UTC offset and zero to six fractional digits; responses use UTC with exactly six fractional digits. When this key was created. Keys are immutable, so nothing about it changes after this point except being revoked.
    NextPageURL:
      type: string
      format: uri-reference
      nullable: true
      maxLength: 4096
      pattern: ^/[^/\s#][^\s#]*$
      description: Root-relative URL for the next page, including the effective limit, sort, order, filters, and opaque cursor. Follow it unchanged with the same authentication. Null when there are no more items. It never contains credentials or an authority/host.
      example: /api_keys?limit=10&order=desc&page=eyJ2IjoxLCJzIjoiMjAyNi0wNi0wMVQxMjowMDowMC4wMDAwMDBaIiwiaWQiOiIzNTE3NDU2MjI5NjM0MTg1NjQ2In0&sort=created_at
    APIKeyResponse:
      type: object
      description: A single API key.
      required:
        - api_key
      properties:
        api_key:
          $ref: '#/components/schemas/APIKey'
    APIKeysListResponse:
      type: object
      description: A page of the caller's own API keys.
      required:
        - api_keys
        - next_page_url
      properties:
        api_keys:
          type: array
          maxItems: 100
          description: One page of the caller's non-revoked API keys.
          items:
            $ref: '#/components/schemas/APIKey'
        next_page_url:
          $ref: '#/components/schemas/NextPageURL'
    RateLimitBucketName:
      type: string
      description: Closed rate bucket used by authenticated public REST operations.
      enum:
        - read
        - write
        - cancel
      x-enum-varnames:
        - RateLimitBucketRead
        - RateLimitBucketWrite
        - RateLimitBucketCancel
    RateLimitBucket:
      type: object
      additionalProperties: false
      description: One immutable continuous-token-bucket definition.
      required:
        - bucket
        - refill_tokens_per_minute
        - capacity
        - unit_cost
      properties:
        bucket:
          $ref: '#/components/schemas/RateLimitBucketName'
        refill_tokens_per_minute:
          type: integer
          format: int64
          minimum: 1
          maximum: 10000000
          description: Tokens restored per minute.
        capacity:
          type: integer
          format: int64
          minimum: 1
          maximum: 10000000
          description: Maximum tokens retained by the bucket.
        unit_cost:
          type: integer
          format: int64
          minimum: 1
          maximum: 10000000
          description: Default token cost for one operation assigned to this bucket.
    RateLimitProfile:
      type: object
      additionalProperties: false
      description: The caller's own current member rate limit profile. Every user, account, and API key owned by the member shares these buckets.
      required:
        - profile_key
        - profile_version
        - buckets
      properties:
        profile_key:
          type: string
          minLength: 1
          maxLength: 32
          pattern: ^[a-z][a-z0-9_]*$
          description: Stable machine-readable profile key.
        profile_version:
          type: integer
          format: int64
          minimum: 1
          maximum: 1000000
          description: Immutable profile version.
        buckets:
          type: array
          minItems: 3
          maxItems: 3
          description: The profile's read, write, and cancel bucket definitions.
          items:
            $ref: '#/components/schemas/RateLimitBucket'
    RateLimitProfileResponse:
      type: object
      additionalProperties: false
      description: A response wrapping the caller's own current rate limit profile.
      required:
        - rate_limit_profile
      properties:
        rate_limit_profile:
          $ref: '#/components/schemas/RateLimitProfile'
    CreateAPIKeyRequest:
      type: object
      description: The fields needed to create an API key, whether its public key was generated in-browser or uploaded by the caller.
      required:
        - name
        - public_key
        - scopes
      properties:
        name:
          type: string
          description: A nickname for the new key, so you can tell your keys apart later.
          minLength: 1
          maxLength: 200
        public_key:
          type: string
          description: PEM-encoded RSA public key. Rejected with 400 if it isn't a single well-formed PEM block containing a PKIX-encoded RSA public key with a modulus between 2048 and 4096 bits, inclusive.
          minLength: 1
          maxLength: 10000
        scopes:
          type: array
          description: The permissions to grant this key. Fixed for its lifetime — granting a different set of scopes later means creating a new key and revoking this one.
          minItems: 1
          maxItems: 5
          items:
            $ref: '#/components/schemas/APIKeyScope'
        account_id:
          type: string
          nullable: true
          description: Restricts the key to a single account by its opaque public identifier. Omit (or null) to leave the key unrestricted, usable against every account accessible to the caller. Rejected with 403 if the caller cannot access the given account.
    Ticker:
      type: string
      minLength: 1
      maxLength: 128
      description: A market identifier (ticker) — a human-meaningful natural-key symbol, not a UUID. Unique per market.
      example: UDX-EXAMPLE-MARKET
    OrderSide:
      type: string
      enum:
        - buy
        - sell
      description: Order side. `buy` buys YES, `sell` sells YES — everything is priced from the YES side. (Selling YES is economically equivalent to buying NO at 1 − price.)
    FixedPointQuantity:
      type: string
      pattern: ^[0-9]+(\.[0-9]{1,2})?$
      maxLength: 24
      description: A quantity in contracts, as a fixed-point decimal string with 0–2 decimal places. A string (not a float) so the value is exact.
      example: '100'
    FixedPointDollars:
      type: string
      pattern: ^[0-9]+(\.[0-9]{1,6})?$
      maxLength: 24
      description: An amount in dollars, as a fixed-point decimal string with up to 6 decimal places. A string (not a float) so the value is exact.
      example: '0.55'
    MarketStatus:
      type: string
      enum:
        - open
        - closed
        - paused
        - expired
        - settled
      description: Market trading status. `open` accepts orders; `closed` and `paused` do not; `expired` is past its expiry; `settled` has resolved to an outcome.
    Market:
      type: object
      description: A tradable binary market, priced from the YES side.
      required:
        - ticker
        - status
      properties:
        ticker:
          $ref: '#/components/schemas/Ticker'
        event_ticker:
          type: string
          maxLength: 128
          description: Identifier of the event this market belongs to.
          example: UDX-EXAMPLE-EVENT
        description:
          type: string
          maxLength: 2048
          description: Human-readable description of what the market resolves on.
        status:
          $ref: '#/components/schemas/MarketStatus'
        event_date:
          type: string
          maxLength: 10
          description: Approximate date of the real-world event, as YYYY-MM-DD.
          example: '2026-06-21'
        tick_size:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Minimum price increment, in dollars.
        minimum_price:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Minimum allowed order price, in dollars.
        maximum_price:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Maximum allowed order price, in dollars.
        expires_at:
          type: string
          format: date-time
          maxLength: 40
          description: When the market expires. UDX timestamps use RFC 3339; requests require an explicit UTC offset and zero to six fractional digits; responses use UTC with exactly six fractional digits.
          example: '2026-06-21T00:00:00.000000Z'
        volume:
          allOf:
            - $ref: '#/components/schemas/FixedPointQuantity'
          description: Total contracts traded on the market.
        open_interest:
          allOf:
            - $ref: '#/components/schemas/FixedPointQuantity'
          description: Open interest, in contracts.
    MarketResponse:
      type: object
      description: A single market.
      required:
        - market
      properties:
        market:
          $ref: '#/components/schemas/Market'
    MarketsListResponse:
      type: object
      description: A page of markets.
      required:
        - markets
        - next_page_url
      properties:
        markets:
          type: array
          maxItems: 100
          description: One page of markets.
          items:
            $ref: '#/components/schemas/Market'
        next_page_url:
          $ref: '#/components/schemas/NextPageURL'
    PriceLevel:
      type: array
      description: A single aggregated book level as a two-element `[price, quantity]` pair — both YES-denominated fixed-point dollar/contract strings.
      minItems: 2
      maxItems: 2
      items:
        type: string
        maxLength: 24
        description: A fixed-point decimal string (price in dollars, or quantity in contracts).
    Orderbook:
      type: object
      description: The aggregated order book for a market, priced from the YES side.
      required:
        - ticker
        - bids
        - asks
      properties:
        ticker:
          $ref: '#/components/schemas/Ticker'
        bids:
          type: array
          maxItems: 1000
          description: Bid levels, best first, as `[price, quantity]` pairs in YES dollars.
          items:
            $ref: '#/components/schemas/PriceLevel'
        asks:
          type: array
          maxItems: 1000
          description: Ask levels, best first, as `[price, quantity]` pairs in YES dollars.
          items:
            $ref: '#/components/schemas/PriceLevel'
    OrderbookResponse:
      type: object
      description: A market's aggregated order book.
      required:
        - orderbook
      properties:
        orderbook:
          $ref: '#/components/schemas/Orderbook'
    Trade:
      type: object
      description: A public trade (match) on a market.
      required:
        - trade_id
        - ticker
        - price
        - quantity
        - taker_side
        - executed_at
      properties:
        trade_id:
          type: string
          maxLength: 64
          description: Exchange-assigned trade identifier.
          example: BP1ZQ131E04J
        ticker:
          $ref: '#/components/schemas/Ticker'
        price:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Trade price, in YES dollars.
        quantity:
          allOf:
            - $ref: '#/components/schemas/FixedPointQuantity'
          description: Contracts traded.
        taker_side:
          allOf:
            - $ref: '#/components/schemas/OrderSide'
          description: The aggressor (taker) side of the trade.
        executed_at:
          type: string
          format: date-time
          maxLength: 40
          description: When the trade executed. UDX timestamps use RFC 3339; requests require an explicit UTC offset and zero to six fractional digits; responses use UTC with exactly six fractional digits.
          example: '2026-01-01T00:00:00.000000Z'
    TradesListResponse:
      type: object
      description: A page of public trades for a market, newest first.
      required:
        - trades
        - next_page_url
      properties:
        trades:
          type: array
          maxItems: 100
          description: One page of trades.
          items:
            $ref: '#/components/schemas/Trade'
        next_page_url:
          $ref: '#/components/schemas/NextPageURL'
    Candlestick:
      type: object
      description: One OHLC price candlestick covering a single period. Price fields are absent for a period with no trades.
      required:
        - period_ends_at
        - volume
        - trade_count
      properties:
        period_ends_at:
          type: string
          format: date-time
          maxLength: 40
          description: When this Candlestick's aggregation period ends. UDX timestamps use RFC 3339; requests require an explicit UTC offset and zero to six fractional digits; responses use UTC with exactly six fractional digits.
          example: '2026-01-01T00:01:00.000000Z'
        open:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: First trade price in the period, in dollars.
        high:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Highest trade price in the period, in dollars.
        low:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Lowest trade price in the period, in dollars.
        close:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Last trade price in the period, in dollars.
        volume:
          allOf:
            - $ref: '#/components/schemas/FixedPointQuantity'
          description: Contracts traded during the period.
        trade_count:
          type: integer
          format: int64
          description: Number of trades during the period.
          example: 12
    CandlesticksListResponse:
      type: object
      description: A page of historical OHLC candlesticks for a market.
      required:
        - candlesticks
        - next_page_url
      properties:
        candlesticks:
          type: array
          maxItems: 100
          description: One page of candlesticks, oldest first.
          items:
            $ref: '#/components/schemas/Candlestick'
        next_page_url:
          $ref: '#/components/schemas/NextPageURL'
    ComboLeg:
      type: object
      description: One leg of a combo (multi-leg) market.
      required:
        - ticker
        - opposing_side
      properties:
        ticker:
          $ref: '#/components/schemas/Ticker'
        opposing_side:
          type: boolean
          description: Whether this leg trades on the side opposing the combo (the NO side of the leg's underlying market).
    Combo:
      type: object
      description: A multi-leg (combo) market — a tradable market composed of two or more legs. Carries the same fields as a market, plus its legs.
      allOf:
        - $ref: '#/components/schemas/Market'
        - type: object
          description: The combo-specific extension over a plain market.
          required:
            - legs
          properties:
            legs:
              type: array
              minItems: 2
              maxItems: 100
              description: The two-or-more legs that compose the combo.
              items:
                $ref: '#/components/schemas/ComboLeg'
    ComboResponse:
      type: object
      description: A single combo market.
      required:
        - combo
      properties:
        combo:
          $ref: '#/components/schemas/Combo'
    CombosListResponse:
      type: object
      description: A page of combo markets.
      required:
        - combos
        - next_page_url
      properties:
        combos:
          type: array
          maxItems: 100
          description: One page of combo markets.
          items:
            $ref: '#/components/schemas/Combo'
        next_page_url:
          $ref: '#/components/schemas/NextPageURL'
    ClientId:
      type: string
      minLength: 1
      maxLength: 40
      pattern: ^[A-Za-z0-9._~-]+$
      description: 'A client-supplied correlation identifier: 1–40 URL-safe ASCII characters (letters, digits, hyphen, period, underscore, tilde), unique per resource within the caller''s account — reusing one is rejected even after the original resource closes. Distinct from the exchange-assigned public id and from the idempotency key.'
      example: client-20260804-001
    ExchangeId:
      type: string
      minLength: 1
      maxLength: 64
      description: 'An exchange-assigned public identifier. An opaque string: treat it as a stable, unique key with no internal structure — no format, length trend, ordering, or numeric meaning is guaranteed, and the format may differ across resources created at different times.'
      example: BK9BZNTK8022
    RfqParticipantId:
      type: string
      minLength: 1
      maxLength: 64
      description: An opaque pseudonymous RFQ participant identifier. It is stable across a user's RFQs and quotes so counterparties can correlate repeat participants. Your own value is returned as `rfq_participant_id` by `GET /users/me`.
      example: 4d127cce3bc675c9
    User:
      type: object
      description: The canonical user the caller's credential resolves to — the session's user for a bearer credential, the owning user for an API key.
      required:
        - id
        - member_id
        - rfq_participant_id
      properties:
        id:
          $ref: '#/components/schemas/EntityId'
        member_id:
          allOf:
            - $ref: '#/components/schemas/EntityId'
          description: The member that owns this user.
        rfq_participant_id:
          allOf:
            - $ref: '#/components/schemas/RfqParticipantId'
          description: The pseudonymous identifier this user is known by to RFQ counterparties — disclosed as `requester_id` on RFQs the user raises and on quotes responding to those RFQs, and as `quoter_id` on quotes the user submits.
    UserResponse:
      type: object
      description: The current user.
      required:
        - user
      properties:
        user:
          $ref: '#/components/schemas/User'
    MemberUser:
      type: object
      description: One of the caller's member's users.
      required:
        - id
        - status
        - created_at
      properties:
        id:
          allOf:
            - $ref: '#/components/schemas/EntityId'
          description: The user's public identifier.
        status:
          type: string
          description: 'The user''s access state: pending (activation is still running), active (the user can authenticate), or suspended. A user in any state can hold grants, but only an active user can use them.'
          enum:
            - pending
            - active
            - suspended
        created_at:
          type: string
          format: date-time
          maxLength: 40
          description: UDX timestamps use RFC 3339; responses use UTC with exactly six fractional digits. When this user was created.
    UsersListResponse:
      type: object
      description: A page of the caller's member's users.
      required:
        - users
        - next_page_url
      properties:
        users:
          type: array
          maxItems: 100
          description: One page of the member's users.
          items:
            $ref: '#/components/schemas/MemberUser'
        next_page_url:
          $ref: '#/components/schemas/NextPageURL'
    EntityId:
      type: string
      description: 'A UDX-assigned public entity identifier. It is an opaque string: treat it as a stable key with no guaranteed format, length, ordering, or numeric meaning. Entity identifiers remain scoped to their resource and environment.'
      example: '6820943174116859281'
    TimeInForce:
      type: string
      enum:
        - gtc
        - ioc
        - fok
        - day
      description: 'How long the order stays active when placing it: gtc (good till canceled), ioc (immediate or cancel), fok (fill or kill), or day (good until the end of the trading day).'
    OrderTimeInForce:
      type: string
      enum:
        - gtc
        - ioc
        - fok
        - day
        - unknown
      description: 'The time-in-force reported on an order. Adds `unknown` to the placement values (`TimeInForce`): the exchange may report it for an order that reached the account through another channel with a time-in-force UDX does not model, so the order stays readable. `unknown` is read-only and is never accepted when placing an order.'
    SelfTradePreventionType:
      type: string
      enum:
        - placed
        - resting
      description: Self-trade-prevention policy when an incoming order would match one of the caller's own resting orders. `placed` cancels the incoming order at the point it would self-trade; `resting` cancels the resting order and lets matching continue. Defaults to `placed`.
    OrderStatus:
      type: string
      enum:
        - resting
        - partially_filled
        - filled
        - canceled
        - rejected
      description: An order's status. `rejected` means the exchange rejected it; `canceled` covers user cancels and expiries.
    OrderStatusFilter:
      type: string
      enum:
        - open
        - resting
        - partially_filled
        - filled
        - canceled
        - rejected
      description: Order status to filter a list by. Any OrderStatus value, plus `open`, which matches orders that are resting or partially_filled.
    Order:
      type: object
      description: An order on the exchange, priced from the YES side.
      required:
        - order_id
        - ticker
        - side
        - quantity
        - price
        - time_in_force
        - status
        - filled_quantity
        - remaining_quantity
        - fees_paid
        - created_at
      properties:
        order_id:
          allOf:
            - $ref: '#/components/schemas/ExchangeId'
          description: Exchange-assigned order identifier.
        client_order_id:
          allOf:
            - $ref: '#/components/schemas/ClientId'
          description: The caller's correlation id for this order.
        ticker:
          $ref: '#/components/schemas/Ticker'
        side:
          $ref: '#/components/schemas/OrderSide'
        quantity:
          allOf:
            - $ref: '#/components/schemas/FixedPointQuantity'
          description: Order quantity, in contracts.
        price:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Limit price in YES price space, in dollars, regardless of side.
        time_in_force:
          $ref: '#/components/schemas/OrderTimeInForce'
        status:
          $ref: '#/components/schemas/OrderStatus'
        filled_quantity:
          allOf:
            - $ref: '#/components/schemas/FixedPointQuantity'
          description: The quantity of the order that has been filled.
        remaining_quantity:
          allOf:
            - $ref: '#/components/schemas/FixedPointQuantity'
          description: The quantity of the order that is currently resting.
        average_fill_price:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Volume-weighted average fill price. Present when filled_quantity > 0.
        fees_paid:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Total fees (commission) collected on the order so far, in dollars.
        created_at:
          type: string
          format: date-time
          maxLength: 40
          description: When the order was created. UDX timestamps use RFC 3339; requests require an explicit UTC offset and zero to six fractional digits; responses use UTC with exactly six fractional digits.
          example: '2026-01-01T00:00:00.000000Z'
    OrderResponse:
      type: object
      description: A single order.
      required:
        - order
      properties:
        order:
          $ref: '#/components/schemas/Order'
    OrdersListResponse:
      type: object
      description: A page of orders.
      required:
        - orders
        - next_page_url
      properties:
        orders:
          type: array
          maxItems: 100
          description: One page of orders.
          items:
            $ref: '#/components/schemas/Order'
        next_page_url:
          $ref: '#/components/schemas/NextPageURL'
    CreateOrderRequest:
      type: object
      description: The fields needed to place an order.
      required:
        - ticker
        - client_order_id
        - side
        - quantity
        - price
        - time_in_force
      properties:
        ticker:
          $ref: '#/components/schemas/Ticker'
        client_order_id:
          $ref: '#/components/schemas/ClientId'
        side:
          $ref: '#/components/schemas/OrderSide'
        quantity:
          allOf:
            - $ref: '#/components/schemas/FixedPointQuantity'
          description: Order quantity, in contracts.
        price:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Limit price in YES price space, in dollars, regardless of side.
        time_in_force:
          $ref: '#/components/schemas/TimeInForce'
        post_only:
          type: boolean
          default: false
          description: If true, the order only ever rests (adds liquidity); an order that would cross the book on placement is rejected. Incompatible with ioc/fok.
        account_id:
          allOf:
            - $ref: '#/components/schemas/EntityId'
          description: Account to place the order under, by its UDX-assigned public entity identifier. Required for an unrestricted API key; an account-restricted key uses its bound account, and an account_id that names a different account is rejected.
        self_trade_prevention_type:
          allOf:
            - $ref: '#/components/schemas/SelfTradePreventionType'
          description: Self-trade-prevention policy. Defaults to `placed`.
    AmendOrderRequest:
      type: object
      description: The fields needed to amend a resting order's price and/or quantity.
      required:
        - ticker
        - quantity
        - price
      properties:
        ticker:
          $ref: '#/components/schemas/Ticker'
        quantity:
          allOf:
            - $ref: '#/components/schemas/FixedPointQuantity'
          description: New total order quantity, in contracts (absolute, not a delta). Must exceed the quantity already filled.
        price:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: New limit price in YES price space, in dollars.
        client_order_id:
          allOf:
            - $ref: '#/components/schemas/ClientId'
          description: The existing order's client_order_id, for the caller's reference (the order is identified by the order_id path parameter).
        updated_client_order_id:
          allOf:
            - $ref: '#/components/schemas/ClientId'
          description: New correlation id for the amended order. The order keeps its existing client_order_id when omitted.
    RfqLeg:
      type: object
      description: A single component leg of an RFQ.
      required:
        - ticker
      properties:
        ticker:
          $ref: '#/components/schemas/Ticker'
        opposing_side:
          type: boolean
          default: false
          description: Whether this leg takes the side opposite the RFQ (true) or the same side (false, the default).
    RfqStatus:
      type: string
      enum:
        - open
        - closed
        - rejected
      description: An RFQ's status. `open` is still soliciting quotes; `rejected` was rejected by the exchange; `closed` is otherwise terminal (the RFQ was accepted, expired, canceled, or otherwise concluded without a trade).
    Rfq:
      type: object
      description: A request for quote (RFQ) on the exchange.
      required:
        - rfq_id
        - legs
        - status
      properties:
        rfq_id:
          allOf:
            - $ref: '#/components/schemas/ExchangeId'
          description: Exchange-assigned RFQ identifier.
        requester_id:
          allOf:
            - $ref: '#/components/schemas/RfqParticipantId'
          description: The pseudonymous participant identifier of the user who raised this RFQ. Stable across that user's RFQs so makers can correlate repeat requesters; on your own RFQs it equals your `rfq_participant_id` from `GET /users/me`.
        client_rfq_id:
          allOf:
            - $ref: '#/components/schemas/ClientId'
          description: The requester's correlation id for this RFQ. Present only on RFQs raised by the caller's member; it is the requester's private correlation id on RFQs soliciting the caller.
        legs:
          type: array
          minItems: 1
          maxItems: 100
          description: The component legs of the RFQ.
          items:
            $ref: '#/components/schemas/RfqLeg'
        side:
          allOf:
            - $ref: '#/components/schemas/OrderSide'
          description: The side the customer wants to execute. Absent for a two-sided RFQ.
        quantity:
          allOf:
            - $ref: '#/components/schemas/FixedPointQuantity'
          description: Number of contracts requested. Present when sized in contracts.
        cash_quantity:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Size of the RFQ in dollars. Present when sized in cash.
        status:
          $ref: '#/components/schemas/RfqStatus'
        created_at:
          type: string
          format: date-time
          maxLength: 40
          description: When the RFQ was created. UDX timestamps use RFC 3339; requests require an explicit UTC offset and zero to six fractional digits; responses use UTC with exactly six fractional digits.
          example: '2026-01-01T00:00:00.000000Z'
        expires_at:
          type: string
          format: date-time
          maxLength: 40
          description: When the RFQ stops soliciting quotes. A quote must be submitted, accepted, and confirmed within this deadline. UDX timestamps use RFC 3339; responses use UTC with exactly six fractional digits.
          example: '2026-01-01T00:01:00.000000Z'
    RfqResponse:
      type: object
      description: A single RFQ.
      required:
        - rfq
      properties:
        rfq:
          $ref: '#/components/schemas/Rfq'
    RfqsListResponse:
      type: object
      description: A page of RFQs.
      required:
        - rfqs
        - next_page_url
      properties:
        rfqs:
          type: array
          maxItems: 100
          description: One page of RFQs.
          items:
            $ref: '#/components/schemas/Rfq'
        next_page_url:
          $ref: '#/components/schemas/NextPageURL'
    CreateRfqRequest:
      type: object
      description: The fields needed to create an RFQ. Provide exactly one of ticker or legs, and exactly one of quantity or cash_quantity.
      required:
        - client_rfq_id
      properties:
        client_rfq_id:
          $ref: '#/components/schemas/ClientId'
        ticker:
          allOf:
            - $ref: '#/components/schemas/Ticker'
          description: Market to request a quote for (single market, or an existing combo by its ticker). Provide exactly one of ticker or legs.
        legs:
          type: array
          minItems: 1
          maxItems: 100
          description: Component legs of the RFQ. A single leg is one market; multiple legs request the combined strategy. Provide exactly one of ticker or legs.
          items:
            $ref: '#/components/schemas/RfqLeg'
        quantity:
          allOf:
            - $ref: '#/components/schemas/FixedPointQuantity'
          description: Number of contracts to quote, as a whole number. Provide exactly one of quantity or cash_quantity.
        cash_quantity:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Size of the RFQ in dollars. Provide exactly one of quantity or cash_quantity.
        side:
          allOf:
            - $ref: '#/components/schemas/OrderSide'
          description: The side the customer wants to execute. Omit for a two-sided quote.
        account_id:
          allOf:
            - $ref: '#/components/schemas/EntityId'
          description: Account to create the RFQ under, by its UDX-assigned public entity identifier. Required for an unrestricted API key; an account-restricted key uses its bound account, and an account_id that names a different account is rejected.
    QuoteStatus:
      type: string
      enum:
        - open
        - accepted
        - confirmed
        - executed
        - cancelled
        - rejected
      description: 'A quote''s status: `open` (live), `accepted` (a taker accepted it), `confirmed` (the maker confirmed it after acceptance), `executed` (the trade completed), `cancelled` (pulled/expired), or `rejected`.'
    Quote:
      type: object
      description: A single-sided quote (a bid or an offer) on the exchange.
      required:
        - quote_id
        - client_quote_id
        - rfq_id
        - ticker
        - side
        - price
        - quantity
        - status
      properties:
        quote_id:
          allOf:
            - $ref: '#/components/schemas/ExchangeId'
          description: The exchange-assigned identifier for this quote. Unique across the exchange, unlike client_quote_id, which is unique only within an account.
        client_quote_id:
          allOf:
            - $ref: '#/components/schemas/ClientId'
          description: The caller's correlation id for this quote.
        quoter_id:
          allOf:
            - $ref: '#/components/schemas/RfqParticipantId'
          description: The pseudonymous participant identifier of the user who submitted this quote. Stable across that user's quotes; on your own quotes it equals your `rfq_participant_id` from `GET /users/me`.
        requester_id:
          allOf:
            - $ref: '#/components/schemas/RfqParticipantId'
          description: The pseudonymous participant identifier of the user who raised the RFQ this quote responds to. Stable across that user's RFQs; it matches the RFQ's `requester_id`.
        rfq_id:
          allOf:
            - $ref: '#/components/schemas/ExchangeId'
          description: The RFQ this quote responds to.
        ticker:
          $ref: '#/components/schemas/Ticker'
        side:
          allOf:
            - $ref: '#/components/schemas/OrderSide'
          description: The side of the quote — `buy` bids, `sell` offers.
        price:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Quote price in YES price space, in dollars.
        quantity:
          allOf:
            - $ref: '#/components/schemas/FixedPointQuantity'
          description: Number of contracts offered.
        status:
          $ref: '#/components/schemas/QuoteStatus'
        created_at:
          type: string
          format: date-time
          maxLength: 40
          description: When the Quote was created. UDX timestamps use RFC 3339; requests require an explicit UTC offset and zero to six fractional digits; responses use UTC with exactly six fractional digits.
          example: '2026-01-01T00:00:00.000000Z'
    QuoteResponse:
      type: object
      description: A single quote.
      required:
        - quote
      properties:
        quote:
          $ref: '#/components/schemas/Quote'
    QuotesListResponse:
      type: object
      description: A page of quotes.
      required:
        - quotes
        - next_page_url
      properties:
        quotes:
          type: array
          maxItems: 100
          description: One page of quotes.
          items:
            $ref: '#/components/schemas/Quote'
        next_page_url:
          $ref: '#/components/schemas/NextPageURL'
    CreateQuoteRequest:
      type: object
      description: The fields needed to submit a single-sided quote in response to an RFQ.
      required:
        - rfq_id
        - client_quote_id
        - side
        - price
        - quantity
      properties:
        rfq_id:
          allOf:
            - $ref: '#/components/schemas/ExchangeId'
          description: The RFQ this quote responds to.
        ticker:
          allOf:
            - $ref: '#/components/schemas/Ticker'
          description: Optional — the RFQ's market is authoritative. Omit it for a combo RFQ, whose synthetic (multi-leg) market is not separately addressable by ticker. When supplied it must equal the RFQ's market, or the quote is rejected.
        client_quote_id:
          $ref: '#/components/schemas/ClientId'
        side:
          allOf:
            - $ref: '#/components/schemas/OrderSide'
          description: The side of the quote — `buy` bids, `sell` offers.
        price:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Quote price in YES price space, in dollars.
        quantity:
          allOf:
            - $ref: '#/components/schemas/FixedPointQuantity'
          description: Number of contracts offered.
        account_id:
          allOf:
            - $ref: '#/components/schemas/EntityId'
          description: Account to quote from, by its UDX-assigned public entity identifier. Required for an unrestricted API key; an account-restricted key uses its bound account, and an account_id that names a different account is rejected.
    AcceptQuoteRequest:
      type: object
      description: 'The fields needed to accept (trade against) a quote. The taker echoes the terms it was quoted: rfq_id names the RFQ the quote answers, and side, price, and quantity must match the quote (side flipped — the taker executes the opposite side).'
      required:
        - rfq_id
        - side
        - price
        - quantity
        - client_order_id
      properties:
        rfq_id:
          allOf:
            - $ref: '#/components/schemas/ExchangeId'
          description: The exchange id of the RFQ the quote answers. With the path quote_id it addresses the quote to accept.
        side:
          allOf:
            - $ref: '#/components/schemas/OrderSide'
          description: 'The side to execute — must be opposite the quote''s side: `buy` lifts an offer, `sell` hits a bid.'
        price:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: The quote's price in YES price space, in dollars. Must match the quote; a mismatch is rejected.
        quantity:
          allOf:
            - $ref: '#/components/schemas/FixedPointQuantity'
          description: The number of contracts to accept, in contracts.
        client_order_id:
          allOf:
            - $ref: '#/components/schemas/ClientId'
          description: Correlation id for the resulting order — required, and the id you match in get-fills to find the resulting trade after the maker completes last look, since the accept returns no body.
        account_id:
          allOf:
            - $ref: '#/components/schemas/EntityId'
          description: Account to execute under, by its UDX-assigned public entity identifier. Required for an unrestricted API key; an account-restricted key uses its bound account, and an account_id that names a different account is rejected.
    SignedFixedPointDollars:
      type: string
      pattern: ^-?[0-9]+(\.[0-9]{1,6})?$
      maxLength: 25
      description: An amount in dollars, as a fixed-point decimal string with up to 6 decimal places, which may be negative (e.g. a realized loss).
      example: '-12.50'
    SignedFixedPointQuantity:
      type: string
      pattern: ^-?[0-9]+(\.[0-9]{1,2})?$
      maxLength: 25
      description: A quantity in contracts, as a fixed-point decimal string with 0–2 decimal places, which may be negative for a short position.
      example: '-60'
    MarketResult:
      type: string
      enum:
        - 'yes'
        - 'no'
        - void
      description: 'A market''s settlement outcome: `yes` (YES won), `no` (NO won), or `void` (resolved at a partial value).'
    Balance:
      type: object
      description: The cash balance for an account.
      required:
        - account_id
        - balance
      properties:
        account_id:
          allOf:
            - $ref: '#/components/schemas/EntityId'
          description: The account this balance is for.
        balance:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Total account cash balance, in dollars.
        available_balance:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Funds available to open new positions, in dollars. The `ticker` parameter scopes this value to that market.
        open_orders:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Funds held by open orders, in dollars.
        margin_held:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Funds held as margin against open positions and orders, in dollars.
        updated_at:
          type: string
          format: date-time
          maxLength: 40
          description: When the Balance last changed. UDX timestamps use RFC 3339; requests require an explicit UTC offset and zero to six fractional digits; responses use UTC with exactly six fractional digits.
          example: '2026-01-01T00:00:00.000000Z'
    BalancesListResponse:
      type: object
      description: A page of account balances.
      required:
        - balances
        - next_page_url
      properties:
        balances:
          type: array
          maxItems: 100
          description: One page of account balances.
          items:
            $ref: '#/components/schemas/Balance'
        next_page_url:
          $ref: '#/components/schemas/NextPageURL'
    Position:
      type: object
      description: An open position in a market.
      required:
        - account_id
        - ticker
        - position
      properties:
        account_id:
          allOf:
            - $ref: '#/components/schemas/EntityId'
          description: The account holding the position.
        ticker:
          $ref: '#/components/schemas/Ticker'
        position:
          allOf:
            - $ref: '#/components/schemas/SignedFixedPointQuantity'
          description: Net position in contracts; negative for a short position.
        quantity_bought:
          allOf:
            - $ref: '#/components/schemas/FixedPointQuantity'
          description: Total contracts bought.
        quantity_sold:
          allOf:
            - $ref: '#/components/schemas/FixedPointQuantity'
          description: Total contracts sold.
        cost:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Cost basis of the position, in dollars.
        realized_pnl:
          allOf:
            - $ref: '#/components/schemas/SignedFixedPointDollars'
          description: Realized profit/loss in dollars; may be negative.
        updated_at:
          type: string
          format: date-time
          maxLength: 40
          description: When the position last changed. UDX timestamps use RFC 3339; requests require an explicit UTC offset and zero to six fractional digits; responses use UTC with exactly six fractional digits.
          example: '2026-01-01T00:00:00.000000Z'
    PositionsListResponse:
      type: object
      description: A page of open positions.
      required:
        - positions
        - next_page_url
      properties:
        positions:
          type: array
          maxItems: 100
          description: One page of open positions.
          items:
            $ref: '#/components/schemas/Position'
        next_page_url:
          $ref: '#/components/schemas/NextPageURL'
    Fill:
      type: object
      description: An execution of one of the caller's own orders. A multi-leg Fill keeps the execution-level fee on this parent and lists every component in `legs`; a single-market Fill has an empty `legs` array.
      required:
        - trade_id
        - order_id
        - account_id
        - ticker
        - side
        - price
        - quantity
        - fee
        - is_taker
        - executed_at
        - legs
      properties:
        trade_id:
          type: string
          maxLength: 64
          description: Exchange-assigned trade identifier.
          example: BP1ZQ131E04J
        order_id:
          allOf:
            - $ref: '#/components/schemas/ExchangeId'
          description: The filled order's exchange identifier.
        client_order_id:
          allOf:
            - $ref: '#/components/schemas/ClientId'
          description: The filled order's client correlation id.
        account_id:
          allOf:
            - $ref: '#/components/schemas/EntityId'
          description: The UDX account public identifier used by the filled order.
        ticker:
          $ref: '#/components/schemas/Ticker'
        side:
          allOf:
            - $ref: '#/components/schemas/OrderSide'
          description: Side of the filled order.
        price:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Fill price, in YES dollars.
        quantity:
          allOf:
            - $ref: '#/components/schemas/FixedPointQuantity'
          description: Contracts filled.
        fee:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Fee collected for this execution.
        is_taker:
          type: boolean
          description: Whether the caller's order was the aggressor (taker) of the trade.
        executed_at:
          type: string
          format: date-time
          maxLength: 40
          description: When this Fill's execution occurred. UDX timestamps use RFC 3339; requests require an explicit UTC offset and zero to six fractional digits; responses use UTC with exactly six fractional digits.
          example: '2026-01-01T00:00:00.000000Z'
        legs:
          type: array
          maxItems: 100
          description: Component Fill details for a multi-leg market. Empty for a single-market Fill.
          items:
            $ref: '#/components/schemas/FillLeg'
    FillLeg:
      type: object
      description: One component of a multi-leg Fill.
      required:
        - ticker
        - side
        - price
        - quantity
      properties:
        ticker:
          $ref: '#/components/schemas/Ticker'
        side:
          allOf:
            - $ref: '#/components/schemas/OrderSide'
          description: Side of this component Fill.
        price:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Component Fill price, in YES dollars.
        quantity:
          allOf:
            - $ref: '#/components/schemas/FixedPointQuantity'
          description: Contracts filled for this component.
    FillsListResponse:
      type: object
      description: A page of the caller's fills, newest first.
      required:
        - fills
        - next_page_url
      properties:
        fills:
          type: array
          maxItems: 100
          description: One page of fills.
          items:
            $ref: '#/components/schemas/Fill'
        next_page_url:
          $ref: '#/components/schemas/NextPageURL'
    Settlement:
      type: object
      description: A settlement — the payout of one account's position in one market after that market resolved.
      required:
        - account_id
        - ticker
        - quantity
        - market_result
        - settlement_price
        - payout
        - settled_at
      properties:
        account_id:
          allOf:
            - $ref: '#/components/schemas/EntityId'
          description: The account that held the position.
        ticker:
          $ref: '#/components/schemas/Ticker'
        quantity:
          allOf:
            - $ref: '#/components/schemas/FixedPointQuantity'
          description: Net position held at resolution (absolute value), in contracts.
        market_result:
          $ref: '#/components/schemas/MarketResult'
        settlement_price:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Per-contract settlement value, in dollars.
        payout:
          allOf:
            - $ref: '#/components/schemas/SignedFixedPointDollars'
          description: 'Signed settlement cash flow for the position, in dollars: positive is credited to the account, negative is debited (a short position pays the settlement value at any non-zero result). Zero when the market settles at $0.00.'
        settled_at:
          type: string
          format: date-time
          maxLength: 40
          description: When the position settled. UDX timestamps use RFC 3339; requests require an explicit UTC offset and zero to six fractional digits; responses use UTC with exactly six fractional digits.
          example: '2026-01-01T00:00:00.000000Z'
    SettlementsListResponse:
      type: object
      description: A page of settled positions.
      required:
        - settlements
        - next_page_url
      properties:
        settlements:
          type: array
          maxItems: 100
          description: One page of settled positions.
          items:
            $ref: '#/components/schemas/Settlement'
        next_page_url:
          $ref: '#/components/schemas/NextPageURL'
    CreateAccountRequest:
      type: object
      description: The fields needed to create an account.
      required:
        - name
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 200
          description: Human-readable name for the account.
          example: market-making desk
    Account:
      type: object
      description: An account belonging to the caller's member.
      required:
        - id
        - name
        - status
      properties:
        id:
          allOf:
            - $ref: '#/components/schemas/EntityId'
          description: The UDX account public identifier.
        name:
          type: string
          minLength: 1
          maxLength: 200
          description: Human-readable name for the account.
        status:
          type: string
          description: Readiness for this user. pending means account or access setup is still running. active means setup is complete and the account can trade. failed means setup failed; UDX retries it, so callers should continue polling and contact UDX support if failure persists.
          enum:
            - pending
            - active
            - failed
    AccountsListResponse:
      type: object
      description: A page of accounts available to the current user.
      required:
        - accounts
        - next_page_url
      properties:
        accounts:
          type: array
          maxItems: 100
          description: One page of accounts connected by active grants.
          items:
            $ref: '#/components/schemas/Account'
        next_page_url:
          $ref: '#/components/schemas/NextPageURL'
    AccountResponse:
      type: object
      description: A single account.
      required:
        - account
      properties:
        account:
          $ref: '#/components/schemas/Account'
    CreateGrantRequest:
      type: object
      description: The fields needed to grant a user access to an account.
      required:
        - user_id
      properties:
        user_id:
          allOf:
            - $ref: '#/components/schemas/EntityId'
          description: The public identifier of the member's user to grant access to.
    Grant:
      type: object
      description: A user's authorization to reach one of the member's accounts. The account is the one addressed in the request path.
      required:
        - id
        - user_id
        - status
        - created_at
      properties:
        id:
          allOf:
            - $ref: '#/components/schemas/EntityId'
          description: The grant's public identifier.
        user_id:
          allOf:
            - $ref: '#/components/schemas/EntityId'
          description: The user this grant authorizes.
        status:
          type: string
          description: 'Readiness of the granted access: pending (exchange setup is still running), active (the grant is fully usable), or failed (setup failed and UDX is retrying it).'
          enum:
            - pending
            - active
            - failed
        created_at:
          type: string
          format: date-time
          maxLength: 40
          description: UDX timestamps use RFC 3339; responses use UTC with exactly six fractional digits. When access was granted.
    GrantResponse:
      type: object
      description: A single grant.
      required:
        - grant
      properties:
        grant:
          $ref: '#/components/schemas/Grant'
    GrantsListResponse:
      type: object
      description: A page of an account's grants.
      required:
        - grants
        - next_page_url
      properties:
        grants:
          type: array
          maxItems: 100
          description: One page of the account's grants.
          items:
            $ref: '#/components/schemas/Grant'
        next_page_url:
          $ref: '#/components/schemas/NextPageURL'
    TransferRequest:
      type: object
      description: The fields needed to transfer cash between two accounts.
      required:
        - from_account_id
        - to_account_id
        - amount
      properties:
        from_account_id:
          allOf:
            - $ref: '#/components/schemas/EntityId'
          description: The account to debit.
        to_account_id:
          allOf:
            - $ref: '#/components/schemas/EntityId'
          description: The account to credit.
        amount:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Amount to transfer, in dollars.
    Transfer:
      type: object
      description: A completed transfer between two accounts.
      required:
        - from_account_id
        - to_account_id
        - amount
      properties:
        from_account_id:
          allOf:
            - $ref: '#/components/schemas/EntityId'
          description: The debited account.
        to_account_id:
          allOf:
            - $ref: '#/components/schemas/EntityId'
          description: The credited account.
        amount:
          allOf:
            - $ref: '#/components/schemas/FixedPointDollars'
          description: Amount transferred, in dollars.
    TransferResponse:
      type: object
      description: A completed transfer.
      required:
        - transfer
      properties:
        transfer:
          $ref: '#/components/schemas/Transfer'
    ProblemDetails:
      type: object
      description: An RFC 9457 machine-readable error, returned on every non-2xx response. The response's Content-Language header identifies the language used by title and detail, and Vary includes Accept-Language.
      required:
        - title
        - status
      properties:
        type:
          type: string
          format: uri-reference
          maxLength: 2048
          description: A stable URI identifying the error's general category. Usually absent (equivalent to "about:blank" per the RFC); documented rate controls use closed URN values so callers can distinguish same-status retry causes without parsing localized prose.
        title:
          type: string
          maxLength: 40
          example: Bad Request
          description: A localized, human-readable summary of the error category. Stable for a given status code and resolved language — clients must not use it as a machine-readable discriminator.
        status:
          type: integer
          example: 400
          description: The HTTP status code, repeated from the response itself.
        detail:
          type: string
          maxLength: 500
          example: malformed request body
          description: A localized, human-readable explanation specific to this occurrence. Clients must not parse it for machine-readable information.
        instance:
          type: string
          format: uri-reference
          maxLength: 100
          example: urn:request-id:8f14e45f-ceea-4abc-a743-e89a34d3f6ef
          description: An identifier for this specific occurrence, so it can be correlated with server-side logs if you need to report it.
