---
title: "Automations API quickstart"
description: "A draft from a blueprint, validated and published, then the event that starts it and the runs it makes."
url: https://www.unitpost.com/docs/automations/start
section: "Automations API reference"
updated: 2026-12-01
---
# Automations API quickstart

> A draft from a blueprint, validated and published, then the event that starts it and the runs it makes.

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 (/guides/automations-examples)).

**cURL**

```bash
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"
    }
  }'
```

**CLI**

```bash
unitpost automations create \
  --name 'Abandoned cart' \
  --blueprint abandoned-cart \
  --blueprint-params 'from=Acme <hello@mail.acme.com>' \
  --blueprint-params template_reminder=tmpl_cart_reminder
```

**Node.js**

```ts
import { Unitpost } from "unitpost";

const unitpost = new Unitpost(process.env.UNITPOST_API_KEY);

const { data, error } = await unitpost.automations.create({
  name: "Abandoned cart",
  blueprint: "abandoned-cart",
  blueprint_params: {
    from: "Acme <hello@mail.acme.com>",
    template_reminder: "tmpl_cart_reminder",
  },
});
```

**Python**

```python
from unitpost import Unitpost

unitpost = Unitpost()  # reads UNITPOST_API_KEY

result = unitpost.automations.create({
    "name": "Abandoned cart",
    "blueprint": "abandoned-cart",
    "blueprint_params": {
        "from": "Acme <hello@mail.acme.com>",
        "template_reminder": "tmpl_cart_reminder",
    },
})
```

**Ruby**

```ruby
require "unitpost"

unitpost = Unitpost::Client.new  # reads UNITPOST_API_KEY

result = unitpost.automations.create({
  name: "Abandoned cart",
  blueprint: "abandoned-cart",
  blueprint_params: {
    from: "Acme <hello@mail.acme.com>",
    template_reminder: "tmpl_cart_reminder",
  },
})
```

**PHP**

```php
require 'vendor/autoload.php';

use Unitpost\Client;

$unitpost = new Client(); // reads UNITPOST_API_KEY

$result = $unitpost->automations->create([
    "name" => "Abandoned cart",
    "blueprint" => "abandoned-cart",
    "blueprint_params" => [
        "from" => "Acme <hello@mail.acme.com>",
        "template_reminder" => "tmpl_cart_reminder",
    ],
]);
```

**Laravel**

```php
use Unitpost\Laravel\Facades\Unitpost;

$result = Unitpost::automations()->create([
    "name" => "Abandoned cart",
    "blueprint" => "abandoned-cart",
    "blueprint_params" => [
        "from" => "Acme <hello@mail.acme.com>",
        "template_reminder" => "tmpl_cart_reminder",
    ],
]);
```

**Go**

```go
import (
    "context"
    "github.com/unitpostcom/unitpost-go"
)

client := unitpost.New() // reads UNITPOST_API_KEY
ctx := context.Background()

data, err := client.Automations.Create(ctx, map[string]any{
	"name": "Abandoned cart",
	"blueprint": "abandoned-cart",
	"blueprint_params": map[string]any{
		"from": "Acme <hello@mail.acme.com>",
		"template_reminder": "tmpl_cart_reminder",
	},
})
```

**Java**

```java
import com.unitpost.Unitpost;

var unitpost = new Unitpost(); // reads UNITPOST_API_KEY

var result = unitpost.automations.create(java.util.Map.of(
    "name", "Abandoned cart",
    "blueprint", "abandoned-cart",
    "blueprint_params", java.util.Map.of(
        "from", "Acme <hello@mail.acme.com>",
        "template_reminder", "tmpl_cart_reminder"
    )
));
```

**Rust**

```rust
use unitpost::Unitpost;

let unitpost = Unitpost::new(); // reads UNITPOST_API_KEY

let result = unitpost.automations().create(serde_json::json!({"name":"Abandoned cart","blueprint":"abandoned-cart","blueprint_params":{"from":"Acme <hello@mail.acme.com>","template_reminder":"tmpl_cart_reminder"}})).await;
```

**.NET**

```csharp
using Unitpost;

var unitpost = new UnitpostClient(); // reads UNITPOST_API_KEY

var result = await unitpost.Automations.Create(new {
    name = "Abandoned cart",
    blueprint = "abandoned-cart",
    blueprint_params = new {
        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 code | Publish | Meaning |
| --- | --- | --- |
| `sender_not_an_address` | Refused until fixed | The sender isn't a full email address. |
| `sender_domain_not_found` | Refused until fixed | The sender's domain isn't a domain of this workspace. |
| `sender_domain_unverified` | Refused until fixed | The sender's domain isn't verified yet. |
| `resource_not_found` | Refused until fixed | No such template, segment, topic, campaign or SMS number in this workspace. |
| `sms_sender_inactive` | Refused until fixed | The SMS number isn't active yet. |
| `contact_field_not_found` | Allowed | A contact update names a field that doesn't exist; the step would add it as a new custom value. |

### 2. Validate until ok

**cURL**

```bash
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 '{}'
```

**CLI**

```bash
unitpost automations validate atm_123
```

**Node.js**

```ts
import { Unitpost } from "unitpost";

