Workflow
The Workflow is the engine that defines the business conditions that hold or release a
value. It's genuinely optional — a Transaction can be created with no workflowVersionId at
all, and executeSettlement() never checks Workflow state either way (see
Transaction, Settlement, Split, and Refund). Use it when you want
the platform itself to model and enforce your product's lifecycle; skip it when your own
application already decides when to settle. Seven concepts make up this engine:
- Workflow — the reusable "mold" of a process (e.g., simple escrow, marketplace with split).
- Workflow Version — an immutable, publishable snapshot of a Workflow. Every
Transactionreferences a specific version, never the "current" Workflow — once published, a version is never changed; a change requires a new version. - State — a possible state within a Workflow Version (e.g.,
waiting_payment,funded,settled). - Transition — the allowed edge between two States, governed by one or more Rules.
- Rule — the configurable condition that authorizes a Transition.
- Condition — the predicate evaluated within a Rule (e.g., deadline expired, amount received ≥ expected).
- Action — the side effect triggered by a successful Transition (e.g., trigger a Settlement, emit a Webhook).
Creation flow
- Create the Workflow (draft).
- Define States, Transitions, and Rules.
- Publish — the platform validates consistency (reachable states, no invalid cycles) before making the version immutable.
Routes
- Create Workflow:
POST /v1/organizations/{organizationId}/workflows - Create version:
POST /v1/workflows/{workflowId}/versions - Publish version:
publish-workflow-version - Get:
get-workflow/get-workflow-version