See Stacksync in action with a solution architect. Book a demo ↗
Workflows

Workflows

Save workflow draft

PATCH
/v1/workspaces/{workspace_id}/workflows/{workflow_id}/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

Authorizationstringheaderrequired

Bearer <key>, where <key> is a workspace API key or a user API key. See Authentication.

Path Parameters

workspace_id*integer

The workspace. List the ones your key can reach with GET /v1/workspaces.

workflow_id*string

The workflow.

Formatuuid

Query Parameters

region*Regions

Region of the resource: besg (Europe) or usnv (United States), as GET /v1/regions lists them

Value in"besg""usnv"

Request Body

application/json
  1. body
document*
expected_version?|

The draft version you read; refused with 409 when the draft is another one

Defaultnull
expected_last_modified_time?|

The last_modified_time of the draft you read; refused with 409 when it changed

Defaultnull
validate_only?Validate Only

Run every check of the write and answer 204 without writing: a refused write answers the error the write would

Defaultfalse

Response Body

OK

application/json
  1. response
workflow_id*Workflow Id
region*Regions
Value in"besg""usnv"
version*

A version without its document; step_ids lists its steps (workflow_module_instance_id)

triggers*array<>
Save workflow draft
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>"    }  ]}