Best route for a swap
const url = 'https://api.getchord.xyz/v1/quote?chain=5042&inputMint=example&outputMint=example&amount=example&slippageBps=50&fast=0';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/quote?chain=5042&inputMint=example&outputMint=example&amount=example&slippageBps=50&fast=0'Quotes every venue on the chain in parallel, splits the order across venues when that improves the output, composes a two-hop route through the chain’s anchors when no direct pool wins, and returns the best.
Use it for: a price before a trade, a route card, an agent deciding whether to buy, a bot comparing venues.
Notes
- Amounts are strings in the token’s smallest unit. On Arc the USDC predeploy has 6 decimals, native USDC 18 — send the predeploy address
0x3600…0000(the zero address is an alias for it on 5042). - A quote is a live read of the venues and is good for about 30 seconds. Re-quote before you build if you waited longer.
fast=1returns a single-hop answer in about 400 ms markedpreliminary; run the full quote alongside and replace it.only=pins one venue and bypasses the routing safety gates — it needs an API key.- An empty
routePlanis a real answer (no route at this size); readnoRouteReason.
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. Always pass it.
EVM address, hex, case-insensitive.
Token you sell. The zero address means the native unit (an alias for the USDC predeploy on Arc; ETH on Robinhood Chain).
EVM address, hex, case-insensitive.
Token you buy.
Amount in the token’s smallest unit, as a decimal string. Never a float.
Input amount, smallest unit.
Slippage tolerance in basis points; sets otherAmountThreshold.
1 = progressive first frame (single-hop, ~400 ms, preliminary: true).
Debug: restrict routing to one venue id. Requires X-API-Key.
Responses
Section titled “ Responses ”The best route. routePlan empty + outputAmount “0” = no route.
object
EVM address, hex, case-insensitive.
EVM address, hex, case-insensitive.
Amount in the token’s smallest unit, as a decimal string. Never a float.
Amount in the token’s smallest unit, as a decimal string. Never a float.
Minimum output after fee and slippage — the number the transaction enforces.
Percent, as a string, against the spot rate of the same route.
Empty with outputAmount “0” = no route (an honest answer, never a fabricated price).
One leg of the route.
object
Share of the input this leg carries.
object
Venue id (see Resources → Venue ids).
Pool address, or the 32-byte pool id on Uniswap V4.
EVM address, hex, case-insensitive.
EVM address, hex, case-insensitive.
Amount in the token’s smallest unit, as a decimal string. Never a float.
Amount in the token’s smallest unit, as a decimal string. Never a float.
The router adapter that executes this leg — from the engine, never hardcode.
Adapter-specific calldata for the leg.
Amount in the token’s smallest unit, as a decimal string. Never a float.
EVM address, hex, case-insensitive.
Only when routePlan is empty: INSUFFICIENT_LIQUIDITY (try a smaller amount) or NO_POOLS.
Gas units, from the venue quoter or the RPC.
Engine seconds.
Protocol fee on the output token, per token on-chain (FeeCollector.feeBpsFor): 5 bps by default on every chain, 0 on the stablecoins and majors a chain exempts (USDC / EURC on Arc, WETH / USDG and stocks on Robinhood Chain), capped at 100.
Amount in the token’s smallest unit, as a decimal string. Never a float.
EVM address, hex, case-insensitive.
major · stable · standard · meme · new.
Present only on fast=1 answers: single-hop, ~400 ms, replace it with the full quote.
Example
{ "inputMint": "0x3600000000000000000000000000000000000000", "outputMint": "0x171a4217b86a807a64eb94757db6849fb4bdbaa0", "inputAmount": "5000000", "outputAmount": "465", "otherAmountThreshold": "460", "slippageBps": 100, "priceImpactPct": "92.51", "routePlan": [ { "percent": 100, "swapInfo": { "dex": "uniswap_v4", "pool": "0xdd9da42901118c475e6efb78117100e611c675e2c53bc801c4d2bfdd504b2e8d", "inputMint": "0x3600000000000000000000000000000000000000", "outputMint": "0x171a4217b86a807a64eb94757db6849fb4bdbaa0", "inputAmount": "5000000", "outputAmount": "465", "adapter": "0xd1d86d370f40471B79D9938B27F6ea040EbD6888", "extraData": "0x000000000000000000000000171a4217b86a807a64eb94757db6849fb4bdbaa00000000000000000000000003600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000017700000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000" } } ], "gasEstimate": "318189", "gasCostUSD": "0", "blockNumber": 21808240, "timeTaken": 0.643, "feeBps": 25, "feeAmount": "1", "feeMint": "0x171a4217b86a807a64eb94757db6849fb4bdbaa0", "feeTier": "meme"}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"}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"}The lane behind this endpoint is not ready or not enabled here (NOT_READY, CHAIN_NOT_ENABLED, NOT_ENABLED, *_UNAVAILABLE). Retry later; do not treat it as an empty answer.
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"}