Skip to main content
POST
/
v1
/
wallets
/
{wallet_id}
/
swap
/
quote
Get Swap Quote
curl --request POST \
  --url https://api.privy.io/v1/wallets/{wallet_id}/swap/quote \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --header 'privy-app-id: <privy-app-id>' \
  --data '
{
  "caip2": "eip155:1",
  "input_token": "native",
  "output_token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
  "amount": "1000000000000000000",
  "amount_type": "exact_input"
}
'
{
  "caip2": "eip155:1",
  "input_token": "native",
  "output_token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
  "input_amount": "1000000000000000000",
  "est_output_amount": "2000000000",
  "minimum_output_amount": "1980000000",
  "gas_estimate": "150000"
}

Prerequisites


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.

Authorizations

Authorization
string
header
required

Basic Auth header with your app ID as the username and your app secret as the password.

Headers

privy-app-id
string
required

ID of your Privy app.

privy-authorization-signature
string

Request authorization signature. If multiple signatures are required, they should be comma separated.

Path Parameters

wallet_id
string
required

ID of the wallet.

Body

application/json

Input for requesting a token swap quote.

caip2
string
required

Chain identifier (e.g., "eip155:1" for Ethereum mainnet).

input_token
string
required

Token address to sell, or "native" for the chain's native token.

output_token
string
required

Token address to buy, or "native" for the chain's native token.

amount
string
required

Amount in base units (e.g., wei for ETH).

amount_type
enum<string>
default:exact_input

Whether the amount refers to the input token (exact_input) or output token (exact_output).

Available options:
exact_input,
exact_output
slippage_bps
number

Maximum slippage tolerance in basis points (e.g., 50 for 0.5%). If omitted, auto-slippage is used.

Response

200 - application/json

Swap quote retrieved successfully.

Pricing data for a token swap.

caip2
string
required

Chain identifier.

input_token
string
required

Token address being sold.

output_token
string
required

Token address being bought.

input_amount
string
required

Amount of input token in base units.

est_output_amount
string
required

Estimated amount of output token in base units.

minimum_output_amount
string
required

Minimum output amount accounting for slippage, in base units.

gas_estimate
string
required

Estimated gas cost in base units of the native token.