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

# Get swap quote

> Get a price quote for swapping tokens within a wallet.

### Prerequisites

* Swaps must be [enabled in the Privy Dashboard](/wallets/actions/swap/setup)
* [Gas sponsorship](/wallets/gas-and-asset-management/gas/setup) must be configured for your app

***

<Tip>
  Swap quotes reflect real-time market conditions and can change quickly. Fetch a fresh quote before
  executing a swap to ensure your app displays accurate pricing.
</Tip>


## OpenAPI

````yaml post /v1/wallets/{wallet_id}/swap/quote
openapi: 3.1.0
info:
  version: 0.0.1
  title: Privy API
  description: >-
    REST API for Privy's wallet infrastructure — provision and manage wallets
    across EVM, Solana, and Bitcoin, authenticate users, sign transactions, and
    configure programmable policies and authorization intents.
  contact:
    name: Privy
    url: https://www.privy.io/
    email: support@privy.io
servers:
  - url: https://api.privy.io
security: []
tags:
  - name: Accounts
    description: Operations related to asset accounts
  - name: Aggregations
    description: Operations related to aggregations for tracking and measuring metrics
  - name: Apps
    description: Operations related to app settings and allowlist management
  - name: Client Auth
    description: OAuth token exchange and device authorization operations
  - name: Condition Sets
    description: Operations related to condition sets
  - name: Embedded wallets
    description: Operations related to embedded wallet creation and authentication
  - name: Fiat
    description: Operations related to fiat onramping and offramping
  - name: Intents
    description: Operations related to authorization intents for wallet actions
  - name: Key quorums
    description: Operations related to key quorums
  - name: Kraken Embed
    description: >-
      Operations for Kraken Embed integration, including quotes, trades, user
      management, and portfolio operations
  - name: OAuth
    description: >-
      OAuth 2.0 endpoints including Device Authorization Grant (RFC 8628) for
      CLI and limited-input device login flows
  - name: Organizations
    description: Operations related to organization secret management
  - name: Policies
    description: Operations related to policies
  - name: Shared
    description: Common schemas shared across resources
  - name: Swaps
    description: Operations for swapping tokens within wallets
  - name: Transactions
    description: Operations related to transactions
  - name: User signers
    description: Operations related to user signers
  - name: Users
    description: Operations related to users
  - name: Wallet Actions
    description: Operations related to wallet actions
  - name: Wallets
    description: Operations related to wallets
  - name: Webhooks
    description: >-
      Webhook events that Privy sends to your configured endpoint when specific
      actions occur in your app
  - name: Yield
    description: >-
      Operations for depositing and withdrawing funds from ERC-4626 yield vaults
      (Morpho, Aave)
paths:
  /v1/wallets/{wallet_id}/swap/quote:
    post:
      tags:
        - Swaps
      summary: Get Swap Quote
      description: Get a price quote for swapping tokens within a wallet.
      operationId: swapQuote
      parameters:
        - schema:
            type: string
            description: ID of the wallet.
          required: true
          name: wallet_id
          in: path
        - schema:
            type: string
            description: ID of your Privy app.
          required: true
          name: privy-app-id
          in: header
        - schema:
            type: string
            description: >-
              Request authorization signature. If multiple signatures are
              required, they should be comma separated.
          required: false
          name: privy-authorization-signature
          in: header
        - schema:
            type: string
            description: >-
              Request expiry. Value is a Unix timestamp in milliseconds
              representing the deadline by which the request must be processed.
          required: false
          name: privy-request-expiry
          in: header
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SwapQuoteRequestBody'
            example:
              base_amount: '1000000000000000000'
              amount_type: exact_input
              source:
                asset_address: native
                caip2: eip155:1
              destination:
                asset_address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
                caip2: eip155:1
      responses:
        '200':
          description: Swap quote retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SwapQuoteResponse'
              example:
                caip2: eip155:1
                input_token: native
                output_token: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
                input_amount: '1000000000000000000'
                est_output_amount: '2000000000'
                minimum_output_amount: '1980000000'
                gas_estimate: '150000'
      security:
        - appSecretAuth: []
