Create Automation
Create an automation: a trigger, and the steps a contact goes through after it. Contacts enter through the trigger. For example, a custom_event trigger starts a run each time you send that event for a contact.
Send steps and connections to build the automation here, or leave them out to create an empty draft and build it in the Arsel Dashboard. The format of both is described in Automation Steps.
The automation is created as a draft, which lets no contacts in. A draft may be unfinished: its issues list what is left before it can be enabled. Enable it with Update Automation, or send status: "enabled" to enable it in the same call.
Endpoint
POST /automations
Returns: 201 Created
Headers
| Header | Value | Required |
|---|---|---|
Authorization | Bearer <your-api-key> | Yes |
Content-Type | application/json | Yes |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Automation name. Max 255 characters. |
status | string | No | enabled to enable the automation as it is created. Left out, it is a draft. |
steps | array | No | The steps, trigger included. Send it with connections. See Automation Steps. |
connections | array | No | Which step follows which. Send it with steps. |
Steps that break a structural rule, such as a missing trigger, a connection to an unknown step or a loop, are refused with automation_graph_invalid. Nothing is created. See Rules.
Enabling on create
With status: "enabled", the automation is created and enabled in one step. It starts letting in contacts who match the trigger, so it sends messages. If the automation has issues, the request is refused with automation_not_ready and nothing is created.
Each contact that enters uses one of your plan's monthly automation runs. See Get Usage.
Without steps
Without steps, the automation is an empty draft. Its issues say that a trigger is missing:
"issues": [
{ "step_key": null, "path": "", "message": "Choose what starts this automation" }
]
Response
The new automation, with its steps and issues. See List Automations for the field reference.
{
"id": "01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a",
"name": "Welcome series",
"status": "draft",
"created_at": "2026-03-08T12:00:00.000Z",
"updated_at": "2026-03-08T12: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}}"
}
},
{
"key": "wait_2_days",
"type": "delay",
"name": "Wait 2 days",
"config": { "duration": { "value": 2, "unit": "days" } }
},
{
"key": "tips_email",
"type": "send_email",
"name": "Getting started tips",
"config": {
"template_id": "01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f71",
"from_domain": "mail.example.com",
"from_prefix": "hello",
"from_name": "Acme"
}
}
],
"connections": [
{ "from": "trigger", "to": "welcome_email", "type": "default" },
{ "from": "welcome_email", "to": "wait_2_days", "type": "default" },
{ "from": "wait_2_days", "to": "tips_email", "type": "default" }
],
"issues": []
}
Examples
Create a welcome series as a draft:
- cURL
- JavaScript
- Python
- C#
- PHP
curl -X POST "https://api.arsel.sa/v1/automations" \
-H "Authorization: Bearer $ARSEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Welcome series",
"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}}"
}
},
{
"key": "wait_2_days",
"type": "delay",
"name": "Wait 2 days",
"config": {
"duration": {
"value": 2,
"unit": "days"
}
}
},
{
"key": "tips_email",
"type": "send_email",
"name": "Getting started tips",
"config": {
"template_id": "01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f71",
"from_domain": "mail.example.com",
"from_prefix": "hello",
"from_name": "Acme"
}
}
],
"connections": [
{
"from": "trigger",
"to": "welcome_email",
"type": "default"
},
{
"from": "welcome_email",
"to": "wait_2_days",
"type": "default"
},
{
"from": "wait_2_days",
"to": "tips_email",
"type": "default"
}
]
}'
const response = await fetch("https://api.arsel.sa/v1/automations", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ARSEL_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Welcome series",
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}}",
},
},
{
key: "wait_2_days",
type: "delay",
name: "Wait 2 days",
config: {
duration: {
value: 2,
unit: "days",
},
},
},
{
key: "tips_email",
type: "send_email",
name: "Getting started tips",
config: {
template_id: "01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f71",
from_domain: "mail.example.com",
from_prefix: "hello",
from_name: "Acme",
},
},
],
connections: [
{
from: "trigger",
to: "welcome_email",
type: "default",
},
{
from: "welcome_email",
to: "wait_2_days",
type: "default",
},
{
from: "wait_2_days",
to: "tips_email",
type: "default",
},
],
}),
});
const data = await response.json();
if (!response.ok) {
throw new Error(`${data.name}: ${data.message}`);
}
console.log(data);
import os
import requests
response = requests.post(
"https://api.arsel.sa/v1/automations",
headers={"Authorization": f"Bearer {os.environ['ARSEL_API_KEY']}"},
json={
"name": "Welcome series",
"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}}",
},
},
{
"key": "wait_2_days",
"type": "delay",
"name": "Wait 2 days",
"config": {
"duration": {
"value": 2,
"unit": "days",
},
},
},
{
"key": "tips_email",
"type": "send_email",
"name": "Getting started tips",
"config": {
"template_id": "01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f71",
"from_domain": "mail.example.com",
"from_prefix": "hello",
"from_name": "Acme",
},
},
],
"connections": [
{
"from": "trigger",
"to": "welcome_email",
"type": "default",
},
{
"from": "welcome_email",
"to": "wait_2_days",
"type": "default",
},
{
"from": "wait_2_days",
"to": "tips_email",
"type": "default",
},
],
},
)
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.Post, "https://api.arsel.sa/v1/automations")
{
Content = new StringContent(
"""
{
"name": "Welcome series",
"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}}"
}
},
{
"key": "wait_2_days",
"type": "delay",
"name": "Wait 2 days",
"config": {
"duration": {
"value": 2,
"unit": "days"
}
}
},
{
"key": "tips_email",
"type": "send_email",
"name": "Getting started tips",
"config": {
"template_id": "01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f71",
"from_domain": "mail.example.com",
"from_prefix": "hello",
"from_name": "Acme"
}
}
],
"connections": [
{
"from": "trigger",
"to": "welcome_email",
"type": "default"
},
{
"from": "welcome_email",
"to": "wait_2_days",
"type": "default"
},
{
"from": "wait_2_days",
"to": "tips_email",
"type": "default"
}
]
}
""",
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");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("ARSEL_API_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"name" => "Welcome series",
"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}}",
],
],
[
"key" => "wait_2_days",
"type" => "delay",
"name" => "Wait 2 days",
"config" => [
"duration" => [
"value" => 2,
"unit" => "days",
],
],
],
[
"key" => "tips_email",
"type" => "send_email",
"name" => "Getting started tips",
"config" => [
"template_id" => "01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f71",
"from_domain" => "mail.example.com",
"from_prefix" => "hello",
"from_name" => "Acme",
],
],
],
"connections" => [
[
"from" => "trigger",
"to" => "welcome_email",
"type" => "default",
],
[
"from" => "welcome_email",
"to" => "wait_2_days",
"type" => "default",
],
[
"from" => "wait_2_days",
"to" => "tips_email",
"type" => "default",
],
],
]),
]);
$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);
Create an empty draft, to build in the dashboard:
- cURL
- JavaScript
- Python
- C#
- PHP
curl -X POST "https://api.arsel.sa/v1/automations" \
-H "Authorization: Bearer $ARSEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Win-back"
}'
const response = await fetch("https://api.arsel.sa/v1/automations", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ARSEL_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Win-back",
}),
});
const data = await response.json();
if (!response.ok) {
throw new Error(`${data.name}: ${data.message}`);
}
console.log(data);
import os
import requests
response = requests.post(
"https://api.arsel.sa/v1/automations",
headers={"Authorization": f"Bearer {os.environ['ARSEL_API_KEY']}"},
json={
"name": "Win-back",
},
)
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.Post, "https://api.arsel.sa/v1/automations")
{
Content = new StringContent(
"""
{
"name": "Win-back"
}
""",
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");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("ARSEL_API_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"name" => "Win-back",
]),
]);
$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);
More complete graphs are in Automation Examples.
Error Responses
- 422 Graph Invalid
- 422 Not Ready
- 422 Validation Error
- 403 Forbidden
- 401 Unauthorized
{
"status_code": 422,
"name": "automation_graph_invalid",
"message": "This automation cannot be saved as drawn. trigger: A connection ends at \"nowhere\", which is not a step"
}
Sent with status: "enabled" while the automation has issues. Each one is listed as step_key.path: message.
{
"status_code": 422,
"name": "automation_not_ready",
"message": "Finish every step before enabling this automation. welcome_email.from_domain: \"mail.example.com\" is not a verified sender domain"
}
{
"status_code": 422,
"name": "validation_error",
"message": "Send steps and connections together"
}
{
"status_code": 403,
"name": "forbidden",
"message": "Automations are not available for this organization"
}
{
"status_code": 401,
"name": "unauthorized",
"message": "Invalid API Key"
}