const unitpost = new Unitpost(process.env.UNITPOST_API_KEY);

const { data, error } = await unitpost.automations.validate("atm_123", {});
```

**Python**

```python
from unitpost import Unitpost

unitpost = Unitpost()  # reads UNITPOST_API_KEY

result = unitpost.automations.validate("atm_123", {})
```

**Ruby**

```ruby
require "unitpost"

unitpost = Unitpost::Client.new  # reads UNITPOST_API_KEY

result = unitpost.automations.validate("atm_123", {})
```

**PHP**

```php
require 'vendor/autoload.php';

use Unitpost\Client;

$unitpost = new Client(); // reads UNITPOST_API_KEY

$result = $unitpost->automations->validate("atm_123", []);
```

**Laravel**

```php
use Unitpost\Laravel\Facades\Unitpost;

$result = Unitpost::automations()->validate("atm_123", []);
```

**Go**

```go
import (
    "context"
    "github.com/unitpostcom/unitpost-go"
)

client := unitpost.New() // reads UNITPOST_API_KEY
ctx := context.Background()

data, err := client.Automations.Validate(ctx, "atm_123", map[string]any{})
```

**Java**

```java
import com.unitpost.Unitpost;

var unitpost = new Unitpost(); // reads UNITPOST_API_KEY

var result = unitpost.automations.validate("atm_123", java.util.Map.of());
```

**Rust**

```rust
use unitpost::Unitpost;

let unitpost = Unitpost::new(); // reads UNITPOST_API_KEY

let result = unitpost.automations().validate("atm_123", serde_json::json!({})).await;
```

**.NET**

```csharp
using Unitpost;

var unitpost = new UnitpostClient(); // reads UNITPOST_API_KEY

var result = await unitpost.Automations.Validate("atm_123", new { });
```

Fix every error by its `node_id` and `path` and validate again; then read `readiness`. Codes and readiness: Test and publish an automation (/guides/automations-testing).

### 3. Dry-run it

**cURL**

```bash
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"
    }
  }'
```

**CLI**

```bash
unitpost automations simulate \
  atm_123 \
  --email sam@acme.com \
  --event-data '{"cart_url":"https://shop.acme.com/cart/123"}'
```

**Node.js**

```ts
import { Unitpost } from "unitpost";

const unitpost = new Unitpost(process.env.UNITPOST_API_KEY);

const { data, error } = await unitpost.automations.simulate("atm_123", {
  email: "sam@acme.com",
  event_data: {
    cart_url: "https://shop.acme.com/cart/123",
  },
});
```

**Python**

```python
from unitpost import Unitpost

unitpost = Unitpost()  # reads UNITPOST_API_KEY

result = unitpost.automations.simulate("atm_123", {
    "email": "sam@acme.com",
    "event_data": {
        "cart_url": "https://shop.acme.com/cart/123",
    },
})
```

**Ruby**

```ruby
require "unitpost"

unitpost = Unitpost::Client.new  # reads UNITPOST_API_KEY

result = unitpost.automations.simulate("atm_123", {
  email: "sam@acme.com",
  event_data: {
    cart_url: "https://shop.acme.com/cart/123",
  },
})
```

**PHP**

```php
require 'vendor/autoload.php';

use Unitpost\Client;

$unitpost = new Client(); // reads UNITPOST_API_KEY

$result = $unitpost->automations->simulate("atm_123", [
    "email" => "sam@acme.com",
    "event_data" => [
        "cart_url" => "https://shop.acme.com/cart/123",
    ],
]);
```

**Laravel**

```php
use Unitpost\Laravel\Facades\Unitpost;

$result = Unitpost::automations()->simulate("atm_123", [
    "email" => "sam@acme.com",
    "event_data" => [
        "cart_url" => "https://shop.acme.com/cart/123",
    ],
]);
```

**Go**

```go
import (
    "context"
    "github.com/unitpostcom/unitpost-go"
)

client := unitpost.New() // reads UNITPOST_API_KEY
ctx := context.Background()

data, err := client.Automations.Simulate(ctx, "atm_123", map[string]any{
	"email": "sam@acme.com",
	"event_data": map[string]any{
		"cart_url": "https://shop.acme.com/cart/123",
	},
})
```

**Java**

```java
import com.unitpost.Unitpost;

var unitpost = new Unitpost(); // reads UNITPOST_API_KEY

