Dry-run an automation

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
FieldTypeDescription
idrequiredstring · path—
Request body7 fields
FieldTypeDescription
emailstringA real contact by email (also needs `contacts:read`).
contact_idstringA real contact by id (also needs `contacts:read`).
contactobjectOr a made-up contact: its fields (`first_name`, `plan`, …).
phonestringA made-up contact's phone number.
sms_consentbooleanA made-up contact's SMS marketing consent.
event_dataobjectThe trigger event's payload, read as event.data.*.
versionenumdraft | live`draft` (default) or the `live` version.
Response · 200 fields10 fields
FieldTypeDescription
objectrequiredstring—
automation_idrequiredstring—
versionrequiredenumdraft | live—
subjectrequiredstringWho was walked: the contact, or "a test contact".
sentrequiredbooleanA dry run never sends.
entersrequiredboolean—
reasonrequiredstring | nullWhy it wouldn't enter, when `enters` is false.
pathsrequiredobject[]One path per wait-for-event outcome (the event arrives / times out).
summaryrequiredstring—
not_simulatedrequiredstring—
200400401403404409422

Search docs and guides

Search the docs and product guides.