Skip to main content
Resend Docs

Search documentation

Type to search this documentation.

Create an automation

POST/automationsCreate an automation

Request body

application/json
objectCreateAutomationRequest
connectionsarray of objectrequired

The connections between steps in the automation graph.

Show child attributes
Show array items

A connection between two steps in the automation graph.

fromstringrequired

The `key` of the source step.

tostringrequired

The `key` of the target step.

typestring

The type of connection. Defaults to `default`.

one of "default", "condition_met", "condition_not_met", "timeout", "event_received" · default "default"

namestringrequired

The name of the automation.

minLength 1

statusstring

The initial status of the automation. Defaults to `disabled`.

one of "enabled", "disabled" · default "disabled"

stepsarray of objectrequired

The steps that compose the automation workflow. Must include at least one `trigger` step.

maxItems 150 · minItems 1

Show child attributes

maxItems 150 · minItems 1

Show array items

A step in an automation workflow. The `config` object varies based on the step `type`.

configobjectrequired

Configuration for the step. Shape depends on `type`: - **trigger**: `{ event_name: string }` - **send_email**: `{ template: { id: string, variables?: object }, subject?: string, from?: string, reply_to?: string }` - **delay**: `{ duration: string }` — a human-readable duration (e.g. `"30 minutes"`) - **wait_for_event**: `{ event_name: string, timeout?: string, filter_rule?: object }` — `timeout` is a human-readable duration (e.g. `"1 hour"`) - **condition**: A rule tree with `type` (`rule`, `and`, `or`), `field`, `operator`, and `value` - **contact_update**: `{ first_name?: string|object, last_name?: string|object, unsubscribed?: boolean|object, properties?: object }` - **contact_delete**: `{}` - **add_to_segment**: `{ segment_id: string }`

keystringrequired

A unique key for this step within the automation graph.

typestringrequired

The type of automation step.

one of "trigger", "send_email", "delay", "wait_for_event", "condition", "contact_update", "contact_delete", "add_to_segment"

Example request
{
  "connections": [
    {
      "from": "string",
      "to": "string",
      "type": "default"
    }
  ],
  "name": "string",
  "status": "disabled",
  "steps": [
    {
      "config": {},
      "key": "string",
      "type": "add_to_segment"
    }
  ]
}

Responses

201OKapplication/json
objectCreateAutomationResponse
idstring

The ID of the created automation.

objectstring

Type of the response object.

Example response
{
  "id": "string",
  "object": "automation"
}
Documentation menu