// Developers
API Reference
The RouterX REST API exposes quoting and routing over HTTPS. There are no API keys and no rate limits — quotes read on-chain state and always return executable routes.
Base URL#
https://api.routerx.exchange/v1All endpoints return JSON. Amounts are decimal strings in the token's smallest unit to avoid floating-point loss.
Authentication#
None. The quoting API is public and unmetered. If you run high-frequency infrastructure and want usage analytics, you can optionally attach an X-RouterX-Tag header — it is for attribution only and never throttles requests.
No rate limits, by design
Quoting is stateless and reads directly from chain state, so you can poll as aggressively as your strategy requires.GET /quote#
GET/v1/quote
Returns the best gas-adjusted route for a single swap.
Query parameters
| Parameter | Type | Description |
|---|---|---|
chainId | number | EVM chain ID. Required. |
tokenIn | address | Input token address. Required. |
tokenOut | address | Output token address. Required. |
amountIn | string | Input amount in base units. Required. |
slippageBps | number | Max slippage in basis points. Default 50. |
gasPriceWei | string | Override gas price used for route scoring. Optional. |
Response
{
"chainId": 1,
"amountIn": "1000000000000000000",
"amountOut": "3421870000",
"amountOutMin": "3404760650",
"gasEstimate": "184000",
"priceImpactBps": 7,
"route": [
{ "adapter": "UniswapV3", "tokenIn": "0xC02a...", "tokenOut": "0xA0b8...", "share": 0.7 },
{ "adapter": "Curve", "tokenIn": "0xC02a...", "tokenOut": "0xA0b8...", "share": 0.3 }
],
"calldata": "0x3593564c000000...",
"to": "0x00000000009726632680FB29d3F7A9734E3010E2",
"value": "0"
}The calldata and to fields are ready to submit as a transaction — no further construction needed.
POST /route#
POST/v1/route
Advanced routing for multi-leg or constrained trades. Use this when you need to pin specific venues, exclude adapters, or request an exact-output route.
{
"chainId": 1,
"tokenIn": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"tokenOut": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"amount": "1000000000000000000",
"mode": "exactIn",
"include": ["UniswapV3", "Curve", "Balancer"],
"exclude": [],
"maxHops": 3,
"recipient": "0xYourBotAddress"
}The response shape matches GET /quote, with an additional splits array describing each parallel leg.
GET /tokens#
GET/v1/tokens?chainId=1
Returns the token list RouterX indexes for a chain, including decimals and adapter coverage. Useful for building token pickers or validating input.
GET /health#
GET/v1/health
Reports per-chain quoter status and the latest indexed block. Poll it to confirm the quoter is current before firing time-sensitive trades.
{ "status": "ok", "chains": { "1": { "block": 21456789, "lagMs": 220 } } }Errors#
Errors use standard HTTP status codes with a machine-readable body.
| Status | Code | Meaning |
|---|---|---|
| 400 | INVALID_PARAMS | A required parameter is missing or malformed. |
| 404 | NO_ROUTE | No executable route exists for this pair and size. |
| 422 | UNSUPPORTED_CHAIN | The chainId is not currently supported. |
| 503 | QUOTER_LAGGING | The quoter is behind head; retry shortly. |
{ "error": { "code": "NO_ROUTE", "message": "No executable route for pair at this size." } }