var result = unitpost.automations.simulate("atm_123", java.util.Map.of(
    "email", "sam@acme.com",
    "event_data", java.util.Map.of(
        "cart_url", "https://shop.acme.com/cart/123"
    )
));
```

**Rust**

```rust
use unitpost::Unitpost;

let unitpost = Unitpost::new(); // reads UNITPOST_API_KEY

let result = unitpost.automations().simulate("atm_123", serde_json::json!({"email":"sam@acme.com","event_data":{"cart_url":"https://shop.acme.com/cart/123"}})).await;
```

**.NET**

```csharp
using Unitpost;

var unitpost = new UnitpostClient(); // reads UNITPOST_API_KEY

var result = await unitpost.Automations.Simulate("atm_123", new {
    email = "sam@acme.com",
    event_data = new {
        cart_url = "https://shop.acme.com/cart/123",
    },
});
```

### 4. Publish

**cURL**

```bash
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"
  }'
```

**CLI**

```bash
unitpost automations publish atm_123 --changelog 'First version'
```

**Node.js**

```ts
import { Unitpost } from "unitpost";

const unitpost = new Unitpost(process.env.UNITPOST_API_KEY);

const { data, error } = await unitpost.automations.publish("atm_123", {
  changelog: "First version",
});
```

**Python**

```python
from unitpost import Unitpost

unitpost = Unitpost()  # reads UNITPOST_API_KEY

result = unitpost.automations.publish("atm_123", {
    "changelog": "First version",
})
```

**Ruby**

```ruby
require "unitpost"

unitpost = Unitpost::Client.new  # reads UNITPOST_API_KEY

result = unitpost.automations.publish("atm_123", {
  changelog: "First version",
})
```

**PHP**

```php
require 'vendor/autoload.php';

use Unitpost\Client;

$unitpost = new Client(); // reads UNITPOST_API_KEY

$result = $unitpost->automations->publish("atm_123", [
    "changelog" => "First version",
]);
```

**Laravel**

```php
use Unitpost\Laravel\Facades\Unitpost;

$result = Unitpost::automations()->publish("atm_123", [
    "changelog" => "First version",
]);
```

**Go**

```go
import (
    "context"
    "github.com/unitpostcom/unitpost-go"
)

client := unitpost.New() // reads UNITPOST_API_KEY
ctx := context.Background()

data, err := client.Automations.Publish(ctx, "atm_123", map[string]any{
	"changelog": "First version",
})
```

**Java**

```java
import com.unitpost.Unitpost;

var unitpost = new Unitpost(); // reads UNITPOST_API_KEY

var result = unitpost.automations.publish("atm_123", java.util.Map.of(
    "changelog", "First version"
));
```

**Rust**

```rust
use unitpost::Unitpost;

let unitpost = Unitpost::new(); // reads UNITPOST_API_KEY

let result = unitpost.automations().publish("atm_123", serde_json::json!({"changelog":"First version"})).await;
```

**.NET**

```csharp
using Unitpost;

var unitpost = new UnitpostClient(); // reads UNITPOST_API_KEY

var result = await unitpost.Automations.Publish("atm_123", new {
    changelog = "First version",
});
```

### 5. Send the event

**cURL**

```bash
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"
  }'
```

**CLI**

```bash
unitpost events emit \
  --name cart.updated \
  --email sam@acme.com \
  --data '{"cart_url":"https://shop.acme.com/cart/123","item_count":2}' \
  --idempotency-key cart-123-v4
```

**Node.js**

```ts
import { Unitpost } from "unitpost";

const unitpost = new Unitpost(process.env.UNITPOST_API_KEY);

const { data, error } = await unitpost.events.emit({
  name: "cart.updated",
  email: "sam@acme.com",
  data: {
    cart_url: "https://shop.acme.com/cart/123",
    item_count: 2,
  },
  idempotency_key: "cart-123-v4",
});
```

**Python**

```python
from unitpost import Unitpost

unitpost = Unitpost()  # reads UNITPOST_API_KEY

result = unitpost.events.emit({
    "name": "cart.updated",
    "email": "sam@acme.com",
    "data": {
        "cart_url": "https://shop.acme.com/cart/123",
        "item_count": 2,
    },
    "idempotency_key": "cart-123-v4",
})
```

**Ruby**

```ruby
require "unitpost"

unitpost = Unitpost::Client.new  # reads UNITPOST_API_KEY

result = unitpost.events.emit({
  name: "cart.updated",
  email: "sam@acme.com",
  data: {
    cart_url: "https://shop.acme.com/cart/123",
    item_count: 2,
  },
  idempotency_key: "cart-123-v4",
})
```

**PHP**

```php
require 'vendor/autoload.php';

use Unitpost\Client;

$unitpost = new Client(); // reads UNITPOST_API_KEY