components:
  schemas:
    SwapQuoteRequestBody:
      type: object
      properties:
        base_amount:
          type: string
          minLength: 1
          maxLength: 78
          pattern: ^\d+$
          description: >-
            Amount in base units (e.g., wei for ETH). Must be a non-negative
            integer string.
        amount_type:
          allOf:
            - $ref: '#/components/schemas/AmountType'
            - default: exact_input
              description: >-
                Whether the amount refers to the input token (exact_input) or
                output token (exact_output).
        source:
          $ref: '#/components/schemas/SwapSource'
        destination:
          $ref: '#/components/schemas/SwapQuoteDestination'
        slippage_bps:
          type: integer
          minimum: 0
          maximum: 10000
          description: >-
            Maximum slippage tolerance in basis points (e.g., 50 for 0.5%). If
            omitted, auto-slippage is used.
        fee_configuration:
          allOf:
            - $ref: '#/components/schemas/FeeConfiguration'
            - description: >-
                Optional fee configuration for the swap. If omitted, cross-chain
                swaps will not charge additional fees.
      required:
        - base_amount
        - source
        - destination
      additionalProperties: false
      description: Input for requesting a token swap quote.
      title: SwapQuoteRequestBody
      example:
        base_amount: '1000000000000000000'
        amount_type: exact_input
        source:
          asset_address: native
          caip2: eip155:1
        destination:
          asset_address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
      x-stainless-model: swaps.swap_quote_request_body
    SwapQuoteResponse:
      type: object
      properties:
        caip2:
          type: string
          description: Chain identifier.
        input_token:
          type: string
          description: Token address being sold.
        output_token:
          type: string
          description: Token address being bought.
        input_amount:
          type: string
          description: Amount of input token in base units.
        est_output_amount:
          type: string
          description: Estimated amount of output token in base units.
        minimum_output_amount:
          type: string
          description: Minimum output amount accounting for slippage, in base units.
        gas_estimate:
          type: string
          description: >-
            Estimated gas cost in base units of the native token. @deprecated
            For cross-chain swaps, use estimated_gas instead.
        destination_caip2:
          type: string
          description: >-
            Destination chain CAIP-2 identifier for cross-chain swaps. Only
            present for cross-chain swaps.
        estimated_fees:
          type: array
          items:
            $ref: '#/components/schemas/FeeLineItem'
          description: Estimated fees for the swap. Only present for cross-chain swaps.
        estimated_gas:
          allOf:
            - $ref: '#/components/schemas/Gas'
            - description: >-
                Estimated gas cost with full token metadata. Only present for
                cross-chain swaps.
        expires_at:
          type: number
          description: >-
            Quote expiry as Unix timestamp (seconds). Only present for
            cross-chain quotes.
      required:
        - caip2
        - input_token
        - output_token
        - input_amount
        - est_output_amount
        - minimum_output_amount
        - gas_estimate
      description: Pricing data for a token swap.
      title: SwapQuoteResponse
      example:
        caip2: eip155:1
        input_token: native
        output_token: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
        input_amount: '1000000000000000000'
        est_output_amount: '2000000000'
        minimum_output_amount: '1980000000'
        gas_estimate: '150000'
      x-stainless-model: swaps.swap_quote_response
    AmountType:
      type: string
      enum:
        - exact_input
        - exact_output
      description: Whether the amount refers to the input token or output token.
      title: AmountType
      x-stainless-model: wallets.amount_type
    SwapSource:
      type: object
      properties:
        asset_address:
          type: string
          description: >-
            Token contract address to sell, or "native" for the chain's native
            token.
        caip2:
          type: string
          description: CAIP-2 chain identifier (e.g., "eip155:1").
      required:
        - asset_address
        - caip2
      additionalProperties: false
      description: The input side of a swap request, including token and chain.
      title: SwapSource
      x-stainless-model: swaps.swap_source
    SwapQuoteDestination:
      type: object
      properties:
        asset_address:
          type: string
          description: >-
            Token contract address to buy, or "native" for the chain's native
            token.
        caip2:
          type: string
          description: >-
            CAIP-2 chain identifier for the destination. Defaults to source
            chain if omitted. Will result in a cross-chain swap if source and
            destination chains differ.
        destination_address:
          type: string
          description: >-
            Address to receive the output tokens. Defaults to the swapping
            wallet address. Required when swapping between chains with different
            address types (e.g. EVM to Solana).
      required:
        - asset_address
      additionalProperties: false
      description: The output side of a swap quote request.
      title: SwapQuoteDestination
      x-stainless-model: swaps.swap_quote_destination
    FeeConfiguration:
      oneOf:
        - $ref: '#/components/schemas/TotalFeeConfigurationBps'
      discriminator:
        propertyName: type
        mapping:
          total_fee_bps:
            $ref: '#/components/schemas/TotalFeeConfigurationBps'
      description: >-
        How transfer fees are specified. If omitted, a default fee configuration
        is applied.
      title: FeeConfiguration
      example:
        type: total_fee_bps
        value: 50
      x-stainless-model: wallets.fee_configuration
    FeeLineItem:
      oneOf:
        - $ref: '#/components/schemas/RelayerFee'
        - $ref: '#/components/schemas/PrivyFee'
        - $ref: '#/components/schemas/DeveloperFee'
      discriminator:
        propertyName: type
        mapping:
          relayer:
            $ref: '#/components/schemas/RelayerFee'
          privy:
            $ref: '#/components/schemas/PrivyFee'
          developer:
            $ref: '#/components/schemas/DeveloperFee'
      description: An individual fee assessed on a transfer.
      title: FeeLineItem
      example:
        type: privy
        amount: '0.20'
      x-stainless-model: wallets.fee_line_item
    Gas:
      type: object
      properties:
        base_amount:
          type: string
          description: Gas cost in the gas token's base units (e.g. wei).
        amount:
          type: string
          description: >-
            Gas cost in the gas token as a human-readable decimal string (e.g.
            "0.0001").
        gas_asset:
          type: string
          description: Gas token symbol (e.g. "ETH", "USDC").
      required:
        - base_amount
        - amount
        - gas_asset
      additionalProperties: false
      description: >-
        Gas cost for a blockchain action. Includes both raw base-unit amount and
        a human-readable decimal string, plus the gas token symbol.
      title: Gas
      example:
        base_amount: '100000000000000'
        amount: '0.0001'
        gas_asset: ETH
      x-stainless-model: wallets.gas
    TotalFeeConfigurationBps:
      type: object
      properties:
        type:
          type: string
          enum:
            - total_fee_bps
          description: 'Discriminator: total fee specified in BPS.'
        value:
          type: integer
          minimum: 0
          maximum: 10000
          description: Total fee in basis points (1 bps = 0.01%).
      required:
        - type
        - value
      additionalProperties: false
      description: Total fees assessed on a transfer, in BPS
      title: TotalFeeConfigurationBps
      example:
        type: total_fee_bps
        value: 50
      x-stainless-model: wallets.total_fee_configuration_bps
    RelayerFee:
      type: object
      properties:
        type:
          type: string
          enum:
            - relayer
        recipient:
          anyOf:
            - type: string
            - type: string
            - $ref: '#/components/schemas/TronAddress'
        amount:
          type: string
          description: Amount in USD (in decimals).
      required:
        - type
        - amount
      additionalProperties: false
      description: Estimated fee paid to the relayer.
      title: RelayerFee
      example:
        type: relayer
        recipient: '0x1234567890abcdef1234567890abcdef12345678'
        amount: '0.20'
      x-stainless-model: wallets.relayer_fee
    PrivyFee:
      type: object
      properties:
        type:
          type: string
          enum:
            - privy
        recipient:
          anyOf:
            - type: string
            - type: string
            - $ref: '#/components/schemas/TronAddress'
        amount:
          type: string
          description: Amount in USD (in decimals).
      required:
        - type
        - amount
      additionalProperties: false
      description: Estimated fee paid to Privy.
      title: PrivyFee
      example:
        type: privy
        amount: '0.20'
      x-stainless-model: wallets.privy_fee
    DeveloperFee:
      type: object
      properties:
        type:
          type: string
          enum:
            - developer
        recipient:
          anyOf:
            - type: string
            - type: string
            - $ref: '#/components/schemas/TronAddress'
        amount:
          type: string
          description: Amount in USD (in decimals).
      required:
        - type
        - amount
      additionalProperties: false
      description: Estimated fee paid to the developer.
      title: DeveloperFee
      example:
        type: developer
        recipient: '0x1234567890abcdef1234567890abcdef12345678'
        amount: '0.20'
      x-stainless-model: wallets.developer_fee
    TronAddress:
      type: string
      pattern: ^T[1-9A-HJ-NP-Za-km-z]{33}$
      description: 'Tron address: base58check-encoded, starting with T, 34 characters.'
      title: TronAddress
      x-stainless-model: shared.tron_address
  securitySchemes:
    appSecretAuth:
      type: http
      scheme: basic
      description: >-
        Basic Auth header with your app ID as the username and your app secret
        as the password.

````