Skip to content

Quote and build in one call

GET
/swap/calldata
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.

chain
integer
default: 143
Allowed values: 5042 4663 143 43114 8453 56 42161 1

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.

tokenIn
required

EVM address, hex, case-insensitive.

string
/^0x[a-fA-F0-9]{40}$/

Token the caller approves and sends.

tokenOut
required

EVM address, hex, case-insensitive.

string
/^0x[a-fA-F0-9]{40}$/

Token returned to msg.sender.

amountIn
required

Amount in the token’s smallest unit, as a decimal string. Never a float.

string
/^\d+$/
slippageBps
integer
default: 100 >= 1 <= 5000

Sets minOut on the returned calldata.

Router call.

Media typeapplication/json
object
to

EVM address, hex, case-insensitive.

string
/^0x[a-fA-F0-9]{40}$/
data
string
value

Amount in the token’s smallest unit, as a decimal string. Never a float.

string
/^\d+$/
minOut

Minimum output, human units.

string
expectedOut

Quoted output, human units.

string
gasLimit
string
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, …).

Media typeapplication/json

Every non-2xx body.

object
error
required

Stable machine code, e.g. INVALID_PARAMS, NOT_READY, RATE_LIMIT_EXCEEDED.

string
message

For humans.

string
statusCode

HTTP status, when included.

integer
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).

Media typeapplication/json

Every non-2xx body.

object
error
required

Stable machine code, e.g. INVALID_PARAMS, NOT_READY, RATE_LIMIT_EXCEEDED.

string
message

For humans.

string
statusCode

HTTP status, when included.

integer
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.

Media typeapplication/json

Every non-2xx body.

object
error
required

Stable machine code, e.g. INVALID_PARAMS, NOT_READY, RATE_LIMIT_EXCEEDED.

string
message

For humans.

string
statusCode

HTTP status, when included.

integer
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).

Media typeapplication/json

Every non-2xx body.

object
error
required

Stable machine code, e.g. INVALID_PARAMS, NOT_READY, RATE_LIMIT_EXCEEDED.

string
message

For humans.

string
statusCode

HTTP status, when included.

integer
Example
{
"error": "INVALID_PARAMS",
"message": "amount must be an integer string in the token's smallest unit"
}