---
title: "Validate a whole multi-step plan before executing step one"
method: POST
path: "/api/route/plan"
tags: ["planning"]
---

# Validate a whole multi-step plan before executing step one

`POST /api/route/plan`

## Request

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

Agents execute WORKFLOWS, not single transfers, but every quoting API validates one hop at a time — so an agent discovers that step 3 is impossible only after paying for steps 1 and 2, and money spent reaching a dead end is not recovered by discovering it was a dead end. POST the whole plan and get it validated up front. Fees and durations ACCUMULATE across steps. Evaluation stops at the first unroutable step rather than reporting speculative results for steps behind it. When a plan is infeasible the response names the BINDING CONSTRAINT and the value that would work (`bindingConstraint`, `whatWouldMakeThisWork`) — a bare "no" sends an agent into blind retries. Optional `constraints`: maxTotalFeeBps, maxTotalSeconds, maxStepSeconds, requireNonCustodial. READ-ONLY: nothing is signed, reserved or moved. Each feasible step now carries a signed `attestation` of its quoted terms, so a validated plan is also a LOCKABLE one: pass a step's attestation with `minOut` to that step's execute call and execution is bound to the terms you were shown. Without it the plan is advice only, and the price can move between validating and running it.

## Request body

- object
  - `steps` RouteRequest[], required
    - `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.
  - `constraints` object
    - `maxTotalFeeBps` integer
    - `maxTotalSeconds` integer
    - `maxStepSeconds` integer
    - `requireNonCustodial` boolean

## Response `200`

Per-step results, accumulated totals, feasibility and (if infeasible) the binding constraint plus its remedy

- object

## Other responses

- `400`: Malformed plan

---

[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)
