> ## Documentation Index
> Fetch the complete documentation index at: https://docs.route.fun/llms.txt
> Use this file to discover all available pages before exploring further.

# Compare swap routes

> GET /api/v2/quote

`GET /api/v2/quote`

Search verified direct pools, up to four Kyber variants, and one 0x firm quote when enabled. 0x output already includes its provider fees; Route adds no fee. Validate fixed AllowanceHolder, decoded input/recipient/output bindings and the active onchain Settler registry. Deduplicate and build candidates, then simulate complete calldata at one shared block using synthetic caller balance and exact-allowance fixtures; real token code is not replaced.

Exclude reverting candidates and prefer simulated candidates over unverified ones. Rank by simulated user output minus RPC-estimated gas using a common conversion model, or output alone if conversion is missing. Unsupported token layouts/RPC failures are explicitly unverified, not proof of executability.

Up to 3 hops and 3 disjoint split branches; 10% grid with 1% local refinement. No global-best or future-execution guarantee. amountOut retains the original quote; execution.amountOut is the assessed output used for ranking and UI review. Optional provider restricts comparison to that source; it does not disable execution checks.

Nothing is signed or submitted. For an already-discovered V4 pool whose PositionManager key is missing or mismatched, one exact-pool-ID Initialize-event lookup can recover its immutable key. The complete key hash and current PoolManager state must still match; hooks and dynamic fees remain excluded.

This does not index every pool or replace listing discovery. Only when initial verified discovery yields no supported path, Route additionally probes at most 28 common hook-free V4 keys at the quote block, including native ETH alternatives. Existing pools are preserved within the 96-pool cap.

Searches that already have a path perform no such probes; a path whose quotes fail does not trigger a second expanded search. This bounded availability fallback is not a universal best-price or speed guarantee, and final execution checks remain required. Expensive HTTP requests have a 25-second response deadline; timeout returns 503 QUOTE\_TIMEOUT.

Workers waitUntil retains already-started read-only work and its cleanup after client disconnect, subject to the platform lifetime. Admission and in-flight search ownership expire after 60 seconds as an abandoned-request safeguard; late cleanup cannot delete replacement owners. The four-concurrent and 60-admissions-per-minute per-isolate limits remain.

BUSY returns Retry-After: 2 for concurrency, or the remaining minute-window seconds for rate exhaustion. No new endpoint, background signing or relaxed transaction check is introduced. comparison lists every deduplicated candidate entering final assessment, including failed, expired and unverified results, with exactly one selected candidate. It does not enumerate every preliminary pool path or unavailable provider quote.

These display-only summaries contain no calldata and cannot be submitted as swap plans. The UI highlights the selected candidate; its animation is a visualization of the completed comparison, not live execution or JIT routing. Missing sources and merged duplicate requests are counted separately.

No extra routing requests are made for the map. Overlapping Kyber variants share only pending network-reference reads (block, gas price and chain ID). A later request reads again; each quote still checks network freshness, and final full-transaction assessment obtains its own execution context.

The assessed gas price is the maximum of a positive RPC suggestion and the checked block base fee, avoiding an inadmissible price when concurrent reads describe adjacent fee states. All candidates still execute at that same price; there is no hidden zero-price fallback. Wallet final checks apply the same observed base-fee floor, not a guarantee against future fee increases.

Unavailable execution checks include a closed failure stage/reason; no remote error bodies, credentials or calldata are returned. These diagnostics do not retry failures, lower minimums or promote unverified candidates. After the first validated provider quote, cold ERC20 simulation-layout discovery may overlap remaining provider work.

Layout hints are bounded and scoped to one RPC client; native input and warm hints require no discovery. Started probes are joined before final assessment. Every candidate still validates its exact simulated balance and allowance at the final execution block; no completed price or execution result is cached.

All complete-transaction checks use one explicit positive gas price shared across candidates, eth\_call, estimateGas and ranking. execution.gasPrice records that context; it is not a fee or fill guarantee. Before signing, the wallet flow refreshes the fee fields and simulates again. On EIP-1559 chains, the fee cap is twice the latest base fee plus the suggested priority fee.

Other chains use legacy gas pricing. The signature request uses the same fee fields as the final simulation. Wallet edits or later blocks can still affect execution.

Direct sources include Uniswap V2/V3/V4, GIGA CL and Ramses CL; this is not exhaustive chain liquidity coverage. The lean executor uses canonical V2 pair and authenticated canonical V3 pool-callback execution, retaining fixed Ramses routing and all other adapter fallbacks while preserving all signed limits. Search gas costs are receipt-informed heuristics; final ranking uses full-transaction assessment.

Identical in-flight blockchain reads share work only while pending, keyed by complete parameters including block and state overrides. Public transport may use one backup RPC after 250ms; configured private server transport does not hedge to public RPC. Deterministic execution rejections fail closed.

No completed price or execution result is cached. Independent exact-remainder split checks run concurrently under the existing sampler limits and retain deterministic selection order. Pre-sign refresh is not execution-time JIT; this executor has no adaptive rerouting.

No API key or site login is required on the public production service. Request limits and validation still apply.

## Query parameters

| Parameter | Type    | Required |
| --------- | ------- | -------- |
| chainId   | integer | yes      |
| tokenIn   | string  | yes      |
| tokenOut  | string  | yes      |
| amountIn  | string  | yes      |
| provider  | string  | no       |

## Responses

* **200:** Successful response.
* **400:** Structured error; see errors and access.
* **409:** Structured error; see errors and access.
* **422:** Structured error; see errors and access.
* **429:** Structured error; see errors and access.
* **503:** Structured error; see errors and access.

[Full request and response schemas](/api-reference/openapi) · [Errors and access](/api-reference/overview)
