Write a plan
A plan is an ordered list of /v1 calls. Later steps refer to earlier steps' results with $ref.
Example
POST /v1/plans/preview
{
"description": "Onboard Acme portfolio",
"steps": [
{ "ref": "e1", "method": "POST", "path": "/v1/legal-entities",
"body": { "name": "Acme Holdings LLC", "entity_type": "llc",
"operations_start_date": "2026-01-01", "status": "active" } },
{ "ref": "p1", "method": "POST", "path": "/v1/properties",
"body": { "code": "AC-1", "name": "Main St Plaza", "legal_entity_id": "$e1/data/id" } }
]
}Step p1 creates a property owned by the legal entity step e1 creates. Its id does not
exist yet when the plan is written, so p1 refers to it as $e1/data/id.
Steps
A step is { ref, method, path, body?, headers? }.
- Each step is a real call to a
/v1route, made with your own credentials, so the route's own scopes and validation apply. A plan never grants anything you could not do directly. refmatches^[a-z][a-z0-9_]{0,31}$and is unique in the plan (elsePLAN_DUPLICATE_REF).- Order. Steps run in list order, inside one database transaction.
- Plannable routes. A non-
GETstep must call a route listed inplannable_routes, else it fails withPLAN_ROUTE_NOT_PLANNABLE. - Failure is contained. A failed step rolls back only its own writes. Every step that
references it, directly or through another step, is
skippedwithblocked_by. Independent steps still run, so one preview reports every error at once. - Size. At most 50 steps and 256 KB of body (
PLAN_TOO_LARGE,split_plan).
References
A reference is $<ref> followed by an RFC 6901
JSON Pointer into that earlier step's response body. Responses use the normal envelope, so
ids live under /data.
A reference may appear:
- as a whole string value anywhere in
body:"legal_entity_id": "$e1/data/id"; - as whole path segments in
path:/v1/loans/$l1/data/id/activate; - as a whole step header value:
"x-contract-version": "$c1/data/version".
Never inside a longer string: "name": "Loan for $e1/data/name" is sent as that literal
text.
"$l1/data/participants/0/id" an array index: the first participant of the loan step l1 created
"$lender/data/0/id" a GET lookup: the first row of step lender
"/v1/loans/$l1/data/id/activate" a path segment: activates the loan step l1 createdRules
- In
bodyandpaththe resolved value keeps its JSON type. There is no coercion: a number where the route wants a string is the route's own validation error. - In a header, a scalar becomes its string form (
3becomes"3"). An object, array ornullthere isPLAN_REF_UNRESOLVED. - A reference to a later step is
PLAN_REF_FORWARD, and the whole plan is refused. - A reference to a failed or skipped step, or to a pointer with no value, skips the step
with
PLAN_REF_UNRESOLVED.
An action step has no data.id
POST /v1/loans/{id}/activate answers { "data": { "schedule_entries_count": 60 } }, so
$a1/data/id resolves to nothing. To use the activated loan later, reference the create
step: $l1/data/id.
GET steps
Any GET /v1/... can be a step. It sees the rows earlier steps wrote, writes nothing, and
its response is kept in the report. Use it to look an id up inside the plan instead of
before it:
{ "ref": "lender", "method": "GET", "path": "/v1/parties?search=Wells%20Fargo&limit=1" }then "counterparty_id": "$lender/data/0/id".
Large responses. A step response over 4 KB is replaced in the report by
{ "truncated": true, "bytes": <size> }, and the report's top-level truncated becomes
true. References still resolve against the full response, so $lender/data/0/id works
however long the list is. Narrow the GET (limit, filters) if you need to read it. If the
search finds nothing, /data/0/id has no value and every step that uses it is skipped with
PLAN_REF_UNRESOLVED.
Step headers for versioned edits
Some update routes need a version header. PATCH /v1/contracts/{id} requires
x-contract-version (it answers 428 without one). A step may send these headers only:
if-matchx-contract-version
Names are compared case-insensitively. Any other name, authorization included, refuses
the whole plan with 400 VALIDATION_FAILED and context.pointer
/steps/<i>/headers/<name>. Credentials always come from the plan request itself.
Take the version from the step that created or read the record:
{ "ref": "c1", "method": "POST", "path": "/v1/contracts", "body": { "…": "…" } },
{ "ref": "u1", "method": "PATCH", "path": "/v1/contracts/$c1/data/id",
"headers": { "x-contract-version": "$c1/data/version" },
"body": { "title": "Main St Plaza lease (edited)" } }A stale version is a normal step error: step u1 gets 409 CONTRACT_VERSION_MISMATCH and
the steps that reference it are skipped. Re-read the record with a GET step and use its
version.
Headers are part of the plan's fingerprint.
Preview
POST /v1/plans/preview
Content-Type: application/jsonThe body is { "description", "steps" }. The answer is 200 with the
report under data, even when steps failed. Nothing
is kept except the stored preview itself, which you can commit by its plan_id for 7 days.