DocsWorkflowsDrafts, publishing and versions

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.

For nowThe console keeps your draft in this browser, under your account, so it doesn't follow you to another computer and teammates don't see it. Shared drafts saved on the server are already in the API (below) and are coming to the console.

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

StateWhat starts itWhat you can do
EnabledIts triggers, on the live version.Everything. Publish, switch versions, turn it off.
DisabledNothing. Run by hand is refused.Edit, publish and test. Turn it on by making a version live.
DeprecatedNothing.Read it and its runs. Reinstate or delete it.
DeletedNothing, 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.

SettingWhat it does
Name, DescriptionShown in the explorer, in tabs and in run history.
Fail the run when a path failsOff (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 runThe 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_OUTDATED until 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.
In depth

Rules and API

Endpoints

Under /api/v1/workspaces/{workspaceRef}/workflows.

CallPermissionDoes
POST /workflows.createPublishes: { refId, name, description, nodes, edges, sharedVariableSchema, creditBudget, failFast, enable }. enable is required. Answers { refId, version, state, liveVersion }.
POST validateworkflows.createChecks without publishing. An invalid definition is a 200 with isValid: false and every issue's code, nodeId and field.
GET drafts, GET /{workflowRef}/draftworkflows.readServer drafts, with revision, baseVersion, outdated and the draft's validation.
PUT /{workflowRef}/draftworkflows.createSaves a draft with expectedRevision (null to start one).
POST /{workflowRef}/draft/publishworkflows.create{ revision, enable, force }. Publishes the draft and deletes it in one step.
DELETE /{workflowRef}/draft?revision=workflows.createDiscards it, only at that revision.
GET /{workflowRef}/versions, /versions/{n}workflows.readEvery version with isLive and run count; one version's definition, readable after deletion.
POST /{workflowRef}/enableworkflows.execute{ version }. Makes it live: turns the workflow on, or switches the live version.
POST /{workflowRef}/disableworkflows.execute{ cancelRunningRuns }, default false.
POST /{workflowRef}/deprecate, /reinstateworkflows.deleteRetire and bring back (as Disabled).
DELETE /{workflowRef}workflows.deleteDeletes for good.

Errors

CodeStatusWhen
WORKFLOW_VALIDATION_FAILED400Publishing or making live a definition with errors. The issues are in the body.
INTEGRATION_NOT_FOUND400A step names an integration this workspace doesn't have.
WORKFLOW_NOT_FOUND, WORKFLOW_VERSION_NOT_FOUND, WORKFLOW_DRAFT_NOT_FOUND404Not in this workspace, or deleted.
WORKFLOW_DEPRECATED409Publishing, turning on or off a deprecated workflow.
WORKFLOW_NOT_DEPRECATED409Reinstating one that isn't.
WORKFLOW_DELETED409Publishing or drafting under a deleted workflow's ID.
WORKFLOW_REF_TAKEN409The ID belongs to another workspace's workflow.
WORKFLOW_DRAFT_CONFLICT409The draft was saved, discarded or published since you read it.
WORKFLOW_DRAFT_OUTDATED409Another version was published since the draft started. Resend with force: true.
WORKFLOW_DRAFT_LIMIT_REACHED40950 drafts of new workflows already.
WORKFLOW_LIMIT_REACHED409100 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 definition are still read, for one more release.