Update Automation
Update a draft or paused automation whose steps can be edited here.
Omit name or steps to leave that part as stored. Omit trigger to leave the stored trigger, including a contact_updated condition. Sending trigger replaces the stored trigger — the UUID the other types require, or conditions when type is contact_updated. Sending steps replaces the whole chain. Echo each step uuid from Get Automation, including a step inside an arm, to keep that step. Omit uuid, or send null, to add a step. Steps left out of the array are removed. An arm has no uuid.
On a paused automation, contacts waiting in a delay step are canceled when steps removes that delay step — its uuid is left out, or it is sent on a step that is no longer a timer. Canceled contacts do not resume when the automation is activated again. A delay step that keeps its uuid and stays a timer keeps its waiting contacts.
A kept send_email step takes every email field from the request, not only the fields you change. An omitted preheader, from_name, or reply_to is cleared, and an omitted name becomes the subject. Send each of them again to keep it.
Which automations can be updated is under Editing.
Request
PATCH /automations/{uuid}
Path Parameters
| Parameter | Type | Description |
|---|---|---|
uuid | string | Automation's UUID |
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | No | Automation name (max 255 characters). Must contain a non-whitespace character. |
trigger | object | No | Replaces the stored trigger. The UUID the other types require, or conditions when type is contact_updated. Omit it to leave the stored trigger. Same rules as Create Automation. |
steps | array | No | Replaces the whole chain. Same step rules as create. See Step Object. |
overwrite | boolean | No | Set true to replace a send-email body that reports content_overwrite_required. Defaults to false. Applies only when steps is present. See Email body. |
reentry_policy, timezone_mode, timezone_uuid, language, status, and structure are set on create or derived on read. Sending them returns 422 VALIDATION_ERROR.
A step uuid is matched regardless of letter case. A step uuid that is not on this automation returns 422 VALIDATION_ERROR on that step's uuid, with Step does not belong to this automation. A uuid sent on more than one step returns The uuid has already been used on another step.
Example Request
Replace the chain, keeping each existing step:
curl -X PATCH "https://email.easy.tools/api/v1/automations/2b34fffc-17ef-4062-8900-e4a62e3337c5" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"steps": [
{
"uuid": "867e6910-c507-4d0a-8037-222a68dc4b30",
"type": "timer",
"delay_value": 1,
"delay_unit": "hours"
},
{
"uuid": "15b5e475-0571-4fad-96b7-d1a37af4776e",
"type": "branch",
"branches": [
{
"condition_type": "audience_matches",
"segment_uuid": "26e7be80-cd42-4191-889d-fc9497a0568d",
"name": "Already bought",
"steps": [
{
"uuid": "a1ed6f10-1409-4d17-a75a-2c14d31c025a",
"type": "send_email",
"subject": "Welcome",
"content": "Hello",
"from_identity": "e050fca6-7eeb-45a1-b3e7-3a1ebff6e375"
}
]
},
{
"condition_type": "audience_not_matches",
"segment_uuid": "26e7be80-cd42-4191-889d-fc9497a0568d",
"steps": [
{
"uuid": "79f050b4-779b-4cc1-acc5-6d10234848d5",
"type": "send_email",
"subject": "An offer",
"content": "See this",
"from_identity": "e050fca6-7eeb-45a1-b3e7-3a1ebff6e375"
}
]
}
]
}
]
}'
Response
Success Response (200 OK)
The automation detail, identical in shape to Get Automation.
Response Fields
See Automation Object.
Error Responses
Not Found Error (404)
{
"error": {
"code": "RESOURCE_NOT_FOUND",
"message": "Automation with UUID '2b34fffc-17ef-4062-8900-e4a62e3337c5' not found"
}
}
Conflict Error (409 — Not Editable)
The automation is active.
{
"error": {
"code": "AUTOMATION_NOT_EDITABLE",
"message": "Automation is active and cannot be edited"
}
}
Conflict Error (409 — Steps Not Editable)
Returned when the automation's steps is null on read. See Editing.
{
"error": {
"code": "AUTOMATION_NOT_LINEAR",
"message": "This automation cannot be edited because its steps are not a linear chain"
}
}
Conflict Error (409 — Overwrite Required)
A replaced send-email body, including one inside an arm, reports content_overwrite_required and overwrite was not true. See Email body.
{
"error": {
"code": "CONTENT_OVERWRITE_REQUIRED",
"message": "This email body contains styling Markdown can't preserve; pass overwrite=true to replace it."
}
}
Validation Error (422 Unprocessable Entity)
Returned for the same field rules as Create Automation, and when a step uuid is not on this automation or is sent on more than one step.
{
"error": {
"code": "VALIDATION_ERROR",
"message": "The given data was invalid",
"details": {
"steps.0.uuid": ["Step does not belong to this automation"]
}
}
}