Drafts, publishing and versions
A workflow is edited as a draft, checked, and published as a numbered version. One version is live at a time, and runs always finish on the version they started on. This page covers that whole cycle, and turning a workflow off, retiring it and deleting it.
Drafts
Changes you make in the designer are a draft until you publish. A draft can be broken: half-wired steps and empty settings are fine while you work. Nothing a draft says affects the runs of the live version.
Choose Edit on a published workflow to start a draft from its live version, and Discard draft to throw your changes away. A new workflow is a draft until its first publish.
Checking a workflow
Validate checks the draft against the same rules publishing uses and lists what it finds in Problems, each linked to the step and the setting. There are two kinds:
- Errors block publishing: a step with a required setting left empty, a connection to nothing, a client that isn't in this workspace, an integration that doesn't exist, a loop in parallel that never joins, a value out of range.
- Warnings don't: a step nothing leads to, a workflow with no trigger, a client that is pending or revoked, a shared variable read but never set, an error path that leads straight to an End.
The full list of codes is in Retries and failures, in depth.
Publishing and versions
Publish checks the draft once more and saves it as the next version: v1, v2, v3. A version never changes after it's published. To change a workflow you publish a new one.
- Publishing can make the new version live straight away, or leave the live version where it is so you can switch later.
- Switching the live version to an older one is how you roll back. Its triggers replace the newer one's in one step.
- Runs already going finish on the version they started on. New runs start on the live version.
- Each run shows the version it ran, and its steps read as they were in that version, even after you rename or remove them.
On, off, deprecated, deleted
| State | What starts it | What you can do |
|---|---|---|
| Enabled | Its triggers, on the live version. | Everything. Publish, switch versions, turn it off. |
| Disabled | Nothing. Run by hand is refused. | Edit, publish and test. Turn it on by making a version live. |
| Deprecated | Nothing. | Read it and its runs. Reinstate or delete it. |
| Deleted | Nothing, ever. | Read its past runs, by run. |
- Turning a workflow off removes its triggers and schedules and drops events waiting in its queue. Runs already going finish, unless you choose to cancel them too.
- Deprecate retires a workflow you no longer use but want to keep. Its triggers go as when turning it off; its versions and runs stay. It can't be published or turned on until you reinstate it.
- Reinstate brings a deprecated workflow back Disabled. Nothing starts it until you make a version live again.
- Delete can't be undone. The workflow leaves the list, its triggers go, runs still going are cancelled shortly after, and its ID can never be published again. Past runs stay readable from the run.
Workflow settings
These are saved with each version, so they change when you publish.
| Setting | What it does |
|---|---|
| Name, Description | Shown in the explorer, in tabs and in run history. |
| Fail the run when a path fails | Off (default): the other paths carry on and the run ends partly failed. On: the first failed path fails the whole run. See Retries and failures. |
| Credit limit per run | The most one run may spend. 10,000 when left empty. A run that reaches it stops as Out of credits. |
What happens when…
- I publish while runs of the old version are going
- They finish on the old version, including ones waiting days on a timer or a signal. Only new runs use the new one.
- I publish a version whose trigger was removed while events were queued for it
- Making the new version live drops the events queued for triggers it no longer has. The answer says how many.
- A version publishes but can't be made live
- It stays published and not live, and the answer says why, say an integration that was deleted. Fix it and make it live.
- Two people edit the same workflow through the API
- Each save of a server draft carries the revision it started from. A save over someone else's newer one is refused with
WORKFLOW_DRAFT_CONFLICT, so nobody overwrites another's work unseen. - Someone publishes while my draft is open
- Your draft is now outdated. Publishing it is refused with
WORKFLOW_DRAFT_OUTDATEDuntil you confirm you want to publish it anyway over their version. - A workflow uses a client that was deleted
- Publishing or making that version live is refused with
CLIENT_NOT_FOUND. A version already live keeps running; its step fails at run time. - The workspace has 100 workflows
- A new one can't be published. Drafts of new workflows don't count, up to 50 of them.
Rules and API
Endpoints
Under /api/v1/workspaces/{workspaceRef}/workflows.
| Call | Permission | Does |
|---|---|---|
POST / | workflows.create | Publishes: { refId, name, description, nodes, edges, sharedVariableSchema, creditBudget, failFast, enable }. enable is required. Answers { refId, version, state, liveVersion }. |
POST validate | workflows.create | Checks without publishing. An invalid definition is a 200 with isValid: false and every issue's code, nodeId and field. |
GET drafts, GET /{workflowRef}/draft | workflows.read | Server drafts, with revision, baseVersion, outdated and the draft's validation. |
PUT /{workflowRef}/draft | workflows.create | Saves a draft with expectedRevision (null to start one). |
POST /{workflowRef}/draft/publish | workflows.create | { revision, enable, force }. Publishes the draft and deletes it in one step. |
DELETE /{workflowRef}/draft?revision= | workflows.create | Discards it, only at that revision. |
GET /{workflowRef}/versions, /versions/{n} | workflows.read | Every version with isLive and run count; one version's definition, readable after deletion. |
POST /{workflowRef}/enable | workflows.execute | { version }. Makes it live: turns the workflow on, or switches the live version. |
POST /{workflowRef}/disable | workflows.execute | { cancelRunningRuns }, default false. |
POST /{workflowRef}/deprecate, /reinstate | workflows.delete | Retire and bring back (as Disabled). |
DELETE /{workflowRef} | workflows.delete | Deletes for good. |
Errors
| Code | Status | When |
|---|---|---|
WORKFLOW_VALIDATION_FAILED | 400 | Publishing or making live a definition with errors. The issues are in the body. |
INTEGRATION_NOT_FOUND | 400 | A step names an integration this workspace doesn't have. |
WORKFLOW_NOT_FOUND, WORKFLOW_VERSION_NOT_FOUND, WORKFLOW_DRAFT_NOT_FOUND | 404 | Not in this workspace, or deleted. |
WORKFLOW_DEPRECATED | 409 | Publishing, turning on or off a deprecated workflow. |
WORKFLOW_NOT_DEPRECATED | 409 | Reinstating one that isn't. |
WORKFLOW_DELETED | 409 | Publishing or drafting under a deleted workflow's ID. |
WORKFLOW_REF_TAKEN | 409 | The ID belongs to another workspace's workflow. |
WORKFLOW_DRAFT_CONFLICT | 409 | The draft was saved, discarded or published since you read it. |
WORKFLOW_DRAFT_OUTDATED | 409 | Another version was published since the draft started. Resend with force: true. |
WORKFLOW_DRAFT_LIMIT_REACHED | 409 | 50 drafts of new workflows already. |
WORKFLOW_LIMIT_REACHED | 409 | 100 workflows already. |
Rules worth knowing
- The version number is assigned by the database under a lock, so two publishes at once get consecutive numbers, never the same one.
- Making a version live replaces the workflow's trigger registrations and schedules, drops queued events for trigger nodes the version lacks, and points runs at it, all in one transaction. A version is checked against today's rules and integrations first, so an old version can be refused.
- A run is refused unless it is on the live version of an enabled workflow, so a trigger still cached for a moment after turning off starts nothing. Test runs are the exception.
- Older publish bodies with the definition nested under
definitionare still read, for one more release.