Update Automation
Rename an automation, replace its steps, enable it or disable it. Send only the fields you want to change.
Contacts enter an enabled automation through its trigger. For example, a custom_event trigger starts a run each time you send that event for a contact.
Endpoint
PATCH /automations/:id
Returns: 200 OK
Headers
| Header | Value | Required |
|---|---|---|
Authorization | Bearer <your-api-key> | Yes |
Content-Type | application/json | Yes |
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The automation ID |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | No | Automation name. Max 255 characters. |
status | string | No | enabled or disabled |
steps | array | No | The new steps, trigger included. Send it with connections. See Automation Steps. |
connections | array | No | Which step follows which. Send it with steps. |
Send at least one of name, status, or steps with connections.
steps and connections replace the whole graph: send every step, not only the ones that changed. Keep each step's key the same across updates. The key is how runs and results refer to the step.
Order and atomicity
One request applies its changes in this order: rename, disable, replace the steps, enable. They succeed or fail together. A refused request changes nothing, not even the name.
Enabling
status: "enabled" publishes the latest steps and starts letting in every contact who matches the trigger, so it sends messages. It is refused with automation_not_ready while the automation has issues.
Contacts already in the automation keep following the version they entered with. Only new entries follow the steps you just published.
Each contact that enters uses one of your plan's monthly automation runs. Once they are used up, new entries are skipped until the next period. The automation stays enabled, and contacts already in it finish. See Get Usage.
Disabling
status: "disabled" stops new entries. Runs in progress finish. Disabling a draft does nothing: it stays a draft.
Changing a live automation
The steps of an enabled automation cannot be replaced while it stays enabled. Such a request is refused with automation_enabled. To change a live automation:
- Send
status: "disabled"with the newstepsandconnections. The automation stops letting contacts in, and the new steps are saved. - Send
status: "enabled"to publish them and let contacts in again.
status takes one value per request, so these are two calls. Between them, no new contacts enter.
Response
The updated automation. See List Automations for the field reference.
{
"id": "01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a",
"name": "Welcome series",
"status": "enabled",
"created_at": "2026-03-08T12:00:00.000Z",
"updated_at": "2026-03-09T09:00:00.000Z",
"steps": [
{
"key": "trigger",
"type": "trigger",
"name": "Joined the newsletter",
"config": {
"event": "list_added",
"list_id": "01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f72",
"reentry": { "mode": "once" }
}
},
{
"key": "welcome_email",
"type": "send_email",
"name": "Welcome email",
"config": {
"template_id": "01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f70",
"from_domain": "mail.example.com",
"from_prefix": "hello",
"from_name": "Acme",
"subject": "Welcome to Acme, {{firstName|there}}"
}
}
],
"connections": [
{ "from": "trigger", "to": "welcome_email", "type": "default" }
],
"issues": []
}
Examples
Enable an automation:
- cURL
- JavaScript
- Python
- C#
- PHP
curl -X PATCH "https://api.arsel.sa/v1/automations/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a" \
-H "Authorization: Bearer $ARSEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"status": "enabled"
}'
const response = await fetch("https://api.arsel.sa/v1/automations/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a", {
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.ARSEL_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
status: "enabled",
}),
});
const data = await response.json();
if (!response.ok) {
throw new Error(`${data.name}: ${data.message}`);
}
console.log(data);
import os
import requests
response = requests.patch(
"https://api.arsel.sa/v1/automations/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a",
headers={"Authorization": f"Bearer {os.environ['ARSEL_API_KEY']}"},
json={
"status": "enabled",
},
)
response.raise_for_status()
print(response.json())
using System.Net.Http.Headers;
using System.Text;
var client = new HttpClient(); // share one instance across requests
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
"Bearer", Environment.GetEnvironmentVariable("ARSEL_API_KEY"));
var request = new HttpRequestMessage(HttpMethod.Patch, "https://api.arsel.sa/v1/automations/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a")
{
Content = new StringContent(
"""
{
"status": "enabled"
}
""",
Encoding.UTF8,
"application/json"),
};
var response = await client.SendAsync(request);
var body = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
throw new HttpRequestException($"{(int)response.StatusCode}: {body}");
Console.WriteLine(body);
<?php
$ch = curl_init("https://api.arsel.sa/v1/automations/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("ARSEL_API_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"status" => "enabled",
]),
]);
$data = json_decode(curl_exec($ch), true);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) >= 400) {
throw new Exception("{$data['name']}: {$data['message']}");
}
print_r($data);
Rename only:
- cURL
- JavaScript
- Python
- C#
- PHP
curl -X PATCH "https://api.arsel.sa/v1/automations/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a" \
-H "Authorization: Bearer $ARSEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Welcome series (2026)"
}'
const response = await fetch("https://api.arsel.sa/v1/automations/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a", {
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.ARSEL_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Welcome series (2026)",
}),
});
const data = await response.json();
if (!response.ok) {
throw new Error(`${data.name}: ${data.message}`);
}
console.log(data);
import os
import requests
response = requests.patch(
"https://api.arsel.sa/v1/automations/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a",
headers={"Authorization": f"Bearer {os.environ['ARSEL_API_KEY']}"},
json={
"name": "Welcome series (2026)",
},
)
response.raise_for_status()
print(response.json())
using System.Net.Http.Headers;
using System.Text;
var client = new HttpClient(); // share one instance across requests
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
"Bearer", Environment.GetEnvironmentVariable("ARSEL_API_KEY"));
var request = new HttpRequestMessage(HttpMethod.Patch, "https://api.arsel.sa/v1/automations/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a")
{
Content = new StringContent(
"""
{
"name": "Welcome series (2026)"
}
""",
Encoding.UTF8,
"application/json"),
};
var response = await client.SendAsync(request);
var body = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
throw new HttpRequestException($"{(int)response.StatusCode}: {body}");
Console.WriteLine(body);
<?php
$ch = curl_init("https://api.arsel.sa/v1/automations/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("ARSEL_API_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"name" => "Welcome series (2026)",
]),
]);
$data = json_decode(curl_exec($ch), true);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) >= 400) {
throw new Exception("{$data['name']}: {$data['message']}");
}
print_r($data);
Change a live automation
Read the automation, change its steps, disable it while saving them, then enable it again.
async function arsel(path, { method = "GET", body } = {}) {
const response = await fetch(`https://api.arsel.sa/v1${path}`, {
method,
headers: {
Authorization: `Bearer ${process.env.ARSEL_API_KEY}`,
"Content-Type": "application/json",
},
body: body && JSON.stringify(body),
});
const data = await response.json();
if (!response.ok) throw new Error(`${data.name}: ${data.message}`);
return data;
}
const id = "01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a";
const { steps, connections } = await arsel(`/automations/${id}`);
const delay = steps.find((step) => step.key === "wait_2_days");
delay.config.duration = { value: 3, unit: "days" };
const saved = await arsel(`/automations/${id}`, {
method: "PATCH",
body: { status: "disabled", steps, connections },
});
if (saved.issues.length > 0) throw new Error(JSON.stringify(saved.issues));
await arsel(`/automations/${id}`, {
method: "PATCH",
body: { status: "enabled" },
});
Error Responses
- 422 Automation Enabled
- 422 Not Ready
- 422 Graph Invalid
- 422 Validation Error
- 403 Forbidden
- 404 Not Found
- 401 Unauthorized
{
"status_code": 422,
"name": "automation_enabled",
"message": "The steps of an enabled automation cannot be replaced. Disable it in the same request or first."
}
Each issue is listed as step_key.path: message.
{
"status_code": 422,
"name": "automation_not_ready",
"message": "Finish every step before enabling this automation. welcome_email.template_id: This email template no longer exists"
}
{
"status_code": 422,
"name": "automation_graph_invalid",
"message": "This automation cannot be saved as drawn. automation: A step cannot lead back to an earlier step"
}
{
"status_code": 422,
"name": "validation_error",
"message": "Send at least one of name, status, or steps with connections"
}
{
"status_code": 403,
"name": "forbidden",
"message": "Automations are not available for this organization"
}
{
"status_code": 404,
"name": "not_found",
"message": "Automation not found"
}
{
"status_code": 401,
"name": "unauthorized",
"message": "Invalid API Key"
}