> ## 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 swap quote

> Retrieves a swap quote with full transaction details for trading tokens
on a specific chain. Use this endpoint when you are ready to execute a
swap and need the complete transaction to sign and broadcast.




## OpenAPI

````yaml /openapi/client-api.yaml post /clients/me/integrations/0x/swap/quote
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`).
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: Li.Fi
    description: Cross-chain swaps and bridging powered by Li.Fi
  - 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: 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/0x/swap/quote:
    post:
      tags:
        - 0x
      summary: Get a swap quote
      description: |
        Retrieves a swap quote with full transaction details for trading tokens
        on a specific chain. Use this endpoint when you are ready to execute a
        swap and need the complete transaction to sign and broadcast.
      operationId: getSwapQuote
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ZeroXSwapQuoteRequest'
      responses:
        '200':
          description: Swap quote retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ZeroXSwapQuoteResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ZeroXSwapQuoteRequest:
      type: object
      required:
        - chainId
        - buyToken
        - sellToken
        - sellAmount
      properties:
        chainId:
          type: string
          description: Chain ID in CAIP-2 format (e.g. `eip155:1`).
        buyToken:
          type: string
          description: Token symbol or address to buy (e.g. `USDC`).
        sellToken:
          type: string
          description: Token symbol or address to sell (e.g. `ETH`).
        sellAmount:
          type: string
          description: Amount to sell in the smallest unit (e.g. wei).
        zeroXApiKey:
          type: string
          description: Optional 0x API key.
        slippageBps:
          type: number
          description: Maximum acceptable slippage in basis points (e.g. 100 = 1%).
        excludedSources:
          type: string
          description: Comma-separated list of liquidity sources to exclude.
        swapFeeRecipient:
          type: string
          description: Address to receive swap fees.
        swapFeeBps:
          type: number
          description: Swap fee in basis points.
        swapFeeToken:
          type: string
          description: Token to collect fees in.
    ZeroXSwapQuoteResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            rawResponse:
              type: object
              description: Raw 0x API response containing quote or price details.
              properties:
                blockNumber:
                  type: string
                  description: Block number at which the quote was generated.
                buyAmount:
                  type: string
                  description: Amount of buy token received.
                buyToken:
                  type: string
                  description: Buy token address.
                fees:
                  type: object
                  description: Fee breakdown (integrator, 0x, gas).
                  additionalProperties: true
                issues:
                  type: object
                  description: Any issues with the swap (allowance, balance).
                  additionalProperties: true
                liquidityAvailable:
                  type: boolean
                  description: Whether sufficient liquidity is available.
                minBuyAmount:
                  type: string
                  description: Minimum buy amount after slippage.
                route:
                  type: object
                  description: Routing information (fills and tokens).
                  additionalProperties: true
                sellAmount:
                  type: string
                  description: Amount of sell token spent.
                sellToken:
                  type: string
                  description: Sell token address.
                tokenMetadata:
                  type: object
                  description: Tax metadata for buy and sell tokens.
                  additionalProperties: true
                totalNetworkFee:
                  type: string
                  description: Total network fee in wei.
                transaction:
                  type: object
                  description: Transaction details to sign and broadcast (quote only).
                  properties:
                    to:
                      type: string
                    data:
                      type: string
                    gas:
                      type: string
                    gasPrice:
                      type: string
                    value:
                      type: string
                    from:
                      type: string
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message describing what went wrong
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >
        Client API Key or Client Session Token (CST). Pass as a Bearer token in
        the

        Authorization header.

````