Get swap quote
Get a price quote for swapping tokens within a wallet.
Prerequisites
- Swaps must be enabled in the Privy Dashboard
- Gas sponsorship must be configured for your app
Authorizations
Basic Auth header with your app ID as the username and your app secret as the password.
Headers
ID of your Privy app.
Request authorization signature. If multiple signatures are required, they should be comma separated.
Path Parameters
ID of the wallet.
Body
Input for requesting a token swap quote.
Amount in base units (e.g., wei for ETH). Must be a non-negative integer string.
1 - 78^\d+$The input side of a swap request, including token and chain.
The output side of a swap quote request.
Whether the amount refers to the input token (exact_input) or output token (exact_output).
exact_input, exact_output Maximum slippage tolerance in basis points (e.g., 50 for 0.5%). If omitted, auto-slippage is used.
0 <= x <= 10000Optional fee configuration for the swap. If omitted, cross-chain swaps will not charge additional fees.
{ "type": "total_fee_bps", "value": 50 }Response
Swap quote retrieved successfully.
Pricing data for a token swap.
Chain identifier.
Token address being sold.
Token address being bought.
Amount of input token in base units.
Estimated amount of output token in base units.
Minimum output amount accounting for slippage, in base units.
Estimated gas cost in base units of the native token. @deprecated For cross-chain swaps, use estimated_gas instead.
Destination chain CAIP-2 identifier for cross-chain swaps.
Estimated fees for the swap. Only present for cross-chain swaps.
Estimated fee paid to the relayer.
- RelayerFee
- PrivyFee
- DeveloperFee
{
"type": "privy",
"recipient": "0x1234567890abcdef1234567890abcdef12345678",
"amount": "0.20"
}Estimated gas cost with full token metadata. Only present for cross-chain swaps.
{
"base_amount": "100000000000000",
"amount": "0.0001",
"gas_asset": "ETH"
}Quote expiry as Unix timestamp (seconds). Present for cross-chain quotes.

