Preview an enrollment

Preview an enrollment

POST/api/v1/automations/{id}/runs/preview

POST /automations/{id}/runs/preview
curl -X POST 'https://www.unitpost.com/api/v1/automations/atm_123/runs/preview' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{
    "email": "sam@acme.com"
  }'
Response · 200
{
  "object": "automation_enrollment_preview",
  "automation_id": "automation_123",
  "would_enroll": false,
  "blocked_by": "automation_live",
  "contact": {
    "id": "id_123",
    "email": "customer@example.com"
  },
  "checks": [
    {
      "code": "automation_live",
      "passed": false,
      "message": "string"
    }
  ]
}

Would enrolling this contact (contact_id or email, as the enroll takes) start a run now, and if not, which check stops it: the automation isn't live, its trigger isn't manual enrollment, no such contact, a run already in progress, re-entry, every message would be skipped for them by consent (no_consent), the hourly run rate, or the automation's or the workspace's live-run ceiling. Nothing is written. Read it before enrolling: the enroll is accepted asynchronously and may still be declined. Also needs contacts:read. Requires the automations:read capability.

Parameters1 field
FieldTypeDescription
idrequiredstring · path—
Request body2 fields
FieldTypeDescription
contact_idstringThe contact (`con_…`).
emailstringOr the contact's email address.
Response · 200 fields6 fields
FieldTypeDescription
objectrequiredstring—
automation_idrequiredstring—
would_enrollrequiredbooleanEnrolling this contact now would start a run. Advisory: the engine checks again when it enrolls.
blocked_byrequiredenum | nullThe first check that stops it, or null.
contactrequiredobject | null—
checksrequiredobject[]In enrollment's order: `automation_live`, `manual_trigger`, `contact_found`, then (once those pass) the policy gates `run_in_progress`, `re_entry`, `no_consent` (every message it could send would be skipped for them by consent: no run, nothing billed), `run_rate`, `max_active_runs`, `workspace_live_runs`.
200401403404422

Search docs and guides

Search the docs and product guides.