Skip to main content
What you’ll build:
  • 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)
Time: ~15 minutes

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:
  1. Call GET /v1/swap/quotes/ with the sender, recipient, input asset, output asset, and amount
  2. Receive multiple quotes. Each includes the expected output, fees, and (when executable) ready-to-sign transaction_approve and transaction_swap payloads
  3. Pick a quote and sign the transactions with your wallet
The API returns quotes best-first, sorted by the fiat value of 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 icon
  • input_amount / output_amount - what you’re sending and the estimated amount you’ll receive before slippage (quantity is the human-readable decimal; value / usd_value are 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; this is the field quotes are ranked by
  • slippage_percent - actual slippage applied (the slippage_percent query parameter when provided, otherwise auto-chosen)
  • protocol_fee / bridge_fee / network_fee - fee breakdown; each carries amount and an included_in_rate flag (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., error is 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

For Solana quotes, 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).
Use the List fungibles available for bridging endpoint to discover which tokens can be bridged between two specific chains before requesting quotes.

Key parameters