v4

latestOpenAPI 3.1.0raw.githubusercontent.com2026-06-123911.3 KB

Calculate the optimal swap route and generate execution parameters for a token exchange

get/v1/route

Query parameters

amountInstring required
Example:5000000000

The amount of input tokens to swap (in token's smallest unit)

tokenInstring required
Example:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48

Contract address of the input token to sell. The zero address (0x00…00) represents the native currency ETH.

tokenOutstring required
Example:0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2

Contract address of the output token to buy. The zero address (0x00…00) represents the native currency ETH.

slippageBpsinteger

The slippage tolerance in basis points (e.g., 50 for 0.5%)

timeoutinteger

Optional timeout in milliseconds. If set, returns the best pathfinder result within the timeout window. Must be a positive integer.

Response

Successfully calculated swap route with execution details

requestIdstring hex required

Unique request identifier (16 bytes) encoded as hexadecimal with 0x prefix

amountOutstring required

Amount of an ERC20 token as a decimal string (no scientific notation)

minAmountOutstring required

Amount of an ERC20 token as a decimal string (no scientific notation)

targetstring required

Ethereum contract address (20 bytes) encoded as hexadecimal with 0x prefix

callDatastring required

Arbitrary byte data encoded as hexadecimal with 0x prefix

gasUsedinteger required

Actual gas consumed by the swap simulation

gasLimitinteger required

Recommended gas limit for the swap transaction (gasUsed * 1.3)

Example response

{
  "gasUsed": 180000,
  "gasLimit": 234000
}