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

# Withdraw funds

> Withdraws funds through the normal transfer/bridge planner. An optional requestId UUID makes exact-amount requests replayable: the same owner/key and parameters return the original lifecycle without dispatching twice; changed parameters return 409. Do not combine requestId with max. Continue polling the returned withdrawalId through terminal settlement.



## OpenAPI

````yaml /openapi/openapi.json post /execution/withdraw
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/withdraw:
    post:
      tags:
        - Funding
      summary: Withdraw funds
      description: >-
        Withdraws funds through the normal transfer/bridge planner. An optional
        requestId UUID makes exact-amount requests replayable: the same
        owner/key and parameters return the original lifecycle without
        dispatching twice; changed parameters return 409. Do not combine
        requestId with max. Continue polling the returned withdrawalId through
        terminal settlement.
      operationId: withdrawManaged
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - amountRaw
                - tokenSymbol
                - destinationAddress
                - destinationChainId
              properties:
                requestId:
                  format: uuid
                  description: >-
                    Optional idempotency key for an exact-amount transfer. Reuse
                    with the identical body to recover a lost response. Not
                    combined with max.
                  type: string
                amountRaw:
                  pattern: ^[1-9][0-9]*$
                  description: >-
                    Amount to withdraw, as a positive integer string in the
                    destination token's atomic units (6 decimals, so 1000000 = 1
                    USDC; 18 decimals on BNB Chain). Minimum is one whole token.
                    Fees are deducted from this amount.
                  type: string
                tokenSymbol:
                  description: Stable-coin symbol the withdrawal is denominated in.
                  type: string
                  enum:
                    - USDC
                    - USDC.e
                    - USDT
                destinationAddress:
                  pattern: ^(0x[a-fA-F0-9]{40}|[1-9A-HJ-NP-Za-km-z]{32,44})$
                  description: >-
                    Recipient address. EVM destinations: 0x-prefixed 20-byte
                    hex. Solana: base58 (32–44 chars).
                  type: string
                destinationChainId:
                  minimum: 1
                  description: Chain ID where the recipient address should receive funds.
                  type: integer
                max:
                  description: Cap to the deliverable maximum (withdraw-max intent).
                  type: boolean
            example:
              amountRaw: '50000000'
              tokenSymbol: USDC
              destinationAddress: '0x2f9a4c7e1b3d6f8a0c5e9b2d4f7a1c3e6b8d0f52'
              destinationChainId: 8453
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WithdrawResponse'
              example:
                withdrawalId: cmf3s7d9k00e1mw0l4n2x6pvh
                status: pending
                requested:
                  tokenSymbol: USDC
                  amountRaw: '50000000'
                completedAmountRaw: null
                destination:
                  chainId: 8453
                  address: '0x2f9a4c7e1b3d6f8a0c5e9b2d4f7a1c3e6b8d0f52'
                  tokenSymbol: USDC
                legs:
                  - type: bridge
                    status: planned
                    sourceChainId: 137
                    destChainId: 8453
                    amountRaw: '50000000'
                    txHash: null
                    bridgeOperationId: null
                    sourceTokenSymbol: USDC
                    errorMessage: null
                expected:
                  outputRaw: '49930000'
                  feeRaw: '70000'
                  etaSeconds: 30
                pricingStatus: quoted
                errorMessage: null
                sources:
                  - sourceId: cmf3s7d9m00e2mw0l8k5r1bqa
                    chainId: 137
                    tokenSymbol: USDC
                    tokenAddress: '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359'
                    decimals: 6
                    amountRaw: '50000000'
                    custodyKind: DEPOSIT_WALLET
                    status: pending
                    txHash: null
                    bridgeOperationId: null
        '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'
        '409':
          description: '409'
          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'
    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
    Venue:
      type: string
      enum:
        - kalshi
        - polymarket
        - limitless
        - opinion
        - predict
        - pred
        - tiprun
        - probable
        - myriad
        - hyperliquid
        - novig
        - prophetx
        - betdex
  securitySchemes:
    appId:
      type: apiKey
      in: header
      name: x-app-id
      description: Your application ID. Required for all app-tier and user-tier routes.
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT access token returned by POST /auth/verify. Required for user-tier
        routes.

````