Dry-run an automation
POST/api/v1/automations/{id}/simulate
POST /automations/{id}/simulate
curl -X POST 'https://www.unitpost.com/api/v1/automations/atm_123/simulate' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'User-Agent: my-app/1.0' \
-H 'Content-Type: application/json' \
-d '{
"email": "sam@acme.com",
"event_data": {
"cart_url": "https://shop.acme.com/cart/123"
}
}'Response · 200
{
"object": "automation_simulation",
"automation_id": "automation_123",
"version": "draft",
"subject": "Welcome to Acme",
"sent": false,
"enters": false,
"reason": "string",
"paths": [
{
"assumptions": [
"string"
],
"steps": [
{
"node_id": "node_123",
"title": "string",
"at": "string",
"outcome": "would_send",
"detail": "string"
}
],
"sends": 0,
"skips": 0
}
],
"summary": "string",
"not_simulated": "string"
}Walk the draft (or version: live) for one contact and say which messages they'd get, when, and which branches they'd take, as the builder's test does. Pass a real contact (email or contact_id, which also needs contacts:read) or a made-up one (contact fields), and event_data for a custom event's payload. Nothing is sent and nothing changes. Requires the automations:read capability.
Parameters1 field
| Field | Type | Description |
|---|---|---|
idrequired | string · path | — |
Request body7 fields
| Field | Type | Description |
|---|---|---|
email | string | A real contact by email (also needs `contacts:read`). |
contact_id | string | A real contact by id (also needs `contacts:read`). |
contact | object | Or a made-up contact: its fields (`first_name`, `plan`, …). |
phone | string | A made-up contact's phone number. |
sms_consent | boolean | A made-up contact's SMS marketing consent. |
event_data | object | The trigger event's payload, read as event.data.*. |
version | enumdraft | live | `draft` (default) or the `live` version. |
Response · 200 fields10 fields
| Field | Type | Description |
|---|---|---|
objectrequired | string | — |
automation_idrequired | string | — |
versionrequired | enumdraft | live | — |
subjectrequired | string | Who was walked: the contact, or "a test contact". |
sentrequired | boolean | A dry run never sends. |
entersrequired | boolean | — |
reasonrequired | string | null | Why it wouldn't enter, when `enters` is false. |
pathsrequired | object[] | One path per wait-for-event outcome (the event arrives / times out). |
summaryrequired | string | — |
not_simulatedrequired | string | — |
200400401403404409422