Workflows
Save workflow draft
Save a whole document over the latest draft, as the builder's Save does: the triggers of the new and changed steps (schedules, email, Gmail, queue consumers, sync triggers) are set up first, then the document is saved. A deployed latest version needs a new draft first (POST /workflows/<workflow_id>/drafts).
Authorization
AuthorizationstringheaderrequiredBearer <key>, where <key> is a workspace API key or a user API key. See Authentication.
workspace_id*integerThe workspace. List the ones your key can reach with GET /v1/workspaces.
workflow_id*stringThe workflow.
uuidregion*RegionsRegion of the resource: besg (Europe) or usnv (United States), as GET /v1/regions lists them
"besg""usnv"application/json- body
document*expected_version?|The draft version you read; refused with 409 when the draft is another one
nullexpected_last_modified_time?|The last_modified_time of the draft you read; refused with 409 when it changed
nullvalidate_only?Validate OnlyRun every check of the write and answer 204 without writing: a refused write answers the error the write would
falseOK
application/json- response
workflow_id*Workflow Idregion*Regions"besg""usnv"version*A version without its document; step_ids lists its steps (workflow_module_instance_id)
triggers*array<>curl -X PATCH 'https://api.stacksync.com/v1/workspaces/0/workflows/497f6eca-6276-4993-bfeb-53cbbbba6f08/draft?region=besg' \ -H 'Content-Type: application/json' \ -d '{ "document": { "edges": [ { "edge_id": "input-wait_5_seconds", "source": { "workflow_module_instance_id": "input" }, "target": { "workflow_module_instance_id": "wait_5_seconds" } } ], "modules": [ { "module_id": "system-input-1", "name": "Input", "properties": {}, "workflow_module_instance_id": "input" }, { "module_id": "system-wait-1", "name": "Wait 5 seconds", "properties": { "wait_for": 5 }, "workflow_module_instance_id": "wait_5_seconds" } ] }}'{ "workflow_id": "<workflow_id>", "region": "besg", "version": { "workflow_version": "<workflow_version>", "is_draft": false, "is_deployed": false, "last_modified_time": "<last_modified_time>", "step_ids": [ "<step_ids>" ] }, "triggers": [ { "step_id": "<step_id>", "status": "succeeded", "msg": "<msg>" } ]}POSTDuplicate workflow
Copy a version of a workflow into a new workflow (its first draft), in the same or another region, with its schedules.
PUTSave workflow draft step
Add one step to the latest draft or replace it, with the edges to add and remove, as the builder's node Save does: the step's trigger is set up, then the draft is saved. A draft saved since you read it is refused with 409, never overwritten.