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

> Request a price quote to preview estimated swap output amounts before executing

Before executing a swap, request a price quote to preview estimated output amounts. The quote reflects Privy and protocol fees in the swap rate. See the [fees section](/wallets/actions/swap/overview#fees) for a breakdown of how fees are applied.

<Info>
  View the full [API reference](/api-reference/wallets/swap/quote) for the quote endpoint.
</Info>

## Usage

To get a swap quote, make a `POST` request to:

```bash theme={"system"}
https://api.privy.io/v1/wallets/{wallet_id}/swap/quote
```

<View title="REST API" icon="terminal">
  ### Body

  <ParamField body="source" type="object" required>
    The source token and chain.

    <Expandable title="properties" defaultOpen>
      <ParamField body="source.caip2" type="string" required>
        CAIP-2 identifier for the source chain (e.g., `eip155:8453` for Base). See [supported
        chains](/wallets/actions/swap/overview#supported-chains).
      </ParamField>

      <ParamField body="source.asset_address" type="string" required>
        Token address to sell, or `"native"` for the chain's native token.
      </ParamField>
    </Expandable>
  </ParamField>

  <ParamField body="destination" type="object" required>
    The destination token and chain.

    <Expandable title="properties" defaultOpen>
      <ParamField body="destination.asset_address" type="string" required>
        Token address to receive, or `"native"` for the chain's native token.
      </ParamField>

      <ParamField body="destination.caip2" type="string">
        CAIP-2 identifier for the destination chain. Omit for a same-chain swap. Set to a different
        chain for a cross-chain swap. See [supported
        routes](/wallets/actions/swap/overview#cross-chain-swaps).
      </ParamField>

      <ParamField body="destination.destination_address" type="string">
        Address to receive the output tokens on the destination chain. Required when swapping between
        different chain types (e.g. EVM and Solana). Defaults to the source wallet address otherwise.
      </ParamField>
    </Expandable>
  </ParamField>

  <ParamField body="base_amount" type="string" required>
    Amount in base units (e.g., wei for ETH, lamports for SOL, or the token's smallest unit).
  </ParamField>

  <ParamField body="amount_type" type="'exact_input' | 'exact_output'">
    Whether `base_amount` refers to the input or output token. Defaults to `exact_input`.
  </ParamField>

  <ParamField body="slippage_bps" type="number">
    Maximum slippage tolerance in basis points (e.g., `50` for 0.5%). If omitted, auto-slippage is
    used.
  </ParamField>

  <ParamField body="fee_configuration" type="object">
    Optional developer fee configuration. Only applies to cross-chain swaps.

    <Expandable title="properties">
      <ParamField body="fee_configuration.type" type="'total_fee_bps'" required>
        The fee model to apply. Currently only `total_fee_bps` is supported.
      </ParamField>

      <ParamField body="fee_configuration.value" type="number" required>
        Total fee cap in basis points (0–10000). Relayer and developer fees must fit within this cap.
        For example, `80` represents 0.8%.
      </ParamField>
    </Expandable>
  </ParamField>

  <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. For cross-chain quotes, quoted
    output amounts and fees are best-effort estimates — small deviations are possible if market
    conditions shift between quote and execution.
  </Tip>

  ### Response

  <ResponseField name="caip2" type="string">
    CAIP-2 identifier for the source chain.
  </ResponseField>

  <ResponseField name="input_token" type="string">
    Token address being sold.
  </ResponseField>

  <ResponseField name="output_token" type="string">
    Token address being bought.
  </ResponseField>

  <ResponseField name="input_amount" type="string">
    Amount of input token in base units.
  </ResponseField>

  <ResponseField name="est_output_amount" type="string">
    Estimated amount of output token in base units, after fees.
  </ResponseField>

  <ResponseField name="minimum_output_amount" type="string">
    Minimum output amount accounting for slippage, in base units. Use this to verify the swap terms
    before executing.
  </ResponseField>

  <ResponseField name="gas_estimate" type="string">
    Estimated gas cost in base units of the native token. For cross-chain swaps, see `estimated_gas`
    for a structured breakdown.
  </ResponseField>

  <ResponseField name="destination_caip2" type="string">
    CAIP-2 identifier for the destination chain. Present for cross-chain swaps only.
  </ResponseField>

  <ResponseField name="estimated_fees" type="FeeLineItem[]">
    Fee breakdown for the swap. Each item has a `type` (`relayer`, or `developer`) and an `amount` in
    USD. Items of type `developer` include a `recipient` address. Present for cross-chain swaps only.
  </ResponseField>

  <ResponseField name="estimated_gas" type="object">
    Structured gas estimate. Present for cross-chain swaps only.

    <Expandable title="properties">
      <ResponseField name="base_amount" type="string">
        Gas cost in the native token's smallest unit.
      </ResponseField>

      <ResponseField name="amount" type="string">
        Gas cost as a human-readable decimal string.
      </ResponseField>

      <ResponseField name="gas_asset" type="string">
        Symbol of the gas token (e.g., `"ETH"`).
      </ResponseField>
    </Expandable>
  </ResponseField>

  <ResponseField name="expires_at" type="number">
    Unix timestamp (in seconds) after which the quote is no longer valid. Present for cross-chain
    swaps only. Fetch a fresh quote if executing after this time.
  </ResponseField>

  ### Examples

  <Tabs>
    <Tab title="Same-chain">
      ```bash theme={"system"}
      curl -X POST https://api.privy.io/v1/wallets/{wallet_id}/swap/quote \
        -u "<your-app-id>:<your-app-secret>" \
        -H "privy-app-id: <your-app-id>" \
        -H "Content-Type: application/json" \
        -d '{
          "source": {
            "caip2": "eip155:8453",
            "asset_address": "native"
          },
          "destination": {
            "asset_address": "0x<erc20-token-address>"
          },
          "base_amount": "1000000000000000000",
          "amount_type": "exact_input"
        }'
      ```

      ```json Example response theme={"system"}
      {
        "caip2": "eip155:8453",
        "input_token": "native",
        "output_token": "0x<erc20-token-address>",
        "input_amount": "1000000000000000000",
        "est_output_amount": "2000000000",
        "minimum_output_amount": "1980000000",
        "gas_estimate": "150000"
      }
      ```
    </Tab>

    <Tab title="Cross-chain">
      ```bash theme={"system"}
      curl -X POST https://api.privy.io/v1/wallets/{wallet_id}/swap/quote \
        -u "<your-app-id>:<your-app-secret>" \
        -H "privy-app-id: <your-app-id>" \
        -H "Content-Type: application/json" \
        -d '{
          "source": {
            "caip2": "eip155:8453",
            "asset_address": "native"
          },
          "destination": {
            "caip2": "eip155:42161",
            "asset_address": "native"
          },
          "base_amount": "1000000000000000000",
          "amount_type": "exact_input"
        }'
      ```

      ```json Example response theme={"system"}
      {
        "caip2": "eip155:8453",
        "input_token": "native",
        "output_token": "native",
        "input_amount": "1000000000000000000",
        "est_output_amount": "998000000000000000",
        "minimum_output_amount": "993010000000000000",
        "destination_caip2": "eip155:42161",
        "estimated_fees": [{ "type": "relayer", "amount": "0.50" }],
        "estimated_gas": {
          "base_amount": "210000000000000",
          "amount": "0.00021",
          "gas_asset": "ETH"
        },
        "expires_at": 1715200060
      }
      ```
    </Tab>
  </Tabs>
</View>
