Quote and build in one call
const url = 'https://api.getchord.xyz/v1/swap/calldata?chain=5042&tokenIn=example&tokenOut=example&amountIn=example&slippageBps=100';const options = {method: 'GET'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://api.getchord.xyz/v1/swap/calldata?chain=5042&tokenIn=example&tokenOut=example&amountIn=example&slippageBps=100'For contracts and bots that call the router directly: routes and encodes in a single request. The output goes to msg.sender; the caller approves the router for tokenIn and sends the calldata.
Parameters
Section titled “ Parameters ”Query Parameters
Section titled “Query Parameters”Chain id: 5042 Arc · 4663 Robinhood Chain · 143 Monad · 43114 Avalanche C-Chain · 8453 Base · 56 BNB Chain · 42161 Arbitrum One · 1 Ethereum. Omitted = 143.
EVM address, hex, case-insensitive.
Token the caller approves and sends.
EVM address, hex, case-insensitive.
Token returned to msg.sender.
Amount in the token’s smallest unit, as a decimal string. Never a float.
Sets minOut on the returned calldata.
Responses
Section titled “ Responses ”Router call.
object
EVM address, hex, case-insensitive.
Amount in the token’s smallest unit, as a decimal string. Never a float.
Minimum output, human units.
Quoted output, human units.
Example
{ "to": "0x1b1fee89a381e595fe6536b99ba91f3e16e9601a", "data": "0x…", "value": "0", "minOut": "0.0942", "expectedOut": "0.0951", "gasLimit": "1000000"}Invalid parameters — error names the check that failed (INVALID_PARAMS, BAD_ADDRESS, BAD_LIMIT, BAD_HOURS, …).
Every non-2xx body.
object
Stable machine code, e.g. INVALID_PARAMS, NOT_READY, RATE_LIMIT_EXCEEDED.
For humans.
HTTP status, when included.
Example
{ "error": "INVALID_PARAMS", "message": "amount must be an integer string in the token's smallest unit"}Nothing at this identity (NOT_FOUND, UNKNOWN_TOKEN, NO_ROUTE).
Every non-2xx body.
object
Stable machine code, e.g. INVALID_PARAMS, NOT_READY, RATE_LIMIT_EXCEEDED.
For humans.
HTTP status, when included.
Example
{ "error": "INVALID_PARAMS", "message": "amount must be an integer string in the token's smallest unit"}Over the per-minute limit (RATE_LIMIT_EXCEEDED). Read X-RateLimit-Reset and back off.
Every non-2xx body.
object
Stable machine code, e.g. INVALID_PARAMS, NOT_READY, RATE_LIMIT_EXCEEDED.
For humans.
HTTP status, when included.
Example
{ "error": "INVALID_PARAMS", "message": "amount must be an integer string in the token's smallest unit"}The routing engine or an upstream did not answer (ENGINE_ERROR, ROUTE_ERROR).
Every non-2xx body.
object
Stable machine code, e.g. INVALID_PARAMS, NOT_READY, RATE_LIMIT_EXCEEDED.
For humans.
HTTP status, when included.
Example
{ "error": "INVALID_PARAMS", "message": "amount must be an integer string in the token's smallest unit"}