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

# Get a quote

> A smart-routed quote across venues, with each venue priced alone in `venueSoloQuotes`. Only `status: ok` can be filled; fill before `expiresAt`.

Needs a linked Agg session (`POST /link`). Not available to account-abstracted clients.



## OpenAPI

````yaml /openapi/client-api.yaml post /clients/me/integrations/agg/quotes
openapi: 3.1.0
info:
  title: Portal Client API
  version: '3.0'
  description: >
    The Portal Client API provides endpoints for managing wallets, building
    transactions,

    and interacting with blockchain networks. All endpoints require
    authentication via a

    Client API Key or Client Session Token (CST) passed as a Bearer token.


    ## Base URL

    `https://api.portalhq.io/api/v3`


    ## Authentication

    Include your Client API Key or Client Session Token as a Bearer token in the

    `Authorization` header of every request.


    ## Chain ID Format

    Chain parameters use either friendly names (e.g. `ethereum`, `solana`) or
    CAIP-2 format

    (e.g. `eip155:1`, `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`). When using
    CAIP-2 format

    in URLs, ensure the colon is URI-encoded (`%3A`).


    ## Support requests

    Every response carries an `X-Trace-Id` header. Include it when you contact
    support about a

    request, so Portal can find that exact request in its logs.
servers:
  - url: https://api.portalhq.io/api/v3
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Clients
    description: Core client management endpoints
  - name: Wallet
    description: >-
      Read wallet state — balances, NFTs, transaction history, capabilities, and
      transaction details
  - name: Transactions
    description: Build, broadcast, and evaluate blockchain transactions
  - name: Funding
    description: Fund wallets with testnet tokens
  - name: Wallet Shares
    description: Manage signing and backup share pairs
  - name: Delegations
    description: Manage token approvals, revocations, and delegated transfers
  - name: Session Keys
    description: Manage EIP-7702 session keys for smart accounts
  - name: 0x
    description: Token swap endpoints powered by the 0x protocol
  - name: Yield.xyz
    description: Yield opportunities and staking actions powered by Yield.xyz
  - name: Yield.xyz Borrow
    description: >-
      Supply collateral, borrow, repay and withdraw from lending markets (Aave
      V3, Morpho Blue, SparkLend, Lista) powered by Yield.xyz Borrow
  - name: Yield.xyz Perps
    description: >-
      Trade perpetual futures — open/close leveraged positions, manage
      stop-loss/take-profit, and fund/withdraw a trading account — powered by
      Yield.xyz Perps
  - name: Agg
    description: >-
      Prediction markets across venues (Polymarket, Kalshi and more) through one
      Agg account per client — powered by Agg
  - name: Li.Fi
    description: Cross-chain swaps and bridging powered by Li.Fi
  - name: CCTP
    description: >-
      Crosschain USDC transfers powered by Circle's Cross-Chain Transfer
      Protocol (CCTP)
  - name: Blockaid
    description: Transaction and address security scanning powered by Blockaid
  - name: Hypernative
    description: >-
      Transaction, address, token, and NFT security scanning powered by
      Hypernative
  - name: Noah
    description: KYC onboarding, payins, and payouts powered by Noah
  - name: Meld
    description: Buy and sell crypto with fiat through aggregated providers powered by Meld
  - name: Due
    description: Payins, payouts, virtual accounts, and FX powered by Due
  - name: EIP-7702
    description: EIP-7702 account type detection and authorization management
  - name: Deprecated
    description: >-
      Legacy endpoints scheduled for removal. Use the newer equivalents listed
      in each endpoint's description.
