Update an automation draft

Update an automation draft

PATCH/api/v1/automations/{id}

PATCH /automations/{id}
curl -X PATCH 'https://www.unitpost.com/api/v1/automations/atm_123' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{
    "policy": {
      "reEntry": "once_per_interval",
      "reEntryInterval": "P7D",
      "maxConcurrentRunsPerSubject": 1,
      "goal": {
        "eventType": "order.completed",
        "window": "P2D"
      },
      "maxSendsPerSubjectPerDay": 1
    }
  }'
Response · 200
{
  "object": "automation",
  "id": "id_123",
  "name": "Example",
  "description": "string",
  "status": "draft",
  "pause_reason": "user",
  "published_version": 0,
  "has_draft_changes": false,
  "trigger": {
    "kind": "string",
    "config": {}
  },
  "active_runs": 0,
  "total_runs": 1,
  "failed_runs_30d": 0,
  "last_run_at": "2026-01-01T00:00:00.000Z",
  "archived_at": "2026-01-01T00:00:00.000Z",
  "delete_after": "string",
  "created_at": "2026-01-01T00:00:00.000Z",
  "updated_at": "2026-01-01T00:00:00.000Z",
  "heads_up": [
    {
      "code": "sender_not_an_address",
      "node_id": "node_123",
      "field": "string",
      "resource_type": "template",
      "value": "string",
      "message": "string"
    }
  ],
  "warnings": [
    "string"
  ],
  "generated_secrets": [
    {
      "node_id": "node_123",
      "secret": "string"
    }
  ]
}

Edit the name, description, DRAFT definition, or policy. Edits never change status or affect in-flight runs — publish to make them live. Validate first with Validate. definition and policy each replace the stored value whole: read the automation first and send it back changed. A policy field left out goes back to its default, so a goal or re-entry you don't resend is dropped; leave policy out to keep it. Keep a block's id when you change its settings: on a live automation a new id is a removed block for the people waiting on it. An omitted reEntry goes back to the trigger's default. A draft saves even when it doesn't validate yet; check it with Validate before publishing. Omit layout: the dashboard keeps its arrangement and places new blocks. heads_up[] lists values that couldn't be checked in this workspace. They are kept: publish refuses the ones that can't send (a sender, template, segment, topic or number) until they're fixed, and a new contact-field key is only a warning. Codes: sender_not_an_address (publish refuses it), sender_domain_not_found (publish refuses it), sender_domain_unverified (publish refuses it), resource_not_found (publish refuses it), sms_sender_inactive (publish refuses it), contact_field_not_found (a warning). Requires the automations:write capability.

Parameters1 field
FieldTypeDescription
idrequiredstring · path—
Request body4 fields
FieldTypeDescription
namestring—
descriptionstring | null—
definitionobject—
policyobject—
Response · 200 fields20 fields
FieldTypeDescription
objectrequiredstring—
idrequiredstring—
namerequiredstring—
descriptionrequiredstring | null—
statusrequiredenumdraft | active | paused | archived—
pause_reasonrequiredenum | null—
published_versionrequiredinteger | null—
has_draft_changesrequiredboolean—
triggerrequiredobject | null—
active_runsrequiredinteger—
total_runsrequiredinteger—
failed_runs_30drequiredinteger—
last_run_atrequiredstring | null—
archived_atrequiredstring | nullWhen it was archived; null unless `status` is `"archived"`.
delete_afterrequiredstring | nullWhen an archived automation is deleted for good unless it is unarchived first (archive time plus the retention period, 30 days by default); null unless `status` is `"archived"`.
created_atrequiredstring—
updated_atrequiredstring—
heads_upobject[]On create and update: values in the saved draft that couldn't be verified here (an invented template id, a sender on a domain that isn't verified). They're kept; publish refuses them until fixed.
warningsstring[]Update only: what this edit changed that you didn't write, in plain words. Today one case: with `maxConcurrentRunsPerSubject` left out, a custom-event journey's runs per person at once follows its graph, so an edit that adds or removes a match on the event's own data (`{{event.data.<key>}}` in a Wait for event, the goal or the exit rule, or a Wait until on an event date), or a policy sent without the field, moves it (1 or 10). The sentence names the old and new value, why, and how to keep the old one. Absent when nothing did. Tell the user.
generated_secretsobject[]On create and update, when this write generated a Call webhook block's signing secret (a new block whose `secret` was left out, or `"generate"`): the secret, this once. Reads only ever show a placeholder.
200401403404409422

Search docs and guides

Search the docs and product guides.