API

Aggregation as a service. One endpoint.

Drop cross-chain swap aggregation into your app. Call a single endpoint and get ranked routes with the calldata, approval target, and amounts you need to execute — sourced from numerous aggregators under the hood, with the best route first.

One endpoint

Quote, calldata & approval in a single call.

Numerous aggregators

Queried in parallel, ranked by best output.

No key needed (beta)

Open CORS — call it from anywhere today.

11 chains

Same-chain swaps and cross-chain bridges.

Try it live

Pick an endpoint, tweak the pre-filled defaults, and fire a real request against the live API. The quote example is ready to send — hit Send request and watch a ranked route come back with executable calldata.

POST/api/v1/quote

Query every aggregator in parallel and return ranked routes. Supply a takerAddress to get an executable route (calldata + approval target); omit it for an indicative preview.

Examples

Token address, or the native sentinel 0xEeee…eEeE

0.01 ETH = 10000000000000000 (18 decimals)

Required for executable calldata. Sample address prefilled — swap in your user's wallet.

50 = 0.5%

cURL

curl -X POST 'https://www.swaproute.xyz/api/v1/quote' \
  -H 'Content-Type: application/json' \
  -d '{"fromChainId":8453,"fromToken":"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE","toChainId":8453,"toToken":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","amountRaw":"10000000000000000","takerAddress":"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045","slippageBps":50}'

Runs against the live API. Rate-limited per IP.

Response

Send the request to see a live response here.

Quickstart

Base URL https://www.swaproute.xyz/api/v1. Supply a takerAddress to get executable calldata; omit it for an indicative preview. Poll /status with a route's tracking.ref to follow cross-chain settlement.

const res = await fetch("https://www.swaproute.xyz/api/v1/quote", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    fromChainId: 8453,
    fromToken: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", // native ETH
    toChainId: 8453,
    toToken: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",   // USDC on Base
    amountRaw: "10000000000000000",                          // 0.01 ETH
    takerAddress: userWallet,                                 // for calldata
  }),
});
const { mode, routes } = await res.json();
const best = routes[0];
// best.transaction → { to, data, value } ready to send
// best.approval    → { token, spender, amount } (absent for native sells)

Endpoint reference

POST/api/v1/quote·Get a quote

Query every aggregator in parallel and return ranked routes. Supply a takerAddress to get an executable route (calldata + approval target); omit it for an indicative preview.

Request body

fromChainIdnumberrequired

Source chain ID.

fromTokenstringrequired

Sell-token address, or the EIP-7528 native sentinel.

toChainIdnumberrequired

Destination chain ID.

toTokenstringrequired

Buy-token address, or the native sentinel.

amountRawstringrequired

Sell amount in base units (positive integer string).

takerAddressstring

Connected wallet. Required to receive executable calldata; omit for a preview.

recipientAddressstring

Alternate destination; defaults to the taker.

slippageBpsnumber

Slippage tolerance in basis points (default 50).

fromTokenMeta / toTokenMetaobject

{ decimals, symbol } for tokens not in our registry so they can be priced/routed.

Response

mode"live" | "preview"required

"live" when routes are executable (taker supplied), else "preview".

routes[]PublicRoute[]required

Ranked best-output-first.

routes[].routeIdstringrequired

Opaque route identifier.

routes[].estimatedOut / minOutstringrequired

Expected and guaranteed-minimum output, base units.

routes[].approvalobject?

{ token, spender, amount } — approve this before sending (absent for native sells).

routes[].transactionobject?

{ to, data, value, gas } — the executable transaction (live mode only).

routes[].feesobjectrequired

USD fee breakdown: networkFeeUsd, bridgeFeeUsd, aggregatorFeeUsd, serviceFeeUsd, totalUsd.

routes[].tracking.refstring?

Opaque handle to poll GET /api/v1/status.

GET/api/v1/status·Track a swap

Status of a submitted swap (same- or cross-chain) by the opaque ref from a route's tracking.ref, plus the source tx hash.

Query parameters

refstringrequired

The route's tracking.ref (from a quote).

txHashstring

Source-chain tx hash (required for same-chain and 0x cross-chain).

Response

state"pending" | "success" | "failed"required

Normalized settlement state.

statusstringrequired

Raw upstream status string.

GET/api/v1/tokens·List tokens

Filterable, paginated token list from the registry.

Query parameters

chainIdnumber

Filter to one chain.

qstring

Substring match on symbol/name (or exact address).

limitnumber

Page size, 1–1000 (default 100).

offsetnumber

Page offset.

Response

tokens[]PublicToken[]required

Page of tokens.

totalnumberrequired

Total matches before paging.

GET/api/v1/chains·List chains

Chains the aggregation API can route across.

Response

chains[]object[]required

{ chainId, key, name, shortName, nativeSymbol, logoURI, explorer, isL2 }.