API reference
Automations
Create and manage event-driven workflows: a trigger plus an ordered graph of steps.
An automation is a trigger and a list of steps that form a forward-only graph. New automations start as draft; set them live to run.
The automation object#
json
{
"id": "auto_9k8j7h",
"name": "Welcome series",
"status": "live",
"trigger": { "event": "contact.subscribed" },
"steps": [
{ "id": "step-0", "type": "email", "detail": "Welcome",
"templateId": "tmpl_123", "next": "step-1" },
{ "id": "step-1", "type": "delay", "delayMinutes": 1440, "next": null }
],
"step_count": 2,
"created_at": "2026-07-10T10:30:00.000Z",
"updated_at": "2026-07-10T10:30:00.000Z"
}Triggers#
A trigger is one of:
json
{ "event": "contact.subscribed" }
{ "event": "event", "name": "order.completed" }Step types#
| type | Key fields | What it does |
|---|---|---|
email | templateId, subjectOverride? | Sends a template to the enrolled contact. |
delay | delayMinutes (1–525600) | Waits a fixed amount of time. |
wait | waitEvent, waitTimeoutMinutes (1–36000) | Pauses until an event arrives or the timeout elapses. |
branch | branchCondition, nextTrue, nextFalse | Two-way if/else on a field, operator, and value. |
action | action, actionKey?, actionValue?, tag? | unsubscribe, update-field, add-tag, or remove-tag. |
Every step has an id (unique) and an optional next pointer. Omit next to fall through to the following step; set it to null to end the run. Pointers must move forward — backward or dangling references are dropped.
List automations#
GET
/v1/automationsQuery parameters
limitintegerOptionalItems per page. Default
50, max 100.cursorstringOptionalPagination cursor.
status"draft" | "live"OptionalFilter by status.
ts
const { data } = await deckle.automations.list({ status: "live" });Create an automation#
POST
/v1/automationsBody parameters
namestringRequiredName, up to 120 characters.
triggerobjectOptionalTrigger config. Defaults to
{ "event": "contact.subscribed" }.stepsobject[]OptionalOrdered steps. Ids must be unique; missing ids are generated.
const automation = await deckle.automations.create({
name: "Welcome series",
trigger: { event: "contact.subscribed" },
steps: [
{ id: "step-0", type: "email", detail: "Welcome", templateId: "tmpl_123" },
{ id: "step-1", type: "delay", detail: "", delayMinutes: 1440 },
],
});Retrieve an automation#
GET
/v1/automations/:idts
const automation = await deckle.automations.get("auto_9k8j7h");Update an automation#
PATCH
/v1/automations/:idUpdate name, trigger, steps, or status.
ts
// Turn it on — resumes any paused enrollments.
await deckle.automations.update("auto_9k8j7h", { status: "live" });Going live
Settingstatus to live resumes paused enrollments. An invalid status or duplicate step ids return 422.Delete an automation#
DELETE
/v1/automations/:idawait deckle.automations.delete("auto_9k8j7h");