What you’ll build
- Swap quotes from multiple liquidity sources in a single call
- Ready-to-sign approve and swap transactions, with no separate quote and execute steps
- Cross-chain bridges (EVM ↔ EVM, EVM ↔ Solana)
How it works
Most swap APIs split quoting and executing into separate endpoints. Zerion API does both in 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.
Steps
1
Get swap quotes
Request quotes from swap and bridge quotes.
What each quote contains
What each quote contains
liquidity_source- Provider id, display name and icon.input_amount/output_amount- What you send and the estimated amount you receive before slippage.quantityis the human-readable decimal;value/usd_valueare fiat conversions when available.minimum_output_amount- Guaranteed output after slippage.output_amount_after_fees- Net output once protocol, bridge and network fees are subtracted. Quotes are ranked by this field.slippage_percent- Slippage actually applied: theslippage_percentquery parameter when provided, otherwise auto-chosen.protocol_fee/bridge_fee/network_fee- Fee breakdown. Each carriesamountand anincluded_in_rateflag (whether it’s 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
Quotes are sorted best-first. Before signing, check that the chosen quote has no
error and does have a transaction_swap.error.hint is a machine-readable next step (topup, add_wallet, 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. Decode it and sign it with the Solana wallet of your choice (for example, @solana/web3.js).5
Bridge assets across chains
To bridge, set a different
output[chain_id]. to is the recipient on the destination chain: set it to your wallet on that chain, and use a base58 Solana address when bridging to Solana.Key parameters
Next steps
- Check balances before quoting, so you only request quotes the wallet can cover.
- After the swap confirms, show it in the wallet’s transaction history.