Skip to main content
Version: v5.7.0

Workflow

Included from Basic tier

A workflow is a project-owned, versioned definition of a multi-step run: a YAML source compiled to a step list, executed as workflow runs. The workflow resource presents the definition's identity plus a denormalised view of its latest version (draft included); the stored versions themselves are workflow_version resources (opschain docs resources/workflow_version). JSON:API type: workflow.

The v2 OpenAPI document declares this resource's schema; the resource-field coverage gate holds this page to it.

Endpoints​

All workflow routes live under the project's node path (the node-path router — there is no top-level /api/workflows):

RouteServes
GET /api/projects/{project}/workflowsList, lower(name) ascending. The only supported filter is `filter[archived_eq]=true
POST /api/projects/{project}/workflowsCreate (first version).
GET /api/projects/{project}/workflows/{code}Show.
PATCH /api/projects/{project}/workflows/{code}Update.
DELETE /api/projects/{project}/workflows/{code}Destroy-or-archive (upstream parity): an unused workflow deletes (204), a used one archives with unused versions pruned (206). The draft-only versions variant lives on the versions path.
GET /api/projects/{project}/workflows/{code}/destroyPreview the permanent destroy's per-type manifest (nothing deleted). Admin lane — read plus the workflow path's deletable rule action.
POST /api/projects/{project}/workflows/{code}/destroyPermanently destroy an ARCHIVED workflow — versions and, with with_runs (attribute, meta or query), its runs, their workflow steps and their logs. Refused by name while live, while runs are active, while scheduled activities or triggers reference it, or (without with_runs) while runs exist. Events are retained and an api:workflows:destroyed event is appended.
GET …/workflows/{code}/versions, …/versions/{n}The version history (see the workflow_version page).
GET …/workflows/{code}/runs, POST …/runsThe workflow's runs (see opschain docs resources/workflow_run).

List meta carries authorisations (update/delete on /projects/{project}/workflows) and partial_response.

Attributes​

The identity attributes come from the workflow row; draft, source_yaml, steps and sample_properties are the latest version row's values (highest version number, drafts included).

AttributeTypeMeaning / origin / null semantics
codestringThe workflow's code (its URL identity within the project).
namestringDisplay name.
descriptionstring/nullDescription; null when unset.
draftbooleanWhether the latest version is a draft (unpublished).
archivedbooleanWhether the workflow is archived (the archived_eq filter's column).
created_bystringUsername of the workflow's creator.
created_at / updated_atstringRow timestamps (ISO8601, six fractional digits).
source_yamlstringThe latest version's YAML source, verbatim.
stepsarrayThe latest version's compiled step list (the workflow JSON schema's steps).
inputsobjectThe latest version's typed run-input declarations, {} when none — see the workflow_version page for the declaration shape.
resolved_stepsarrayAlways [] on plain reads: a virtual attribute populated upstream only when a show opts into the ?resolved_steps validation run — not a stored value.
sample_propertiesobjectThe latest version's sample properties; {} when none stored.
latest_versionintegerThe highest version number, drafts included.
latest_published_versioninteger/nullThe highest non-draft version number; null while every version is a draft.
RelationshipTarget typeNotes
parentprojectThe owning project (related link /api/projects/{project}).
versionsworkflow_versionEvery stored version, includable via include=versions.

Links: self, runs, versions, latest_version (the versions/N link), and latest_published_version — present only when a published version exists.

State vocabulary​

A workflow has no status machine of its own; its lifecycle booleans are draft (latest version unpublished) and archived. Run-time status lives on workflow_run and the workflow step family.

Lifecycle: archive vs destroy​

  • Archive (PATCH with archived: true, opschain workflows archive) is the reversible soft-hide: the workflow leaves new-run selection while every version, run and log stays browsable. Unarchive restores it. This is the default way to retire a workflow.
  • Destroy (POST …/destroy, opschain admin workflows destroy) is permanent clean-up for obsolete workflows: the workflow, all versions and — with with_runs — all runs, workflow steps and logs are removed. Archive-first is enforced, the automation plane (triggers, scheduled activities) must be detached first, and the events table is never touched: the audit trail (and the api:workflows:destroyed record of the destroy itself) survives. Nested changes the runs spawned remain as ordinary change history; other workflows' steps that nested this workflow's runs keep their rows with the nested-run links cleared.

The v2 service — WorkflowService​

POST /api/v2/opschain.api.v2.WorkflowService/… carries the whole authoring lane typed: ListWorkflows (code ascending, optional archived filter, summary/full views), GetWorkflow, CreateWorkflow, UpdateWorkflow (create_new_version clones the latest version as a new draft first) and DeleteWorkflow (the v1 204/206 split typed as deleted or the surviving archived workflow). Authorisation mirrors v1: reads need project read; writes update/delete on the workflow's path, 404-on-deny. See opschain docs api-v2.

  • opschain docs resources/workflow_version — the stored versions.
  • opschain docs resources/workflow_run — executions.
  • opschain docs cli/runs-create — creating runs from a workflow.