Download OpenAPI specification:
Token swap routing and execution API
Computes optimal routing for a token swap and returns a quote with estimated outputs, costs, and routing details. The quote is stored server-side and a quote_id is returned for use with the Execute endpoint.
Quotes expire after approximately 10-15 seconds due to rapidly changing market conditions.
required | Array of objects (InputToken) [ 1 .. 6 ] items Input tokens and amounts to swap |
required | Array of objects (OutputToken) [ 1 .. 6 ] items Desired output tokens and ratios. Ratios must sum to 10000 BPS (100%). |
| taker required | string^0x[a-fA-F0-9]{40}$ Address holding input tokens with allowances set. This address will execute the transaction. |
| recipient | string^0x[a-fA-F0-9]{40}$ Address to receive output tokens. Defaults to taker if not specified. |
| slippage_tolerance_bps | integer [ 0 .. 5000 ] Default: 100 Maximum acceptable slippage in basis points (0-5000). 100 = 1%. |
| max_hops | integer [ 1 .. 10 ] Default: 4 Maximum number of intermediate swaps allowed. |
| exclude_protocols | Array of strings Protocol identifiers to exclude from routing. |
| exclude_pools | Array of strings[ items^0x[a-fA-F0-9]{40}$ ] Pool addresses to exclude from routing. |
| simulate | boolean Default: true Whether to run full causal simulation. Disabling returns faster but less accurate quotes. |
{- "inputs": [
- {
- "chain_id": 1,
- "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
- "amount": "1000000000000000000"
}
], - "outputs": [
- {
- "chain_id": 1,
- "address": "0x6B175474E89094C44Da98b954EedeBC836211103",
- "ratio_bps": 10000
}
], - "taker": "0x742d35Cc6634C0532925a3b844Bc9e7595f8b3c4"
}{- "data": {
- "quote_id": "550e8400-e29b-41d4-a716-446655440000",
- "inputs": [
- {
- "chain_id": 1,
- "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
- "amount": "1000000000000000000"
}
], - "outputs": [
- {
- "chain_id": 1,
- "address": "0x6B175474E89094C44Da98b954EedeBC836211103",
- "ratio_bps": 10000
}
], - "taker": "0x742d35Cc6634C0532925a3b844Bc9e7595f8b3c4",
- "estimated_outputs": [
- {
- "token": "0x6B175474E89094C44Da98b954EedeBC836211103",
- "chain_id": 1,
- "expected_amount": "1850000000000000000000",
- "minimum_amount": "1831500000000000000000",
- "price_impact_bps": 15,
- "usd_value": 1850
}
], - "costs": {
- "gas_cost_wei": "5000000000000000",
- "gas_cost_usd": 8.5,
- "fee_cost_usd": 5.55,
- "slippage_cost_usd": 2.25,
- "total_cost_usd": 16.3,
- "total_gas_units": 250000,
- "gas_price_wei": 20000000000
}, - "path": {
- "tokens": {
- "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2": {
- "name": "Wrapped Ether",
- "symbol": "WETH",
- "decimals": 18,
- "token_type": "erc20"
}, - "0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc": {
- "name": "Uniswap V2",
- "symbol": "UNI-V2",
- "decimals": 18,
- "token_type": "lp"
}
}, - "steps": [
- {
- "type": "swap",
- "protocol": "uniswap_v3",
- "pool": "0x8ad599c3A0ff1De082011EFDDc58f1908eb6e6D8",
- "tokens_in": [
- "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
], - "tokens_out": [
- "0x6B175474E89094C44Da98b954EedeBC836211103"
], - "amounts_in": [
- "1000000000000000000"
], - "amounts_out": [
- "1850000000000000000000"
], - "values_in_usd": [
- 1850
], - "values_out_usd": [
- 1848.5
], - "share_of_input_bps": 10000
}
]
}, - "protocols_used": [
- "uniswap_v3",
- "curve"
], - "expires_at": "2024-01-31T12:00:15Z"
}
}