Automations
Multi-step sequences — send an email, wait, update the contact — started by a trigger or by enrolling contacts directly.
Create an automation
Creates a `draft` automation, optionally with its full step sequence in the same call. Step types: `send_email` (`template_id`, `sender_id` — a verified sender), `delay` (`duration_minutes`, 1–525600), `add_to_list` / `remove_from_list` (`list_id`), `update_property` (`key`, `value`) and `webhook` (`url`, a public HTTPS address). Triggers: `contact_created`, `contact_property_changed` (optional `trigger_config.property_key`), `added_to_list` (optional `trigger_config.list_id`), `manual` and `api`. Nothing runs until you activate it.
/automationsAuthorizations
Authorization API key for your workspace, scoped to automations:manage. Pass it as a Bearer token in the Authorization header.
Body · application/json
nametrigger_typestepscurl https://api.mailcraft.host/v1/automations \
-X POST \
-H 'Authorization: Bearer sk_live_...' \
-H 'Content-Type: application/json' \
-d '{
"name": "Welcome series",
"trigger_type": "added_to_list",
"trigger_config": { "list_id": 3 },
"steps": [
{ "type": "send_email", "config": { "template_id": 9, "sender_id": 4 } },
{ "type": "delay", "config": { "duration_minutes": 4320 } },
{ "type": "send_email", "config": { "template_id": 10, "sender_id": 4 } }
]
}'{
"data": {
"id": 12,
"name": "Welcome series",
"status": "draft",
"trigger_type": "added_to_list",
"trigger_config": { "list_id": 3 },
"steps": [
{ "id": 41, "position": 1, "type": "send_email", "config": { "template_id": 9, "sender_id": 4 } },
{ "id": 42, "position": 2, "type": "delay", "config": { "duration_minutes": 4320 } },
{ "id": 43, "position": 3, "type": "send_email", "config": { "template_id": 10, "sender_id": 4 } }
],
"enrollment_counts": { "active": 0, "waiting": 0, "completed": 0, "exited": 0, "failed": 0 },
"created_at": "2026-09-22T14:30:00.000000Z",
"updated_at": "2026-09-22T14:30:00.000000Z"
}
}List automations
/automationsAuthorizations
Authorization API key for your workspace, scoped to automations:manage. Pass it as a Bearer token in the Authorization header.
curl https://api.mailcraft.host/v1/automations \
-H 'Authorization: Bearer sk_live_...'{
"data": [
{
"id": 12,
"name": "Welcome series",
"status": "active",
"trigger_type": "added_to_list",
"trigger_config": { "list_id": 3 },
"created_at": "2026-09-22T14:30:00.000000Z",
"updated_at": "2026-09-22T14:41:00.000000Z"
}
]
}Retrieve an automation
Includes the ordered steps and how many contacts are in each enrollment state.
/automations/{automation}Authorizations
Authorization API key for your workspace, scoped to automations:manage. Pass it as a Bearer token in the Authorization header.
curl https://api.mailcraft.host/v1/automations/12 \
-H 'Authorization: Bearer sk_live_...'{
"data": {
"id": 12,
"name": "Welcome series",
"status": "active",
"trigger_type": "added_to_list",
"trigger_config": { "list_id": 3 },
"steps": [
{ "id": 41, "position": 1, "type": "send_email", "config": { "template_id": 9, "sender_id": 4 } }
],
"enrollment_counts": { "active": 2, "waiting": 118, "completed": 740, "exited": 3, "failed": 0 },
"created_at": "2026-09-22T14:30:00.000000Z",
"updated_at": "2026-09-22T14:41:00.000000Z"
}
}Update an automation
Rename it or change its trigger — only the fields you send change. Pause an active automation before changing its trigger.
/automations/{automation}Authorizations
Authorization API key for your workspace, scoped to automations:manage. Pass it as a Bearer token in the Authorization header.
Body · application/json
namecurl https://api.mailcraft.host/v1/automations/12 \
-X PATCH \
-H 'Authorization: Bearer sk_live_...' \
-H 'Content-Type: application/json' \
-d '{ "name": "Welcome series v2" }'{
"data": { "id": 12, "name": "Welcome series v2", "status": "draft", "...": "..." }
}Replace the steps
Replaces the whole sequence — send every step, in order; omitted steps are removed. Returns `422` while the automation is active (pause it first) or while contacts are partway through it (remove them first).
/automations/{automation}/stepsAuthorizations
Authorization API key for your workspace, scoped to automations:manage. Pass it as a Bearer token in the Authorization header.
Body · application/json
stepscurl https://api.mailcraft.host/v1/automations/12/steps \
-X PUT \
-H 'Authorization: Bearer sk_live_...' \
-H 'Content-Type: application/json' \
-d '{
"steps": [
{ "type": "send_email", "config": { "template_id": 9, "sender_id": 4 } },
{ "type": "update_property", "config": { "key": "onboarded", "value": true } }
]
}'{
"data": {
"id": 12,
"steps": [
{ "id": 44, "position": 1, "type": "send_email", "config": { "template_id": 9, "sender_id": 4 } },
{ "id": 45, "position": 2, "type": "update_property", "config": { "key": "onboarded", "value": true } }
],
"...": "..."
}
}Activate an automation
Starts enrolling contacts and running steps. Needs at least one step; the stored steps are re-validated first. Safe to repeat.
/automations/{automation}/activateAuthorizations
Authorization API key for your workspace, scoped to automations:manage. Pass it as a Bearer token in the Authorization header.
curl https://api.mailcraft.host/v1/automations/12/activate \
-X POST \
-H 'Authorization: Bearer sk_live_...'{
"data": { "id": 12, "status": "active", "...": "..." }
}Pause an automation
No new contacts enroll, and in-progress contacts wait where they are until it is activated again.
/automations/{automation}/pauseAuthorizations
Authorization API key for your workspace, scoped to automations:manage. Pass it as a Bearer token in the Authorization header.
curl https://api.mailcraft.host/v1/automations/12/pause \
-X POST \
-H 'Authorization: Bearer sk_live_...'{
"data": { "id": 12, "status": "paused", "...": "..." }
}Enroll a contact
Starts an existing contact — by `contact_id` or `email` — on an active `manual` or `api` automation; its first steps run immediately. Returns `409` if the contact is already partway through it.
/automations/{automation}/enrollmentsAuthorizations
Authorization API key for your workspace, scoped to automations:manage. Pass it as a Bearer token in the Authorization header.
Body · application/json
emailcurl https://api.mailcraft.host/v1/automations/12/enrollments \
-X POST \
-H 'Authorization: Bearer sk_live_...' \
-H 'Content-Type: application/json' \
-d '{ "email": "[email protected]" }'{
"data": {
"id": 5021,
"automation_id": 12,
"contact_id": "01J8Z6Q4M7X2K9R3T5V8W1Y4ZB",
"contact_email": "[email protected]",
"status": "waiting",
"current_step_id": 42,
"resume_at": "2026-09-25T14:31:00.000000Z",
"exited_reason": null,
"enrolled_at": "2026-09-22T14:31:00.000000Z",
"completed_at": null
}
}List enrollments
Newest first, cursor-paginated (`limit` up to 100). Filter with `status`: `active`, `waiting`, `completed`, `exited` or `failed`.
/automations/{automation}/enrollmentsAuthorizations
Authorization API key for your workspace, scoped to automations:manage. Pass it as a Bearer token in the Authorization header.
curl 'https://api.mailcraft.host/v1/automations/12/enrollments?status=waiting&limit=50' \
-H 'Authorization: Bearer sk_live_...'{
"data": [
{
"id": 5021,
"contact_email": "[email protected]",
"status": "waiting",
"resume_at": "2026-09-25T14:31:00.000000Z",
"...": "..."
}
],
"links": { "next": "https://api.mailcraft.host/v1/automations/12/enrollments?cursor=eyJpZCI6NTAyMH0" },
"meta": { "per_page": 50, "next_cursor": "eyJpZCI6NTAyMH0" }
}Remove in-progress contacts
Takes every active or waiting contact out of the automation; they get no further steps. Needed before replacing the steps of an automation that has run.
/automations/{automation}/enrollmentsAuthorizations
Authorization API key for your workspace, scoped to automations:manage. Pass it as a Bearer token in the Authorization header.
curl https://api.mailcraft.host/v1/automations/12/enrollments \
-X DELETE \
-H 'Authorization: Bearer sk_live_...'{
"data": { "exited": 120 }
}Delete an automation
In-progress contacts are taken out first, so nothing is left half-run.
/automations/{automation}Authorizations
Authorization API key for your workspace, scoped to automations:manage. Pass it as a Bearer token in the Authorization header.
curl https://api.mailcraft.host/v1/automations/12 \
-X DELETE \
-H 'Authorization: Bearer sk_live_...'(empty body)