Publish an automation

Publish an automation

POST/api/v1/automations/{id}/publish

POST /automations/{id}/publish
curl -X POST 'https://www.unitpost.com/api/v1/automations/atm_123/publish' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{
    "changelog": "First version"
  }'
Response · 200
{
  "object": "automation_publish",
  "automation_id": "automation_123",
  "version": 0,
  "status": "active",
  "runs": {
    "moved": 0,
    "moved_to_next": 0,
    "at_removed_blocks": 0,
    "ended": 0,
    "held": 0,
    "expired": 0,
    "pending": 0
  },
  "backfill": {
    "status": "started",
    "count": 1,
    "job": {
      "id": "id_123",
      "status": "queued",
      "total": 1,
      "processed": 0,
      "started": 0,
      "not_started": {},
      "error": "string"
    },
    "message": "string"
  }
}

Go live: snapshots the draft (graph + policy) into an immutable version and starts enrolling on the trigger. Everyone mid-journey moves to the new version at the block they're on (a wait already in progress keeps its end time). People on a block the new version removes move to the next block or end their run, as removed_blocks says; when anyone is on a removed block and removed_blocks is missing, the publish answers 409 listing them (read GET on this path first). Publishing a paused automation also continues the runs the pause held; a held message older than 7 days is not sent unless send_stale is true. runs in the response counts what happened. Send an Idempotency-Key to make retries return the same version. An automation whose trigger is a received email also needs emails:read: each run receives the email's text, which its blocks can pass on (403 insufficient_scope otherwise). A Call webhook block posts each run's contact email and trigger event to an outside URL, so publishing one also needs contacts:read and the trigger's own read capability (emails:read for any email trigger, segments:read, topics:read, …). An automation with an SMS step needs a plan that includes SMS (403 limit_reached with feature_not_in_plan on smsChannel otherwise). Requires the automations:publish capability.

Parameters2 fields
FieldTypeDescription
idrequiredstring · path—
Idempotency-Keystring · headerAny unique string (1–256 characters, e.g. a UUID). Retrying with the same key and the same body within 24 hours returns the first result instead of sending again; the same key with a different body is `409 invalid_idempotent_request`, and one still in flight is `409 concurrent_idempotent_requests`.
Request body4 fields
FieldTypeDescription
changelogstring—
removed_blocksenummove_to_next | endRuns on a block this version removes: move them to the next block (when it had one path) or end their run (default).
send_stalebooleanPublishing over a pause: also send held messages older than 7 days (default false).
backfill_countintegerA segment or topic trigger only: also start it for the people already in it, at most this many: the `backfill.count` from `GET …/publish?backfill=true` that the person confirmed. More would start now = 422 `backfill_count_changed` and nothing goes live; it can't run = 422/409 with `details[].code` `backfill_*`. Runs as a job: follow it with GET /jobs/{id}.
Response · 200 fields6 fields
FieldTypeDescription
objectrequiredstring—
automation_idrequiredstring—
versionrequiredinteger—
statusrequiredstring—
runsrequiredobject—
backfillobjectPresent when `backfill` was asked.
200401403404409422

Search docs and guides

Search the docs and product guides.