Start

An automation is a journey that runs on its own. A trigger starts a run for one contact (your backend sends cart.updated, a contact joins a segment, an email arrives), and blocks send, wait, branch and update the contact until the run reaches an exit. An automation's id starts with atm_ and a run's with run_.

Every step is one REST call with an API key. Drafts need automations:write, publishing automations:publish, sending events events:emit. A draft never sends anything; publishing can. MCP and Unit have every operation. The SDKs and the CLI got automations and events methods in the automations release; if yours is older, update it. A Sending key created before launch can't send events: create a new one.

1. Create a draft from a blueprint

A blueprint builds a common journey from a few params. abandoned-cart: Nudges when the order never completes (24h after the last cart update, with the latest cart). Needs a backend cart.updated event + an order.completed event. GET /v1/automations/blueprints lists every blueprint; to send your own graph, pass definition instead (Automation examples).

cURL
curl -X POST 'https://www.unitpost.com/api/v1/automations' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Abandoned cart",
    "blueprint": "abandoned-cart",
    "blueprint_params": {
      "from": "Acme <hello@mail.acme.com>",
      "template_reminder": "tmpl_cart_reminder"
    }
  }'

The answer is the draft (atm_…) and its heads_up[]. 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.

heads_up codePublishMeaning
sender_not_an_addressRefused until fixedThe sender isn't a full email address.
sender_domain_not_foundRefused until fixedThe sender's domain isn't a domain of this workspace.
sender_domain_unverifiedRefused until fixedThe sender's domain isn't verified yet.
resource_not_foundRefused until fixedNo such template, segment, topic, campaign or SMS number in this workspace.
sms_sender_inactiveRefused until fixedThe SMS number isn't active yet.
contact_field_not_foundAllowedA contact update names a field that doesn't exist; the step would add it as a new custom value.

2. Validate until ok

cURL
curl -X POST 'https://www.unitpost.com/api/v1/automations/atm_123/validate' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{}'

Fix every error by its node_id and path and validate again; then read readiness. Codes and readiness: Test and publish an automation.

3. Dry-run it

cURL
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"
    }
  }'

4. Publish

cURL
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"
  }'

5. Send the event

cURL
curl -X POST 'https://www.unitpost.com/api/v1/events' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "cart.updated",
    "email": "sam@acme.com",
    "data": {
      "cart_url": "https://shop.acme.com/cart/123",
      "item_count": 2
    },
    "idempotency_key": "cart-123-v4"
  }'

6. Read the runs

cURL
curl -X GET 'https://www.unitpost.com/api/v1/automations/atm_123/runs' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0'

Change it later with PATCH /v1/automations/{id}: definition and policy each replace the stored one whole, so read it first. Every operation is below, and in the OpenAPI spec.

Go deeper

The guides explain the rest: How automations work, Build with AI, Examples, Triggers, Blocks, Data and variables, Safety and limits, Testing and going live, Runs and debugging, Events and webhooks, Billing.

Search docs and guides

Search the docs and product guides.