POST /compose turns it into the transactions your wallet submits. This page describes what the service checks, quotes and simulates, and what it returns.
What happens when you call POST /compose
1
Key and version check
The service checks your API key and SDK version. See Before you start for both requirements and their errors.
2
Shape validation
The Flow JSON is validated against the wire-format schema: required fields, types, ref shape, and node ids. Malformed input is rejected with a
decode_error (HTTP 400) before anything else happens.3
Semantic validation
Every op and guard name must be registered, every bound port must exist and match its expected kind, every ref must resolve to an input or an earlier node, and every input must be on the flow’s chain. Ref and binding problems surface as
validation_error; a resource consumed twice, or consumed after it was delivered away, surfaces as linearity_error. A guard attached to a port it cannot protect fails with guard_error.4
Runtime input resolution
The
run.inputs values you passed are matched to the Flow’s declared inputs. A materialiser funds or measures the input when the transaction runs. A plain integer string on a resource input means the proxy already holds that amount, and nothing is pulled from the signer. See Wire runtime values.5
Quoting
Composer requests a quote for each op that needs one (
lifi.swap, lifi.zap, lifi.bridge, lifiIntents.order), using its inputs and the results of earlier ops. Amounts that depend on earlier steps, such as a swap’s exact output, are not fixed here: the transaction passes them from step to step onchain.A continuation.settle node also registers an escrow at this point; the response reports it in settlements. See Cross-chain flows.If quotes fail, the response is one preparation_error (HTTP 422) listing every failed op in failedOps and every successful one in succeededOps, so you can drop the unroutable legs and resubmit. If every failure is a transient upstream outage, the response is resolution_error (HTTP 503) instead: retry the same flow. A zap edge with no route raises no_route_error (HTTP 404).6
Epilogue
If the flow has an epilogue, or the run sets
run.sweepTo, its transfers run after the last node.7
Simulation
Composer simulates the flow against the latest state of its chain when the response needs a measured value, and turns each guard into a check inside the transaction. See When guards run. The simulation assumes the signer holds the amounts the flow pulls and has granted its approvals, so you can compile before the user approves.A revert surfaces as
simulation_revert: HTTP 422 under the default simulationPolicy: "strict", or HTTP 206 with the transaction under "allow-revert". If the simulator itself is unreachable, the response is simulation_rpc_error (HTTP 502), and "allow-revert" never turns that into a 206.8
Policy check
Composer checks the compiled transaction against its execution policies before returning it. A failure is a
verification_error (HTTP 500).9
Price-impact check
When the service can price the inputs and outputs, it compares their USD values and rejects the compile with
price_impact_exceeded (HTTP 422) if the impact exceeds run.maxPriceImpactBps. The default bound is 500 bps (5%); 0 disables the check. The priceImpact block appears on the response whether or not you set a bound, unless you set 0; a positive impactBps means the outputs are worth less than the inputs.10
User-program simulation (optional)
With
run.simulateUserProgram: true, the service also simulates the exact transaction the user will sign. A revert follows simulationPolicy; a success is echoed as userProgramSimulation. If the simulator fails for reasons unrelated to your flow, the response falls back to the normal 200 without that field.11
Response
The service returns a
ComposeCompileResult, described in the next section.The compile response
ComposeCompileResult is a discriminated union on its status field. The SDK decodes amount strings to bigint.
status: 'success' (HTTP 200)
status: 'partial' (HTTP 206)
You get this only with simulationPolicy: "allow-revert" when the simulation reverted. The payload carries transactionRequest (without gasLimit), userProxy, outputs, actions, approvals, settlements and warnings, plus error ({ kind, message }) and simulationRevert (the raw revert bytes and decoded candidates). It has no epilogue, and on the REST body producedHandles is an empty object. Estimates are quotes, and floors come only from ops and inputs.
Branch on result.status before you read shape-specific fields. On a success, transactionRequest can be absent, for example for a continuation funded only by an external transfer; iterating actions in order covers every case.
Flows that finish later
Most flows finish when theexecute transaction confirms. A flow whose terminal outputs have delivery.when: "future" finishes later: a bridge or LI.FI Intents order delivers on another chain, or LI.FI’s settlement service runs a cross-chain flow’s destination flow from its escrow. Track a bridge with LI.FI’s /v1/status (delivery.provider is the bridge parameter) and the escrow with the escrow status endpoint.
Errors you might see
The service returns a structured error with akind field; the SDK throws it as a ComposeError. The most common kinds:
See Error codes for the full catalog and recovery hints.
See also
- Flow Structure: what you submit.
- Guards: what the simulation step asserts.
- Terminal Resources: the epilogue and how amounts are reported.
- Cross-chain flows: flows that finish later from an escrow.
- Error codes: full catalog of
kindvalues.

