// 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#

text
https://api.routerx.exchange/v1

All 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

ParameterTypeDescription
chainIdnumberEVM chain ID. Required.
tokenInaddressInput token address. Required.
tokenOutaddressOutput token address. Required.
amountInstringInput amount in base units. Required.
slippageBpsnumberMax slippage in basis points. Default 50.
gasPriceWeistringOverride gas price used for route scoring. Optional.

Response

200 OK
{
  "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.

request
{
  "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.

200 OK
{ "status": "ok", "chains": { "1": { "block": 21456789, "lagMs": 220 } } }

Errors#

Errors use standard HTTP status codes with a machine-readable body.

StatusCodeMeaning
400INVALID_PARAMSA required parameter is missing or malformed.
404NO_ROUTENo executable route exists for this pair and size.
422UNSUPPORTED_CHAINThe chainId is not currently supported.
503QUOTER_LAGGINGThe quoter is behind head; retry shortly.
error body
{ "error": { "code": "NO_ROUTE", "message": "No executable route for pair at this size." } }