$result = $unitpost->events->emit([
    "name" => "cart.updated",
    "email" => "sam@acme.com",
    "data" => [
        "cart_url" => "https://shop.acme.com/cart/123",
        "item_count" => 2,
    ],
    "idempotency_key" => "cart-123-v4",
]);
```

**Laravel**

```php
use Unitpost\Laravel\Facades\Unitpost;

$result = Unitpost::events()->emit([
    "name" => "cart.updated",
    "email" => "sam@acme.com",
    "data" => [
        "cart_url" => "https://shop.acme.com/cart/123",
        "item_count" => 2,
    ],
    "idempotency_key" => "cart-123-v4",
]);
```

**Go**

```go
import (
    "context"
    "github.com/unitpostcom/unitpost-go"
)

client := unitpost.New() // reads UNITPOST_API_KEY
ctx := context.Background()

data, err := client.Events.Emit(ctx, map[string]any{
	"name": "cart.updated",
	"email": "sam@acme.com",
	"data": map[string]any{
		"cart_url": "https://shop.acme.com/cart/123",
		"item_count": 2,
	},
	"idempotency_key": "cart-123-v4",
})
```

**Java**

```java
import com.unitpost.Unitpost;

var unitpost = new Unitpost(); // reads UNITPOST_API_KEY

var result = unitpost.events.emit(java.util.Map.of(
    "name", "cart.updated",
    "email", "sam@acme.com",
    "data", java.util.Map.of(
        "cart_url", "https://shop.acme.com/cart/123",
        "item_count", 2
    ),
    "idempotency_key", "cart-123-v4"
));
```

**Rust**

```rust
use unitpost::Unitpost;

let unitpost = Unitpost::new(); // reads UNITPOST_API_KEY

let result = unitpost.events().emit(serde_json::json!({"name":"cart.updated","email":"sam@acme.com","data":{"cart_url":"https://shop.acme.com/cart/123","item_count":2},"idempotency_key":"cart-123-v4"})).await;
```

**.NET**

```csharp
using Unitpost;

var unitpost = new UnitpostClient(); // reads UNITPOST_API_KEY

var result = await unitpost.Events.Emit(new {
    name = "cart.updated",
    email = "sam@acme.com",
    data = new {
        cart_url = "https://shop.acme.com/cart/123",
        item_count = 2,
    },
    idempotency_key = "cart-123-v4",
});
```

### 6. Read the runs

**cURL**

```bash
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'
```

**CLI**

```bash
unitpost automations list-runs atm_123 --limit 20
```

**Node.js**

```ts
import { Unitpost } from "unitpost";

const unitpost = new Unitpost(process.env.UNITPOST_API_KEY);

const { data, error } = await unitpost.automations.listRuns("atm_123");
```

**Python**

```python
from unitpost import Unitpost

unitpost = Unitpost()  # reads UNITPOST_API_KEY

result = unitpost.automations.list_runs("atm_123")
```

**Ruby**

```ruby
require "unitpost"

unitpost = Unitpost::Client.new  # reads UNITPOST_API_KEY

result = unitpost.automations.list_runs("atm_123")
```

**PHP**

```php
require 'vendor/autoload.php';

use Unitpost\Client;

$unitpost = new Client(); // reads UNITPOST_API_KEY

$result = $unitpost->automations->listRuns("atm_123");
```

**Laravel**

```php
use Unitpost\Laravel\Facades\Unitpost;

$result = Unitpost::automations()->listRuns("atm_123");
```

**Go**

```go
import (
    "context"
    "github.com/unitpostcom/unitpost-go"
)

client := unitpost.New() // reads UNITPOST_API_KEY
ctx := context.Background()

data, err := client.Automations.ListRuns(ctx, "atm_123", nil)
```

**Java**

```java
import com.unitpost.Unitpost;

var unitpost = new Unitpost(); // reads UNITPOST_API_KEY

var result = unitpost.automations.listRuns("atm_123");
```

**Rust**

```rust
use unitpost::Unitpost;

let unitpost = Unitpost::new(); // reads UNITPOST_API_KEY

let result = unitpost.automations().list_runs("atm_123", &[]).await;
```

**.NET**

```csharp
using Unitpost;

var unitpost = new UnitpostClient(); // reads UNITPOST_API_KEY

var result = await unitpost.Automations.ListRuns("atm_123");
```

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 (/api/v1/openapi.json).

### Go deeper

The guides explain the rest: How automations work (/guides/automations), Build with AI (/guides/automations-build-with-ai), Examples (/guides/automations-examples), Triggers (/guides/automations-triggers), Blocks (/guides/automations-blocks), Data and variables (/guides/automations-data), Safety and limits (/guides/automations-safety), Testing and going live (/guides/automations-testing), Runs and debugging (/guides/automations-runs), Events and webhooks (/guides/automations-events), Billing (/guides/automations-billing).
