- Get swap quotes from multiple liquidity sources in a single call
- Receive ready-to-sign approve and swap transactions without separate quote/execute steps
- Bridge assets across chains (EVM ↔ EVM, EVM ↔ Solana)
Prerequisites
- A Zerion API key (get one here)
- A wallet address with tokens to swap
How it works
Unlike most swap APIs that require separate quote and execute endpoints, Zerion API combines both into a single call:- Call
GET /v1/swap/quotes/with the sender, recipient, input asset, output asset, and amount - Receive multiple quotes. Each includes the expected output, fees, and (when executable) ready-to-sign
transaction_approveandtransaction_swappayloads - Pick a quote and sign the transactions with your wallet
output_amount_after_fees.
1
Get swap quotes
Use the swap and bridge quotes endpoint.Each quote includes:
liquidity_source- provider id, display name, and iconinput_amount/output_amount- what you’re sending and the estimated amount you’ll receive before slippage (quantityis the human-readable decimal;value/usd_valueare fiat conversions when available)minimum_output_amount- guaranteed output after slippageoutput_amount_after_fees- net output once protocol, bridge, and network fees are subtracted; this is the field quotes are ranked byslippage_percent- actual slippage applied (theslippage_percentquery parameter when provided, otherwise auto-chosen)protocol_fee/bridge_fee/network_fee- fee breakdown; each carriesamountand anincluded_in_rateflag (whether already deducted from the rate)transaction_approve- ERC-20 approve transaction to sign first. Absent when not needed (Solana, EVM native-asset input, or sufficient allowance already granted)transaction_swap- swap transaction to sign. Absent when the quote is informational only (e.g.,erroris set)error- present when the quote can’t be executed as-is (e.g.,not_enough_input_asset_balance)estimated_time_seconds- typically present on bridge routes
2
Pick a quote and check for errors
The API returns quotes best-first. Before signing, check whether the chosen quote has an
error and a transaction_swap.error.hint is a machine-readable next step (topup, increase_input_amount, unspecified) you can surface in your UI to guide the user.3
Sign the approve transaction (if present)
If
transaction_approve is present, sign and confirm it before submitting the swap. It’s a complete EVM transaction, so you don’t need a manual approve(spender, amount) call.transaction_approve is omitted for Solana, for EVM swaps where the input is the chain’s native asset (ETH, MATIC, etc.), and when the wallet already has sufficient allowance.4
Sign and send the swap transaction
transaction_swap.solana.raw is a base64-encoded raw transaction that you decode and sign with the Solana wallet of your choice (e.g., @solana/web3.js).5
Bridge assets across chains
To bridge tokens between chains, set a different
output[chain_id]. The to parameter is the recipient on the destination chain. Set it to your wallet on that chain (use a base58 Solana address when bridging to Solana).