Automations
Create and manage Automations
Retrieve a list of automations
GET /automations
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
status | "enabled" | "disabled" | no | Filter automations by status. |
limit | integer | no | Number of items to return. |
after | string | no | Return items after this cursor. |
before | string | no | Return items before this cursor. |
Example
curl -X GET "$SESAMESEND_URL/automations" \
-H "Authorization: Bearer $OPENSEND_API_KEY"Responses
| Status | Description |
|---|---|
200 | OK |
{
"object": "list",
"has_more": true,
"data": [
{
"id": "string",
"name": "string",
"status": "enabled",
"created_at": "2023-10-06 23:47:56.678+00",
"updated_at": "2023-10-06 23:47:56.678+00"
}
]
}Create an automation
POST /automations
Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | The name of the automation. |
status | "enabled" | "disabled" | no | The initial status of the automation. Defaults to disabled. |
steps | object[] | yes | The steps that compose the automation workflow. Must include at least one trigger step. |
steps[].key | string | yes | A unique key for this step within the automation graph. |
steps[].type | "trigger" | "send_email" | "delay" | "wait_for_event" | "condition" | "contact_update" | "contact_delete" | "add_to_segment" | yes | The type of automation step. |
steps[].config | object | yes | 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 } |
connections | object[] | yes | The connections between steps in the automation graph. |
connections[].from | string | yes | The key of the source step. |
connections[].to | string | yes | The key of the target step. |
connections[].type | "default" | "condition_met" | "condition_not_met" | "timeout" | "event_received" | no | The type of connection. Defaults to default. |
Example
curl -X POST "$SESAMESEND_URL/automations" \
-H "Authorization: Bearer $OPENSEND_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "string",
"steps": [
{
"key": "string",
"type": "trigger",
"config": {}
}
],
"connections": [
{
"from": "string",
"to": "string"
}
]
}'Responses
| Status | Description |
|---|---|
201 | OK |
{
"object": "automation",
"id": "string"
}Retrieve a single automation
GET /automations/{automation_id}
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
automation_id | string | yes | The ID of the automation. |
Example
curl -X GET "$SESAMESEND_URL/automations/<automation_id>" \
-H "Authorization: Bearer $OPENSEND_API_KEY"Responses
| Status | Description |
|---|---|
200 | OK |
{
"object": "automation",
"id": "string",
"name": "string",
"status": "enabled",
"created_at": "2023-10-06 23:47:56.678+00",
"updated_at": "2023-10-06 23:47:56.678+00",
"steps": [
{
"key": "string",
"type": "trigger",
"config": {}
}
],
"connections": [
{
"from": "string",
"to": "string",
"type": "default"
}
]
}Update an automation
PATCH /automations/{automation_id}
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
automation_id | string | yes | The ID of the automation. |
Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | no | The name of the automation. |
status | "enabled" | "disabled" | no | The status of the automation. |
steps | object[] | no | The steps that compose the automation workflow. Must be provided together with connections. |
steps[].key | string | yes | A unique key for this step within the automation graph. |
steps[].type | "trigger" | "send_email" | "delay" | "wait_for_event" | "condition" | "contact_update" | "contact_delete" | "add_to_segment" | yes | The type of automation step. |
steps[].config | object | yes | 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 } |
connections | object[] | no | The connections between steps in the automation graph. Must be provided together with steps. |
connections[].from | string | yes | The key of the source step. |
connections[].to | string | yes | The key of the target step. |
connections[].type | "default" | "condition_met" | "condition_not_met" | "timeout" | "event_received" | no | The type of connection. Defaults to default. |
Example
curl -X PATCH "$SESAMESEND_URL/automations/<automation_id>" \
-H "Authorization: Bearer $OPENSEND_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'Responses
| Status | Description |
|---|---|
200 | OK |
{
"object": "automation",
"id": "string"
}Delete an automation
DELETE /automations/{automation_id}
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
automation_id | string | yes | The ID of the automation. |
Example
curl -X DELETE "$SESAMESEND_URL/automations/<automation_id>" \
-H "Authorization: Bearer $OPENSEND_API_KEY"Responses
| Status | Description |
|---|---|
200 | OK |
{
"object": "automation",
"id": "string",
"deleted": true
}Duplicate an automation
POST /automations/{automation_id}/duplicate
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
automation_id | string | yes | The ID of the automation. |
Example
curl -X POST "$SESAMESEND_URL/automations/<automation_id>/duplicate" \
-H "Authorization: Bearer $OPENSEND_API_KEY"Responses
| Status | Description |
|---|---|
201 | OK |
{
"object": "automation",
"id": "string"
}Stop an automation
POST /automations/{automation_id}/stop
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
automation_id | string | yes | The ID of the automation. |
Example
curl -X POST "$SESAMESEND_URL/automations/<automation_id>/stop" \
-H "Authorization: Bearer $OPENSEND_API_KEY"Responses
| Status | Description |
|---|---|
200 | OK |
{
"object": "automation",
"id": "string",
"status": "disabled"
}Retrieve a list of automation runs
GET /automations/{automation_id}/runs
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
automation_id | string | yes | The ID of the automation. |
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
status | string | no | Filter runs by status. Comma-separated list of: running, completed, failed, cancelled. |
limit | integer | no | Number of items to return. |
after | string | no | Return items after this cursor. |
before | string | no | Return items before this cursor. |
Example
curl -X GET "$SESAMESEND_URL/automations/<automation_id>/runs" \
-H "Authorization: Bearer $OPENSEND_API_KEY"Responses
| Status | Description |
|---|---|
200 | OK |
{
"object": "list",
"has_more": true,
"data": [
{
"id": "string",
"status": "running",
"started_at": "2023-10-06 23:47:56.678+00",
"completed_at": "2023-10-06 23:47:56.678+00",
"created_at": "2023-10-06 23:47:56.678+00"
}
]
}Retrieve a single automation run
GET /automations/{automation_id}/runs/{run_id}
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
automation_id | string | yes | The ID of the automation. |
run_id | string | yes | The ID of the automation run. |
Example
curl -X GET "$SESAMESEND_URL/automations/<automation_id>/runs/<run_id>" \
-H "Authorization: Bearer $OPENSEND_API_KEY"Responses
| Status | Description |
|---|---|
200 | OK |
{
"object": "automation_run",
"id": "string",
"status": "running",
"started_at": "2023-10-06 23:47:56.678+00",
"completed_at": "2023-10-06 23:47:56.678+00",
"created_at": "2023-10-06 23:47:56.678+00",
"steps": [
{
"key": "string",
"type": "trigger",
"status": "string",
"started_at": "2023-10-06 23:47:56.678+00",
"completed_at": "2023-10-06 23:47:56.678+00",
"output": null,
"error": null,
"created_at": "2023-10-06 23:47:56.678+00"
}
]
}