Skip to content

Automations

Automations are created and configured in the TopMail dashboard. The API provides programmatic control over activation, triggering, and monitoring.

GET
/automations

List all automations with optional status filtering.

Query Parameters

NameTypeRequiredDescription
statusstringOptionalFilter by status: "draft", "active", or "paused".
limitintegerOptionalNumber of automations to return (default: 100, max: 1000).
offsetintegerOptionalNumber of automations to skip for pagination (default: 0).
curl "https://api.topmail.so/api/v1/automations?status=active&limit=10" \
-H "Authorization: Bearer tm_live_abc123"
GET
/automations/:id

Retrieve a single automation with steps and run count.

curl https://api.topmail.so/api/v1/automations/AUTOMATION_ID \
-H "Authorization: Bearer tm_live_abc123"
PATCH
/automations/:id

Update an automation name or status.

Request Body

NameTypeRequiredDescription
namestringOptionalUpdated automation name.
statusstringOptionalSet to "active" or "paused". See status lifecycle below.

Status Lifecycle

Automations follow a strict status lifecycle: draftactive (requires at least one step). Active automations can be toggled: activepaused.

curl -X PATCH https://api.topmail.so/api/v1/automations/AUTOMATION_ID \
-H "Authorization: Bearer tm_live_abc123" \
-H "Content-Type: application/json" \
-d '{"status": "paused"}'
POST
/automations/:id/trigger

Manually trigger an automation for a specific contact.

Request Body

NameTypeRequiredDescription
contact_idstring (UUID)OptionalContact ID to trigger for. Provide either contact_id or email.
emailstringOptionalContact email to trigger for. Provide either contact_id or email.
trigger_dataobjectOptionalAdditional data to pass to the automation run.
curl -X POST https://api.topmail.so/api/v1/automations/AUTOMATION_ID/trigger \
-H "Authorization: Bearer tm_live_abc123" \
-H "Content-Type: application/json" \
-d '{
"contact_id": "c1a2b3c4-d5e6-7890-abcd-ef1234567890",
"trigger_data": {"source": "api", "plan": "pro"}
}'

Trigger Types

Automations support the following trigger types. The API trigger endpoint works with any automation regardless of its configured trigger type.

TypeDescription
signupContact signs up or is created
tag_addedTag is assigned to a contact
added_to_listContact is added to a list
email_openContact opens an email
email_clickContact clicks a link in an email
product_viewedContact views a product (tracking)
purchaseContact completes a purchase
customCustom event triggered via API
GET
/automations/:id/runs

List runs for an automation with optional status filtering.

Query Parameters

NameTypeRequiredDescription
statusstringOptionalFilter by run status: "running", "completed", or "failed".
limitintegerOptionalNumber of runs to return (default: 100, max: 1000).
offsetintegerOptionalNumber of runs to skip for pagination (default: 0).
curl "https://api.topmail.so/api/v1/automations/AUTOMATION_ID/runs?status=completed&limit=20" \
-H "Authorization: Bearer tm_live_abc123"
Developer Docs - TopMail