Automations

Append automation steps

POST
/api/v1/automations/steps

Appends steps to an automation or a branch lane. Appending to a live automation is safe — in-flight contacts advance by stable step id, so they are never disturbed. Use after_position to insert, or parent_step_id + lane_key to target a branch lane.

Authorization

bearerAuth write
headerAuthorizationBearer <token>

An API key from the dashboard under Settings → API keys, sent as Authorization: Bearer aem_….

Authorization has two independent axes.

The scope is ranked — a key satisfies any requirement at or below its own tier:

  • read — see messages, contacts and metrics. Changes nothing, and cannot send.
  • write — everything read does, plus managing templates, contacts, automations, segments and suppressions. This is what editing a template needs.
  • admin — everything write does, plus sending configuration: domains, senders, webhook registration, kill switch, daily cap, brand.

There is no approve scope. It was a rung once; it is not one now, and a key requested with it is rejected.

The approval grant (can_approve) is a separate boolean, not a rung. Delivering mail to a real inbox needs write and the grant. Keeping them on separate axes is what makes the review gate a control rather than a convention: a key that may propose is not automatically a key that may approve its own proposal.

Give your application the lowest tier that works. Most need write and the grant — the dashboard mints that combination as Send + manage; Manage only is the same rung with the grant withheld.

Scope: write

Request Body

application/json
  1. body
automation*string

Automation id or name.

Length1 <= length
steps*array<|||||||>

Steps to append, in order.

Items1 <= items <= 100
after_position?integer

Insert after this position instead of appending. Requires a paused automation.

Range-9007199254740991 <= value <= 9007199254740991
parent_step_id?string

Append into a branch lane owned by this step.

Match^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Formatuuid
lane_key?string

Which lane of the parent branch — e.g. yes / no, or a multi-branch key.

Response Body

Steps appended.

application/json
  1. response
added?integer
total_steps?integer
Example Request
curl -X POST 'https://sendandretain.com/api/v1/automations/steps' \  -H 'Content-Type: application/json' \  -d '{  "automation": "Win back",  "steps": [    {      "type": "send",      "templateSlug": "win-back-3",      "delaySeconds": 0    }  ]}'
Example Response
{  "added": 1,  "total_steps": 4}