Skip to Content
SendlySendly
API ReferenceWorkflows

Create a workflow

POST
/api/v1/workflows

Creates a workflow with its single trigger step. trigger_type defaults to EVENT, which requires event_name; SCHEDULE takes interval_ms and MANUAL is started only by POST /api/v1/workflows/{id}/executions.

Pass sequence to create the steps at the same time, as a LINEAR chain behind the trigger. Anything with a branch is PUT /api/v1/workflows/{id}/graph. Without a sequence the workflow holds only its trigger and stays inert until it has steps to run, which is why it is created disabled.

Requires the workflows:write scope — Create, edit, enable, and delete your automation workflows.

headerAuthorizationBearer <API Key>

API key authentication. Use a sk_* (FULL) or pk_* (SENDING_ONLY) key as the bearer token. Public keys (pk_*) are restricted to the email-send endpoints and the self-serve list subscribe/unsubscribe pair; every other endpoint — event tracking included — answers 403 for them. In scope terms (used by /api/v1/* operations): FULL keys hold every scope; SENDING_ONLY keys hold only emails:send.

application/json
  1. body

Body for POST /api/v1/workflows.

name*string
Length1 <= length <= 200
description?string
Lengthlength <= 1000
trigger_type?WorkflowTriggerTypeV1

What starts this workflow. Defaults to EVENT, which is the only kind the API created before this field existed. EVENT requires event_name; SCHEDULE uses interval_ms; MANUAL is started only by POST /api/v1/workflows/{id}/executions.

Value in"EVENT""MANUAL""SCHEDULE"
event_name?string

The custom event that starts this workflow, e.g. user.signup. Required for EVENT workflows (the default) and ignored for the other trigger types.

Length1 <= length <= 200
interval_ms?integer

For SCHEDULE workflows: how often the workflow fires, in milliseconds. Between one minute and 30 days; defaults to one hour.

Range60000 <= value <= 2592000000
enabled?boolean

Workflows are created disabled. A workflow can only be enabled once every step is configured.

allow_reentry?boolean
sequence?array<>

Optional LINEAR chain to create the workflow with, in run order. The trigger step is prepended and each step is wired to the next, so this cannot express branches — use PUT /api/v1/workflows/{id}/graph for those. Omit it to create a workflow that holds only its trigger step.

Items1 <= items <= 199

Response Body

Workflow created

application/json
  1. response

An automation workflow as exposed on the v1 API.

id*string
Formatuuid
name*string
description*string|null
enabled*boolean
trigger_type*string
Value in"EVENT""MANUAL""SCHEDULE"
event_name*|

Trigger event for EVENT workflows; null for the other trigger types.

allow_reentry*boolean
max_executions_per_hour*integer|null
version*integer

Incremented on every structural (step/transition) change.

step_count*integer

Steps in this workflow's graph, trigger step included — so a workflow that has only ever been created reports 1. Read /graph for the steps themselves.

created_at*string
Formatdate-time
updated_at*string
Formatdate-time
Example Request
curl -X POST 'https://api.sendly.now/api/v1/workflows' \  -H 'Content-Type: application/json' \  -d '{  "name": "string"}'
Example Response
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "name": "string",  "description": "string",  "enabled": true,  "trigger_type": "EVENT",  "event_name": "string",  "allow_reentry": true,  "max_executions_per_hour": 0,  "version": 0,  "step_count": 0,  "created_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z"}