Calculates the optimal swap route between two tokens.
Endpoint:GET /route
Parameters:
Name
Type
Description
Required
tokenA
address
Address of the input token
Yes
tokenB
address
Address of the output token
Yes
amountIn
number
Amount of input token (human readable, e.g., 1.5)
No*
amountOut
number
Desired output amount (for reverse routing)
No*
multiHop
boolean
Set to "true" to enable multi-hop routing
No
excludeDexes
string
Comma-separated list of router indices to exclude
No
* You must provide either amountIn OR amountOut, but not both.
Example Request (Direct Swap):
GET https://api.liqd.ag/route?tokenA=0x47bb061C0204Af921F43DC73C7D7768d2672DdEE&tokenB=0xF26A8ab118f4C46A2D3C0C5cF4bf446008efBf8c&amountIn=1
Example Request (Multi-Hop Swap):
GET https://api.liqd.ag/route?tokenA=0x47bb061C0204Af921F43DC73C7D7768d2672DdEE&tokenB=0xF26A8ab118f4C46A2D3C0C5cF4bf446008efBf8c&amountIn=1&multiHop=true