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

> ## Agent Instructions
> To integrate AGG, start with Quickstart: REST (https://docs.agg.market/quickstart/rest), then Order lifecycle & statuses (https://docs.agg.market/concepts/order-lifecycle).
> Track every trade until it reaches a terminal status. Before retrying a failed or timed-out call, read Errors, retries & idempotency (https://docs.agg.market/concepts/errors).
> The API reference is generated from https://docs.agg.market/openapi/openapi.json.

# Submit signatures for a pending self-custody withdrawal

> Accepts the signatures (or broadcast transaction hashes) a self-custody withdrawal asked for in `pendingSignatures`, and returns the withdrawal with whatever is still outstanding.

## Integration guide

* **Before you call:** [Sign in and manage sessions](https://docs.agg.market/concepts/authentication.md).
* **Workflow:** [Fund an account and track withdrawals](https://docs.agg.market/concepts/funding.md).
* **Next:** [Handle failures and retry safely](https://docs.agg.market/concepts/errors.md).


## OpenAPI

````yaml /openapi/openapi.json post /execution/withdrawals/{withdrawalId}/signatures
openapi: 3.0.2
info:
  title: AGG API
  version: 1.0.0
  description: >-
    Prediction market aggregator REST API — authentication, users, venue events,
    venue markets, orderbooks, charts, and execution workflows.
servers:
  - url: https://api.agg.market
    description: Production
security: []
tags:
  - name: Authentication
    description: Sign users in and manage their session tokens.
  - name: Markets
    description: Find events, markets and outcomes to trade.
  - name: Market Data
    description: Live orderbooks, prices, charts and scores for those markets.
  - name: Trading
    description: Quote, place, sign, track and cancel orders.
  - name: Portfolio
    description: A user's orders, positions, balances and activity.
  - name: Funding
    description: Deposit addresses, withdrawals, balance refills and fiat on-ramp.
  - name: Users
    description: The signed-in user's profile, linked accounts, KYC and venue keys.
  - name: Hosted Venue Accounts
    description: Provision, fund and withdraw from venue accounts hosted for the user.
  - name: Webhooks
    description: Configure and operate webhook delivery to your server.
  - name: Partner Admin
    description: Server-side reads across your app's users, orders and analytics.
  - name: Paper Trading
    description: Simulated accounts and orders for testing without real funds.
  - name: News
    description: News feeds linked to markets.
  - name: Correlated Markets
    description: Markets related to a given market and the effect of its resolution.
paths:
  /execution/withdrawals/{withdrawalId}/signatures:
    post:
      tags:
        - Funding
      summary: Submit signatures for a pending self-custody withdrawal
      description: >-
        Accepts the signatures (or broadcast transaction hashes) a self-custody
        withdrawal asked for in `pendingSignatures`, and returns the withdrawal
        with whatever is still outstanding.
      operationId: submitWithdrawalSignatures
      parameters:
        - name: withdrawalId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - signatures
              properties:
                signatures:
                  minItems: 1
                  maxItems: 32
                  type: array
                  items:
                    type: object
                    required:
                      - stepId
                    properties:
                      stepId:
                        minLength: 1
                        maxLength: 128
                        description: >-
                          `stepId` of the pendingSignatures entry being
                          answered.
                        type: string
                      signature:
                        minLength: 1
                        maxLength: 2048
                        description: >-
                          0x-prefixed hex signature. Send this for every `type`
                          except `transaction`.
                        type: string
                      txHash:
                        minLength: 66
                        maxLength: 66
                        description: >-
                          0x-prefixed 32-byte hash of the transaction you
                          broadcast. Send this, and only this, for `type:
                          "transaction"`. Exactly one of `signature` and
                          `txHash` is required.
                        type: string
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WithdrawResponse'
        '400':
          description: '400'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: '401'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '403':
          description: '403'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: '404'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - appId: []
          bearerAuth: []
components:
  schemas:
    WithdrawResponse:
      type: object
      required:
        - withdrawalId
        - status
        - requested
        - completedAmountRaw
        - destination
        - legs
        - expected
        - pricingStatus
        - errorMessage
        - sources
      properties:
        withdrawalId:
          description: Withdrawal id. Poll it on the status endpoint.
          type: string
        status:
          description: >-
            Withdrawal status. `pending`: accepted, not started (the submit
            response always returns this). `bridging`: moving funds across
            chains. `transferring`: same-chain transfer in progress. Terminal:
            `completed`, `partial` (some sources delivered; see
            `completedAmountRaw`), `failed`.
          type: string
          enum:
            - pending
            - bridging
            - transferring
            - completed
            - partial
            - failed
        requested:
          description: What is being withdrawn.
          type: object
          required:
            - tokenSymbol
            - amountRaw
          properties:
            tokenSymbol:
              description: Stable-coin symbol the withdrawal is denominated in.
              type: string
              enum:
                - USDC
                - USDC.e
                - USDT
            amountRaw:
              pattern: ^[1-9][0-9]*$
              description: >-
                Amount being withdrawn; with `max`, the capped amount. Integer
                string in the destination token's atomic units (6 decimals, so
                1000000 = 1 USDC; 18 decimals on BNB Chain).
              type: string
        completedAmountRaw:
          description: >-
            Estimated total delivered by the completed parts. `null` until the
            withdrawal is terminal. Integer string in the destination token's
            atomic units (6 decimals, so 1000000 = 1 USDC; 18 decimals on BNB
            Chain).
          type: string
          nullable: true
        destination:
          description: Where the funds are delivered.
          type: object
          required:
            - chainId
            - address
            - tokenSymbol
          properties:
            chainId:
              minimum: 1
              description: Delivery chain.
              type: integer
            address:
              pattern: ^(0x[a-fA-F0-9]{40}|[1-9A-HJ-NP-Za-km-z]{32,44})$
              description: Recipient address.
              type: string
            tokenSymbol:
              description: Stable-coin symbol the withdrawal is denominated in.
              type: string
              enum:
                - USDC
                - USDC.e
                - USDT
        legs:
          description: Transfers that make up the withdrawal.
          type: array
          items:
            $ref: '#/components/schemas/WithdrawalLeg'
        expected:
          description: >-
            Quote for the withdrawal. `null` fields unless `pricingStatus` is
            `quoted`.
          type: object
          required:
            - outputRaw
            - feeRaw
            - etaSeconds
          properties:
            outputRaw:
              description: >-
                Estimated amount delivered. Integer string in the destination
                token's atomic units (6 decimals, so 1000000 = 1 USDC; 18
                decimals on BNB Chain).
              type: string
              nullable: true
            feeRaw:
              description: >-
                Fee deducted from the withdrawn amount (amount in minus amount
                delivered). The submit response returns the quoted fee; the
                status endpoint returns the actual fee once the withdrawal is
                terminal. Integer string in the destination token's atomic units
                (6 decimals, so 1000000 = 1 USDC; 18 decimals on BNB Chain).
              type: string
              nullable: true
            etaSeconds:
              description: Estimated seconds to arrival. Currently always `null`.
              type: integer
              nullable: true
        pricingStatus:
          description: >-
            Fee quote state. `quoted`: `expected` holds a current quote.
            `unquoted` / `quoting`: no quote yet. `unviable`: at least one
            source is too small to cover its fees.
          type: string
          enum:
            - unquoted
            - quoting
            - quoted
            - unviable
        errorMessage:
          description: >-
            Why the withdrawal failed or only partly completed. `null`
            otherwise, and always `null` on the submit response (errors there
            are returned as HTTP errors).
          type: string
          nullable: true
        sources:
          description: Balances the withdrawal is funded from.
          type: array
          items:
            $ref: '#/components/schemas/WithdrawalSource'
        pendingSignatures:
          description: >-
            Self-custody only: requests the signing wallet must answer before
            the withdrawal continues. Absent for managed custody. Answer them on
            POST /execution/withdrawals/{withdrawalId}/signatures.
          type: array
          items:
            $ref: '#/components/schemas/PendingSignature'
    ErrorMessage:
      type: object
      required:
        - message
      properties:
        message:
          type: string
    WithdrawalLeg:
      type: object
      required:
        - type
        - status
        - sourceChainId
        - destChainId
        - amountRaw
        - txHash
        - bridgeOperationId
      properties:
        type:
          description: >-
            `transfer`: same chain and same token, sent straight to the
            recipient. `bridge`: cross-chain, or a token swap on the same chain.
          type: string
          enum:
            - transfer
            - bridge
        status:
          description: >-
            Progress of one leg: `planned` (the submit response always returns
            this) → `submitted` → `confirmed`, or `failed`.
          type: string
          enum:
            - planned
            - submitted
            - confirmed
            - failed
        sourceChainId:
          description: Chain the funds for this leg come from.
          type: integer
        destChainId:
          description: Chain they are delivered on.
          type: integer
        amountRaw:
          pattern: ^[1-9][0-9]*$
          description: >-
            Amount taken from the source for this leg. Integer string in the
            source token's atomic units; scale by that source's `decimals` (6
            for most stablecoins, 18 on BNB Chain).
          type: string
        txHash:
          description: Transaction for this leg, once sent.
          type: string
          nullable: true
        bridgeOperationId:
          description: Id of the cross-chain transfer, once created.
          type: string
          nullable: true
        sourceTokenSymbol:
          description: >-
            Source token when it differs from the delivered token (e.g. USDC.e
            funding a USDC withdrawal). Absent when they match: use the
            withdrawal's `tokenSymbol`.
          type: string
        errorMessage:
          description: Why this leg failed. Returned by the status endpoint only.
          type: string
          nullable: true
    WithdrawalSource:
      type: object
      required:
        - sourceId
        - chainId
        - tokenSymbol
        - tokenAddress
        - decimals
        - amountRaw
        - status
        - txHash
        - bridgeOperationId
      properties:
        sourceId:
          description: Id of this funding source; matches lifecycle events.
          type: string
        chainId:
          description: Chain the funds are drawn from.
          type: integer
        tokenSymbol:
          description: Stable-coin symbol held by a selected withdrawal source.
          type: string
          enum:
            - USDC
            - USDC.e
            - USDT
            - pUSD
            - USD1
        tokenAddress:
          pattern: ^(0x[a-fA-F0-9]{40}|[1-9A-HJ-NP-Za-km-z]{32,44})$
          description: 'Source token address: EVM ERC-20 address or Solana SPL mint.'
          type: string
        decimals:
          minimum: 0
          maximum: 36
          description: Decimals of the source token. Use it to read `amountRaw`.
          type: integer
        amountRaw:
          pattern: ^[1-9][0-9]*$
          description: >-
            Amount drawn from this source. Integer string in the source token's
            atomic units; scale by that source's `decimals` (6 for most
            stablecoins, 18 on BNB Chain).
          type: string
        custodyKind:
          description: >-
            Present only for funds held at a venue: `DEPOSIT_WALLET` a venue
            deposit wallet, `VENUE_ACCOUNT` a venue account.
          type: string
          enum:
            - DEPOSIT_WALLET
            - VENUE_ACCOUNT
        venue:
          allOf:
            - $ref: '#/components/schemas/Venue'
          description: Venue holding the funds, with `custodyKind` (pred or tiprun).
        sourceVenueAccountId:
          minLength: 1
          description: AGG id of the venue account holding the funds.
          type: string
        sourceExternalAccountId:
          pattern: ^[1-9][0-9]{0,19}$
          description: The venue's own number for that account.
          type: string
        status:
          description: >-
            Progress of one funding source: `pending` → `submitted` →
            `confirmed`, or `failed`.
          type: string
          enum:
            - pending
            - submitted
            - confirmed
            - failed
        txHash:
          description: Transaction moving funds out of this source, once sent.
          type: string
          nullable: true
        bridgeOperationId:
          description: Id of the cross-chain transfer, once created.
          type: string
          nullable: true
        pendingReason:
          description: >-
            Present only while a venue-account source is submitted but not yet
            confirmed: what the withdrawal is waiting on.
            `awaiting_venue_approval` means the venue has not approved the
            withdrawal yet.
          type: string
          enum:
            - awaiting_venue_submission
            - awaiting_venue_approval
            - awaiting_chain
            - awaiting_venue_balance
            - rechecking
    PendingSignature:
      description: >-
        One request the user's wallet must sign (or send) before execution
        continues.
      type: object
      required:
        - stepId
        - type
        - venue
        - signerAddress
        - payload
        - expiresAt
      properties:
        stepId:
          description: >-
            Id of the execution step waiting on this request. Send it back
            verbatim.
          type: string
        type:
          $ref: '#/components/schemas/SignatureRequestType'
        venue:
          description: >-
            Who the request is for. Open set: usually a venue (`polymarket`,
            `hyperliquid`); `relay` for a bridge transfer and `referral` for a
            referral payout.
          type: string
        signerAddress:
          description: >-
            Address that must sign (or send) this request. For Hyperliquid it
            may be the user's approved agent address.
          type: string
        chainId:
          description: >-
            Chain the request is for, when set. Often absent: read the chain
            from `payload.domain.chainId` or `payload.chainId`.
          type: number
        payload:
          description: >-
            The data to sign or send, verbatim. Shape depends on `type`:
            `eip712`: viem-style typed data `{ domain, types, primaryType,
            message }`; sign it with signTypedData. `personal_sign`: either a
            string message, or `{ raw: "0x…" }` meaning sign those raw bytes
            (`signMessage({ message: { raw } })`). `transaction`: `{ chainId,
            to, value, data }` where `chainId` is a decimal string, `value` a
            decimal wei string and `data` hex; broadcast it from `signerAddress`
            and return `txHash`. `hl_l1_action`: EIP-712 typed data for a
            Hyperliquid action (primary type `Agent`, chainId 1337); sign with
            signTypedData. `eip7702_authorization`: `{ contractAddress, chainId,
            nonce }` (numbers for `chainId` and `nonce`); sign the EIP-7702
            authorization for them. `safe_tx`: `{ domain, types, primaryType:
            "SafeTx", message, safeTxHash }`; sign the raw 32-byte `safeTxHash`
            with personal_sign (`signMessage({ message: { raw: safeTxHash }
            })`), not with signTypedData.
        expiresAt:
          description: >-
            ISO-8601. After this the request is void and the trade must be
            re-quoted.
          type: string
        purpose:
          description: >-
            Why the request is asked for, when known; for display and routing
            only. Open set. Known values: `funding`, `funding_and_fee`, `fee` (a
            self-custody funding batch), `app_fee` (the app fee),
            `referral_payout` (an app-paid referral, signed by
            `referralPayerAddress`; read `type`, it is a `transaction` on EVM
            chains and an `eip712` on HyperCore), `hl_referral` (a partner
            referral code for the user's Hyperliquid account; see `optional`).
          type: string
        optional:
          description: >-
            `true` when the trade proceeds without this request, e.g. `purpose:
            "hl_referral"`. If your signer declines it, skip it and submit the
            rest.
          type: boolean
    Venue:
      type: string
      enum:
        - kalshi
        - polymarket
        - limitless
        - predict
        - pred
        - tiprun
        - myriad
        - hyperliquid
        - novig
        - prophetx
        - betdex
    SignatureRequestType:
      description: >-
        What to do with `payload`. `eip712`: sign typed data. `personal_sign`:
        sign a message (EIP-191). `transaction`: broadcast a transaction and
        return its hash. `solana_transaction`: sign a Solana transaction (not
        currently issued). `hl_l1_action`: sign a Hyperliquid action's typed
        data. `eip7702_authorization`: sign an EIP-7702 authorization (a raw
        digest many wallets cannot produce; if yours cannot, fill with
        `approveMode: "user_broadcast"` instead of throwing). `safe_tx`: a
        Polymarket Safe transaction; see `payload`.
      type: string
      enum:
        - eip712
        - personal_sign
        - transaction
        - solana_transaction
        - hl_l1_action
        - eip7702_authorization
        - safe_tx
  securitySchemes:
    appId:
      type: apiKey
      in: header
      name: x-app-id
      description: >-
        Your application ID. Required on app-tier and user-tier routes. Omitted
        on routes that authenticate with x-app-api-key only.
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT access token from POST /auth/verify. Required with x-app-id on user
        routes. On the smart-route quote it is optional and turns a preview into
        an executable quote.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.