paths:
  /clients/me/integrations/agg/quotes:
    post:
      tags:
        - Agg
      summary: Get a quote
      description: >-
        A smart-routed quote across venues, with each venue priced alone in
        `venueSoloQuotes`. Only `status: ok` can be filled; fill before
        `expiresAt`.


        Needs a linked Agg session (`POST /link`). Not available to
        account-abstracted clients.
      operationId: createAggQuote
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AggQuoteRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/AggQuote'
        '400':
          description: >-
            Invalid request, or Agg rejected it (Agg error codes are surfaced as
            `details.code`). Also `AGG_ACCOUNT_ABSTRACTION_UNSUPPORTED` for an
            account-abstracted client.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: >-
            Unauthorized, or the Agg session expired and could not be refreshed
            (`AGG_SESSION_EXPIRED`): link again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >-
            The venue is geo-blocked for this user, or the withdrawal
            destination is not on the allowlist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: >-
            No Agg link for this client (`AGG_LINK_REQUIRED`), or a duplicate
            idempotency key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Agg rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: >-
            Agg returned a response that does not match the schema Portal
            expects (`id: INTEGRATION_RESPONSE_SCHEMA_DRIFT`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IntegrationSchemaDriftErrorResponse'
        '503':
          description: >-
            Agg is unreachable or returned an upstream error, or another request
            is refreshing this session (`AGG_SESSION_REFRESH_IN_PROGRESS`):
            retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    AggQuoteRequest:
      type: object
      properties:
        outcomeId:
          type: string
          minLength: 1
        side:
          type: string
          enum:
            - buy
            - sell
        amount:
          description: >-
            Decimal string, in the quote currency. Exactly one of amount /
            shares.
          type: string
        shares:
          type: string
        slippageBps:
          type: integer
          minimum: 0
        venues:
          type: array
          items:
            type: string
        custody:
          description: >-
            Price against the user's own wallet; quote this way before a
            `custody: "self"` fill.
          type: string
          enum:
            - managed
            - self
        mode:
          description: '`paper` prices for a simulated fill; fill it with the same mode.'
          type: string
          enum:
            - live
            - paper
      required:
        - outcomeId
        - side
      additionalProperties: false
    AggQuote:
      type: object
      properties:
        quoteId:
          type: string
        status:
          type: string
        error:
          type: string
        createdAt:
          type: string
        expiresAt:
          type: string
        refreshAt:
          type: string
        quoteRefreshNotBefore:
          type: string
        quoteFailure:
          $ref: '#/components/schemas/AggQuoteFailure'
        venueMarketId:
          type: string
        venueMarketOutcomeId:
          type: string
        tradeSide:
          type: string
          description: '`buy` or `sell`.'
        sellShares:
          description: Echo of a sell request.
          type: number
        depositWalletAddress:
          description: The user's Polymarket deposit wallet.
          type: string
        estimatedCostRaw:
          type: string
        rawExecCost:
          type: number
        totalFilled:
          type: number
        solveTimeMs:
          type: number
          description: Milliseconds.
        verifyTimeMs:
          type: number
        estDurationMs:
          type: integer
        fills:
          type: array
          items:
            $ref: '#/components/schemas/AggVenueFill'
        matchedMarkets:
          type: array
          items:
            type: object
            properties:
              venue:
                type: string
              venueMarketId:
                type: string
            required:
              - venue
              - venueMarketId
            additionalProperties: false
        venueSoloQuotes:
          type: array
          items:
            $ref: '#/components/schemas/AggVenueSoloQuote'
        allocations:
          type: array
          items:
            $ref: '#/components/schemas/AggAllocation'
        bridgeSteps:
          type: array
          items:
            $ref: '#/components/schemas/AggBridgeStep'
        feeBreakdown:
          $ref: '#/components/schemas/AggFeeBreakdown'
        appFee:
          description: >-
            App fee terms frozen at quote time; `null` when the app charges
            none.
          anyOf:
            - type: object
              properties:
                bips:
                  type: integer
                categoryKey:
                  type: string
                quotedAppFeeRaw:
                  type: string
                bipsByVenue:
                  type: object
                  propertyNames:
                    type: string
                  additionalProperties:
                    type: number
              required:
                - bips
                - categoryKey
                - quotedAppFeeRaw
              additionalProperties: false
            - type: 'null'
        referral:
          description: The referral this quote pays; `null` without a referrer.
          anyOf:
            - type: object
              properties:
                referrer:
                  type: string
                feeBips:
                  type: number
                feeBipsByVenue:
                  type: object
                  propertyNames:
                    type: string
                  additionalProperties:
                    type: number
                payer:
                  type: string
                payerAddress:
                  type: string
                activationSponsorAddress:
                  type: string
                quotedFeeUsd:
                  type: number
              required:
                - referrer
                - feeBips
                - payer
                - quotedFeeUsd
              additionalProperties: false
            - type: 'null'
        slippage:
          $ref: '#/components/schemas/AggSlippage'
        optima:
          description: The best each objective could reach on its own, for comparison.
          type: object
          properties:
            maxFilledQty:
              type: number
            minSlippage:
              type: number
            minCost:
              type: number
            minRisk:
              type: number
            minBridges:
              type: integer
            minVenues:
              type: integer
          required:
            - maxFilledQty
            - minSlippage
            - minCost
            - minRisk
            - minBridges
            - minVenues
          additionalProperties: false
        warnings:
          type: array
          items:
            $ref: '#/components/schemas/AggQuoteWarning'
        custodyWarnings:
          description: >-
            Self-custody quotes: the fill from this wallet would be refused, and
            why.
          type: array
          items:
            type: object
            properties:
              reason:
                type: string
              message:
                type: string
            required:
              - reason
              - message
            additionalProperties: false
        message:
          type: string
        settlementPlan:
          $ref: '#/components/schemas/AggSettlementPlan'
        estimatedPayout:
          type: number
        totalCostIncFees:
          type: number
        estimatedNetProceeds:
          description: What a sell nets after fees.
          type: number
        estimatedProfit:
          type: number
        returnPct:
          type: number
        positionAvailability:
          description: 'Sell quotes: the shares the user can sell, where.'
          type: object
          properties:
            totalSellableShares:
              type: number
            venueMarketOutcomes:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                  venue:
                    type: string
                  venueMarketId:
                    type: string
                  availableShares:
                    type: number
                required:
                  - id
                  - venue
                  - venueMarketId
                  - availableShares
                additionalProperties: false
          required:
            - totalSellableShares
            - venueMarketOutcomes
          additionalProperties: false
        sizeStepRaw:
          description: >-
            Limit-order size constraints, in 6-decimal share units: a multiple
            of `sizeStepRaw`, at least `minSizeRaw`.
          type: string
        minSizeRaw:
          type: string
        legBounds:
          description: Worst accepted price per leg, before venue fees.
          type: array
          items:
            type: object
            properties:
              venue:
                type: string
              venueMarketOutcomeId:
                type: string
              side:
                type: string
              worstPrice:
                type: number
              effectiveSlippageBps:
                type: number
            required:
              - venue
              - venueMarketOutcomeId
              - side
              - worstPrice
              - effectiveSlippageBps
            additionalProperties: false
      required:
        - quoteId
        - status
        - expiresAt
        - refreshAt
        - venueMarketId
        - venueMarketOutcomeId
        - estimatedCostRaw
        - rawExecCost
        - totalFilled
        - solveTimeMs
        - verifyTimeMs
        - fills
        - matchedMarkets
      additionalProperties: false
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message describing what went wrong
    IntegrationSchemaDriftErrorResponse:
      type: object
      description: >-
        Returned (HTTP 500) when a third-party response no longer matches the
        schema Portal proxies for it. The `id` is stable: SDKs should key off it
        and fail gracefully. Portal is alerted automatically and fixes the
        mapping server-side.
      required:
        - error
        - id
        - details
      properties:
        error:
          type: string
          example: >-
            yield-xyz-borrow returned a response for GET /v1/positions that does
            not match the expected schema
        id:
          type: string
          enum:
            - INTEGRATION_RESPONSE_SCHEMA_DRIFT
        details:
          type: object
          required:
            - integration
            - endpoint
            - issues
          properties:
            integration:
              type: string
              example: yield-xyz-borrow
            endpoint:
              type: string
              description: The upstream vendor endpoint whose response drifted.
              example: GET /v1/positions
            issues:
              type: array
              items:
                type: object
                required:
                  - path
                  - message
                  - code
                properties:
                  path:
                    type: string
                    description: Dotted path of the offending field in the vendor response.
                    example: supplyBalances.0.balanceUsd
                  message:
                    type: string
                    example: Expected string, received number
                  code:
                    type: string
                    example: invalid_type
    AggQuoteFailure:
      type: object
      properties:
        venue:
          type: string
        code:
          type: string
          description: The venue quoting service's error code. Open set.
        retryAt:
          type: string
      required:
        - venue
        - code
      additionalProperties: false
    AggVenueFill:
      type: object
      properties:
        venue:
          type: string
        venueMarketId:
          type: string
        venueMarketOutcomeId:
          type: string
        chain:
          type: string
          description: >-
            CAIP-2 chain the part settles on, or `venue-cash` for cash at a
            venue.
        inAmount:
          type: string
        outAmount:
          type: string
        limitPriceMicroUsdc:
          type: string
        avgPrice:
          type: number
        yesPrice:
          type: number
        noPrice:
          type: number
        fills:
          type: array
          items:
            $ref: '#/components/schemas/AggBookFill'
        executionBackend:
          description: 'ProphetX only: `clearinghouse` or `direct`.'
          type: string
        venueAccountId:
          type: string
        venueQty:
          type: number
        venueFee:
          type: number
        builderFee:
          type: number
        settlementFee:
          type: number
        executionReserve:
          type: number
        feeReserve:
          type: number
        bookAgeMs:
          description: Milliseconds.
          type: integer
        freshnessRow:
          description: '`r3` or `r4`.'
          type: string
      required:
        - venue
        - venueMarketId
        - venueMarketOutcomeId
        - chain
        - avgPrice
        - yesPrice
        - noPrice
        - fills
        - venueQty
      additionalProperties: false
    AggVenueSoloQuote:
      type: object
      properties:
        quoteFailure:
          $ref: '#/components/schemas/AggQuoteFailure'
        quoteId:
          anyOf:
            - type: string
            - type: 'null'
          description: Quote id to fill on this venue alone; `null` when display-only.
        unavailableReason:
          description: Why this venue cannot be filled alone, e.g. `geo_blocked`. Open set.
          type: string
        venue:
          type: string
        venueMarketOutcomeId:
          type: string
        avgPrice:
          anyOf:
            - type: number
            - type: 'null'
        filledQty:
          type: number
        rawExecCost:
          type: number
        estimatedPayout:
          type: number
        estimatedProfit:
          type: number
        returnPct:
          type: number
        totalCostIncFees:
          type: number
        status:
          type: string
        fills:
          type: array
          items:
            $ref: '#/components/schemas/AggVenueFill'
        allocations:
          type: array
          items:
            $ref: '#/components/schemas/AggAllocation'
        bridgeSteps:
          type: array
          items:
            $ref: '#/components/schemas/AggBridgeStep'
        setupCosts:
          type: array
          items:
            $ref: '#/components/schemas/AggSetupCost'
        setupCostsTotal:
          type: number
        feeBreakdown:
          $ref: '#/components/schemas/AggFeeBreakdown'
      required:
        - quoteId
        - venue
        - avgPrice
        - filledQty
        - rawExecCost
        - estimatedPayout
        - estimatedProfit
        - returnPct
        - status
        - fills
      additionalProperties: false
    AggAllocation:
      type: object
      properties:
        sourceChainId:
          $ref: '#/components/schemas/AggChainId'
        venue:
          type: string
        amount:
          type: number
        sourceTokenAddress:
          type: string
        sourceTokenSymbol:
          type: string
        custodyKind:
          description: >-
            One of `EOA`, `DEPOSIT_WALLET`, `POLYMARKET_LEGACY`,
            `VENUE_ACCOUNT`.
          type: string
        custodyAddress:
          type: string
        sourceVenueAccountId:
          type: string
        sourceExternalAccountId:
          type: string
        sourceAddress:
          type: string
        exactToken:
          type: boolean
      required:
        - sourceChainId
        - venue
        - amount
      additionalProperties: false
    AggBridgeStep:
      type: object
      properties:
        sourceChainId:
          $ref: '#/components/schemas/AggChainId'
        destChainId:
          $ref: '#/components/schemas/AggChainId'
        amount:
          type: number
        cost:
          type: number
        sourceTokenAddress:
          type: string
        destTokenAddress:
          type: string
        sourceTokenSymbol:
          type: string
        destTokenSymbol:
          type: string
      required:
        - sourceChainId
        - destChainId
        - amount
        - cost
      additionalProperties: false
    AggFeeBreakdown:
      type: object
      properties:
        rawExecCost:
          type: number
        venueFees:
          type: number
        builderFee:
          type: number
        executionReserve:
          type: number
        bridgeFees:
          type: number
        executionGas:
          type: number
        totalCost:
          type: number
        appFee:
          type: number
        appFeeBips:
          type: number
        appFeeBipsByVenue:
          description: Keyed by venue slug.
          type: object
          propertyNames:
            type: string
          additionalProperties:
            type: number
        appFeeCategory:
          type: string
        referralFee:
          type: number
        referralFeeBipsByVenue:
          description: Keyed by venue slug.
          type: object
          propertyNames:
            type: string
          additionalProperties:
            type: number
        setupCosts:
          type: array
          items:
            $ref: '#/components/schemas/AggSetupCost'
        setupCostsTotal:
          type: number
        gasReimbursement:
          type: number
      required:
        - rawExecCost
        - venueFees
        - bridgeFees
        - executionGas
        - totalCost
      additionalProperties: false
    AggSlippage:
      type: object
      properties:
        vwap:
          type: number
        refMidpoint:
          type: number
        slippage:
          type: number
        slippageBps:
          type: number
      required:
        - vwap
        - refMidpoint
        - slippage
        - slippageBps
      additionalProperties: false
    AggQuoteWarning:
      type: object
      properties:
        venue:
          type: string
        venueMarketOutcomeId:
          type: string
        reason:
          type: string
          description: Open set, e.g. `low_liquidity`, `geo_blocked`.
      required:
        - venue
        - venueMarketOutcomeId
        - reason
      additionalProperties: false
    AggSettlementPlan:
      type: object
      properties:
        redeemId:
          type: string
        status:
          type: string
          description: '`redeem_only` or `partial_redeem`.'
        message:
          type: string
        totalRedeemableShares:
          type: number
        totalRedeemShares:
          type: number
        totalSellShares:
          type: number
        redeemLegs:
          type: array
          items:
            type: object
            properties:
              action:
                type: string
              venue:
                type: string
              venueMarketId:
                type: string
              venueMarketOutcomeId:
                type: string
              positionId:
                type: string
              size:
                type: string
                description: Shares, as a decimal string.
              redeemPath:
                type: string
                description: '`evm` or `svm`.'
            required:
              - action
              - venue
              - venueMarketId
              - venueMarketOutcomeId
              - positionId
              - size
              - redeemPath
            additionalProperties: false
      required:
        - redeemId
        - status
        - message
        - totalRedeemableShares
        - totalRedeemShares
        - totalSellShares
        - redeemLegs
      additionalProperties: false
    AggBookFill:
      type: object
      properties:
        price:
          type: number
        size:
          type: number
        fill:
          type: number
      required:
        - price
        - size
        - fill
      additionalProperties: false
    AggSetupCost:
      type: object
      properties:
        kind:
          type: string
          description: One of `chainApproval`, `venueMarketAta`, `hyperliquidActivation`.
        venue:
          type: string
        chainId:
          $ref: '#/components/schemas/AggChainId'
        venueMarketId:
          type: string
        costUsd:
          type: number
        alreadyPaid:
          type: boolean
      required:
        - kind
        - venue
        - costUsd
        - alreadyPaid
      additionalProperties: false
    AggChainId:
      type: string
      description: >-
        A CAIP-2 chain id, e.g. `eip155:137`. Chains without a CAIP-2 id pass
        through as Agg names them, e.g. `1337` for Hyperliquid.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >
        Client API Key or Client Session Token (CST). Pass as a Bearer token in
        the

        Authorization header.

````

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