Skip to main content
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)
Time
~15 minutes
You need

How it works

Most swap APIs split quoting and executing into separate endpoints. Zerion API does both in 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.
Quotes come back best-first, sorted by the fiat value of output_amount_after_fees.

Steps

1

Get swap quotes

Request quotes from swap and bridge quotes.
  • liquidity_source - Provider id, display name and icon.
  • input_amount / output_amount - What you send and the estimated amount you 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. Quotes are ranked by this field.
  • slippage_percent - Slippage actually 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 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., 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

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

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

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.