---
title: "Compare every rail for a lane (JSON body)"
method: POST
path: "/api/route/compare"
tags: ["best-execution"]
---

# Compare every rail for a lane (JSON body)

`POST /api/route/compare`

## Request

- Base URL: `https://api.anygas.xyz/svc`
- URL: `https://api.anygas.xyz/svc/api/route/compare`
- Auth: none declared

Same as the GET form; accepts the RouteRequest body. Read-only.

Includes Robyn's OWN float lane as a ranked candidate, not just third-party bridges. The lane is quoted from inventory Robyn already holds on the destination chain, so it needs no external API and still answers when every aggregator is rate-limited or down. The `firstParty` block states the first-party price against the best third-party price for that exact request, so the independence claim is checkable per call. Pass `excludeRails: ["floatlane"]` to compare only third-party rails (used internally when moving Robyn's own inventory, which the lane cannot do).

## Request body

- RouteRequest
  - `fromChain` union, required: Source node: EVM chain id or one of "solana"/"stellar"/"bitcoin".
    - string
    - integer
  - `toChain` union, required: Destination node.
    - string
    - integer
  - `amount` string, required: Source-token smallest units.
  - `fromToken` string: Symbol or address; omit for native.
  - `toToken` string: Symbol or address; omit for native.
  - `toAddress` string: Recipient; defaults to fromAddress.
  - `fromAddress` string: Quote origin; anonymous default used if omitted.
  - `slippage` number: Fraction, e.g. 0.005.
  - `token` string: Shorthand: sets BOTH fromToken and toToken (e.g. "USDC"). Accepted on POST bodies and as a GET query parameter. Explicit fromToken/toToken win when present.

## Response `200`

Ranked rails

- CompareResult
  - `lane` object
    - `fromChain` string
    - `toChain` string
    - `applicableRails` string[]
    - `estOutUnit` string
  - `quotes` object[]
    - `rail` string
    - `ok` boolean
    - `estOut` string
    - `etaSeconds` number
    - `best` boolean
    - `effectiveFeePct` number
    - `qualityScore` integer
  - `best` string
  - `comparedRails` integer
  - `railsAttempted` integer
  - `guard` object
    - `ok` boolean
    - `effectiveFeePct` number
    - `thresholdPct` number
    - `recommendedMinInput` string
  - `cached` boolean

## Other responses

- `400`: Malformed request (missing fromChain/toChain/amount). Body carries errorCode + suggestedAction.
- `429`: RATE_LIMITED — honour Retry-After.

---

[API](https://skmtc.dev/anygas/apis/robyn-anygas-api.md) · [All operations](https://skmtc.dev/anygas/apis/robyn-anygas-api/llms.txt) · [OpenAPI document](https://skmtc.dev/anygas/apis/robyn-anygas-api/revisions/9b7498be8304?raw)
