Skip to main content

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​

HeaderValueRequired
AuthorizationBearer <your-api-key>Yes
Content-Typeapplication/jsonYes

Path Parameters​

ParameterTypeDescription
idstringThe automation ID

Body Parameters​

ParameterTypeRequiredDescription
namestringNoAutomation name. Max 255 characters.
statusstringNoenabled or disabled
stepsarrayNoThe new steps, trigger included. Send it with connections. See Automation Steps.
connectionsarrayNoWhich 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:

  1. Send status: "disabled" with the new steps and connections. The automation stops letting contacts in, and the new steps are saved.
  2. 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 -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"
}'

Rename only:

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)"
}'

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​

{
"status_code": 422,
"name": "automation_enabled",
"message": "The steps of an enabled automation cannot be replaced. Disable it in the same request or first."
}