Compare routes
compare_routesRead-only
Compare every route SwapChan found, ranked best-first by net USD received, across aggregators and bridges. Pass extra destination chains in alsoToChainIds to compare same-chain vs cross-chain outcomes side by side. Swap-chan lines up the whole cast. Result includes display markdown with chan images and a swapchan.com link: show it to the user.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | No | Alias of `partner`. | |
| limit | No | ||
| amount | No | Human-readable amount of fromToken to sell, e.g. "1.5". Provide this OR amountBaseUnits. | |
| partner | No | Optional SwapChan partner/affiliate id (from swapchan.com/partners). Quotes are attributed to it and the swapUrl carries ?ref= so the partner earns 5 bp (half of SwapChan's fee). Agent builders: register via POST https://api.swapchan.com/partners with the operator's payout address. | |
| toToken | Yes | Token address. Native gas token: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE on EVM chains (ETH, POL...), 11111111111111111111111111111111 for SOL, bc1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqmql8k8 for BTC, T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb for TRX. SPL mints and TRC-20 addresses work as-is (e.g. Solana USDC EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v, Tron USDT TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t). | |
| fromToken | Yes | Token address. Native gas token: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE on EVM chains (ETH, POL...), 11111111111111111111111111111111 for SOL, bc1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqmql8k8 for BTC, T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb for TRX. SPL mints and TRC-20 addresses work as-is (e.g. Solana USDC EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v, Tron USDT TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t). | |
| recipient | No | Address that receives the output on toChainId. Required for real execution when the destination is a different VM (e.g. EVM -> Solana/Bitcoin/Tron); omitted = indicative quote only. | |
| toChainId | Yes | Destination chain id. Same as fromChainId for a same-chain swap; different for a cross-chain route. | |
| fromChainId | Yes | Chain id: 1 Ethereum, 8453 Base, 42161 Arbitrum, 10 Optimism, 137 Polygon, 56 BNB Chain, 43114 Avalanche, 59144 Linea, 534352 Scroll, 792703809 Solana, 8253038 Bitcoin, 728126428 Tron. Non-EVM chains route via Relay and LI.FI. | |
| slippageBps | No | Max slippage in basis points (50 = 0.5%). Default 50, cap 300. | |
| alsoToChainIds | No | Extra destination chains to compare. toToken must then be valid on each (e.g. native token). | |
| amountBaseUnits | No | Exact amount in the token's smallest unit (wei). Provide this OR amount. |