best-execution

Why this route won — and what it actually beat

Every router in this space returns a winner. None tells you what it beat, or whether it beat anything at all. "Best route" is presented identically when five rails competed and the cheapest won, and when four rails failed to answer and the survivor was declared best by default — so an agent cannot tell a good price from the only price. This returns the whole decision: every rail that quoted, what each would deliver, the margin the winner won by, and which rails stayed SILENT and why. CHECK wasCompetitive BEFORE PRESENTING A PRICE AS GOOD. When false, exactly one rail answered and "best" means "only". Rails listed in silentRails did NOT lose — they failed to answer (down, rate-limited, missing credentials) and each carries its reason. Counting silence as defeat is how a router flatters its own coverage. Signed, so the rationale can be archived. Silent rails are CLASSIFIED: status:"not-configured" (missing credentials — will never recover on retry, needs an operator) versus status:"degraded" (rate limit or cooldown — may self-heal). Each carries recoversOnRetry and a remedy.

post/api/route/why

Request

  • Base URL: https://api.anygas.xyz/svc
  • URL: https://api.anygas.xyz/svc/api/route/why
  • Auth: none declared

Request body

amountstring required

Source-token smallest units.

fromTokenstring

Symbol or address; omit for native.

toTokenstring

Symbol or address; omit for native.

toAddressstring

Recipient; defaults to fromAddress.

fromAddressstring

Quote origin; anonymous default used if omitted.

slippagenumber

Fraction, e.g. 0.005.

tokenstring

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.

Example request

{
  "amount": "50000000",
  "fromToken": "USDC",
  "toToken": "BTC",
  "token": "USDC"
}

Response

Signed rationale: chosen, runnerUp, margin, candidates, silentRails, wasCompetitive

object required

Changes

No recorded changes to this operation across all 1 revision of this API.