---
title: "Automations"
description: "Emails and steps that run by themselves for each contact, and the events that start them."
url: "https://openemail.uk/docs/mcp/tools/automations"
area: "MCP server"
category: "Tools"
---

# Automations

Emails and steps that run by themselves for each contact, and the events that start them.

## Automations tools

| Tool | What it does |
| --- | --- |
| listAutomations | The workspace’s automations, most recently changed first, with their status, what starts each one and how many contacts are in it. |
| getAutomation | One automation in full: its status, settings and numbers, what is wrong with its draft, and the draft definition as JSON. `includePublished` adds the version that is running. |
| listAutomationStarters | The ready-made automations a new one can begin from, each with its definition. |
| createAutomation | Create a draft from a starter, from a definition written as JSON, or empty, with any settings. Nothing runs until it is published. |
| updateAutomation | Change an automation’s name and settings, which apply at once, or replace its draft definition. A live automation keeps running its published version. |
| deleteAutomation | Delete an automation for good, with its versions, enrollments and numbers. Contacts in it stop at once. |
| publishAutomation | Make the draft the version that runs and turn the automation on. A draft that is not complete is refused with every problem that blocks it. Needs `emails:send` as well. |
| pauseAutomation | Stop a live automation. Nobody new enters, and everyone in it stays where they are. |
| resumeAutomation | Turn a paused automation back on with the version it was running. Needs `emails:send` as well. |
| archiveAutomation | Retire an automation for good and keep its history. Everyone in it leaves. |
| duplicateAutomation | Copy an automation into a new draft, without its versions, contacts or numbers. |
| sendAutomationTest | Send the email of one step of the draft to yourself or to one address. Needs `emails:send` as well. |
| listAutomationVersions | The published versions, newest first, and which one is running. `includeDefinitions` adds each definition. |
| restoreAutomationVersion | Copy an earlier version back into the draft. Nothing that is running changes until the next publish. |
| getAutomationStats | Contacts entered, in it now, completed and left, and emails sent, delivered, opened and clicked over a window, in total and for each step. |
| listAutomationEnrollments | The contacts in an automation or that have been, a page at a time, with the step each is at and how it ended. Filter by status, step or a piece of the address. |
| getAutomationEnrollment | One contact’s way through an automation: what each step did for them, oldest first. |
| enrollInAutomation | Put one contact into a live automation at its first step, whatever starts it normally. |
| removeFromAutomation | Take one contact out of an automation at once. |
| sendContactEvent | Record that something happened to a contact. It starts the live automations whose trigger names the event and ends the waits that were holding out for it. |
| sendContactEvents | Record up to 100 events in one call. One failing does not stop the rest. |
| listContactEventNames | The event names the workspace has recorded in the last 90 days. |
| listContactEvents | The events recorded for one contact, newest first, a page at a time. |

> Reading needs `automations:read` and every change needs `automations:write`. Publishing, resuming and sending a test also need `emails:send`, because the automation then sends mail for whoever published it. Sending an event needs `contacts:write`, reading the events of a contact needs `contacts:read`, and `listContactEventNames` needs `automations:read`. A client acting for a member sees only the automations that member made and the contacts that member added.

> Some tools on this server make a change the REST API guards with a verification code, and ask for the same code. Until the client has verified a code in the last 60 minutes, or the person has chosen Allow changes for 60 minutes on it in Account → Connected apps, such a tool answers with a result that starts `Refused (step_up_required):` and changes nothing. `emptyAudience` never asks for a code. The API Authentication page lists every tool that asks, and shows how to ask for a code and verify it.

> The tools apply the same rules and refusals as the REST API, and the `/automations` and `/events` pages of the API reference describe every field. A definition is passed whole as JSON: read it with `getAutomation`, change it and pass all of it back to `updateAutomation`.

## Reference

### `listAutomations`

List the automations in this workspace, the most recently changed first: name, id, status (draft, live, paused or archived), what starts each one, its steps and how many contacts are in it now, completed it or left early. Use it to find an automation by name before reading or changing it. One page at a time: when more follow, the last line gives a cursor to pass back.

- Scopes: `automations:read`.
- The app's assistant runs it without asking.
- Toolkit: `automations`.

**Inputs**

- `status` (`string`, one of `"draft"`, `"live"`, `"paused"`, `"archived"`)
- `limit` (`integer`, at least 1, at most 100)
- `cursor` (`string`, 1 to 64 characters)

Also available in: API [`GET /automations`](https://openemail.uk/docs/api/reference/automations#get-automations); TypeScript [`automations.list()`](https://openemail.uk/docs/sdk/reference/automations#list), [`automations.listAll()`](https://openemail.uk/docs/sdk/reference/automations#listAll), [`automations.iterate()`](https://openemail.uk/docs/sdk/reference/automations#iterate); Python [`automations.list()`](https://openemail.uk/docs/python/reference/automations#list), [`automations.list_all()`](https://openemail.uk/docs/python/reference/automations#listAll), [`automations.iterate()`](https://openemail.uk/docs/python/reference/automations#iterate); Ruby [`automations.list`](https://openemail.uk/docs/ruby/reference/automations#list), [`automations.list_all`](https://openemail.uk/docs/ruby/reference/automations#listAll), [`automations.iterate`](https://openemail.uk/docs/ruby/reference/automations#iterate); PHP [`automations->list`](https://openemail.uk/docs/php/reference/automations#list), [`automations->listAll`](https://openemail.uk/docs/php/reference/automations#listAll), [`automations->iterate`](https://openemail.uk/docs/php/reference/automations#iterate); Go [`Automations.List`](https://openemail.uk/docs/go/reference/automations#list), [`Automations.ListAll`](https://openemail.uk/docs/go/reference/automations#listAll), [`Automations.Iterate`](https://openemail.uk/docs/go/reference/automations#iterate); Java [`automations().list`](https://openemail.uk/docs/java/reference/automations#list), [`automations().listAll`](https://openemail.uk/docs/java/reference/automations#listAll), [`automations().iterate`](https://openemail.uk/docs/java/reference/automations#iterate); C# [`Automations.ListAsync`](https://openemail.uk/docs/csharp/reference/automations#list), [`Automations.ListAllAsync`](https://openemail.uk/docs/csharp/reference/automations#listAll), [`Automations.IterateAsync`](https://openemail.uk/docs/csharp/reference/automations#iterate).

### `getAutomation`

Read one automation: its status, settings, numbers, what is wrong with its draft, and the draft definition (trigger and steps) as JSON, to change and pass back to updateAutomation. includePublished adds the definition of the version that is running, which differs from the draft while there are unpublished changes.

- Scopes: `automations:read`.
- The app's assistant runs it without asking.
- Toolkit: `automations`.

**Inputs**

- `id` (`string`, required, 1 to 64 characters): The automation, by id (aut_...). listAutomations finds it by name.
- `includePublished` (`boolean`, default `false`)

Also available in: API [`GET /automations/{id}`](https://openemail.uk/docs/api/reference/automations#get-automations-id); TypeScript [`automations.get()`](https://openemail.uk/docs/sdk/reference/automations#get); Python [`automations.get()`](https://openemail.uk/docs/python/reference/automations#get); Ruby [`automations.get`](https://openemail.uk/docs/ruby/reference/automations#get); PHP [`automations->get`](https://openemail.uk/docs/php/reference/automations#get); Go [`Automations.Get`](https://openemail.uk/docs/go/reference/automations#get); Java [`automations().get`](https://openemail.uk/docs/java/reference/automations#get); C# [`Automations.GetAsync`](https://openemail.uk/docs/csharp/reference/automations#get).

### `listAutomationStarters`

The ready-made automations a new one can begin from, such as a welcome series or a birthday note: slug, name, what each is for and its definition as JSON. Pass a slug to createAutomation as starter. A starter leaves the audience, the templates and the from address empty to fill in.

- Scopes: `automations:read`.
- The app's assistant runs it without asking.
- Toolkit: `automations`.

**Inputs**

Takes no input.

Also available in: API [`GET /automations/starters`](https://openemail.uk/docs/api/reference/automations#get-automations-starters); TypeScript [`automations.listStarters()`](https://openemail.uk/docs/sdk/reference/automations#listStarters); Python [`automations.list_starters()`](https://openemail.uk/docs/python/reference/automations#listStarters); Ruby [`automations.list_starters`](https://openemail.uk/docs/ruby/reference/automations#listStarters); PHP [`automations->listStarters`](https://openemail.uk/docs/php/reference/automations#listStarters); Go [`Automations.ListStarters`](https://openemail.uk/docs/go/reference/automations#listStarters); Java [`automations().listStarters`](https://openemail.uk/docs/java/reference/automations#listStarters); C# [`Automations.ListStartersAsync`](https://openemail.uk/docs/csharp/reference/automations#listStarters).

### `createAutomation`

Create an automation as a draft: from a starter (listAutomationStarters names them), from a definition written out as JSON, or empty. Nothing runs until publishAutomation. The answer lists what the draft still needs before it can be published, such as a template or a from address for each email. Find audiences with listAudiences, templates with listTemplates and forms with listForms.

- Scopes: `automations:write`.
- The app's assistant asks first unless you asked for it.
- Toolkit: `automations`.

**Inputs**

- `name` (`string`, required, 1 to 120 characters): A short name for the automation. Contacts never see it.
- `description` (`string`, up to 500 characters): One line about what it is for.
- `starter` (`string`, 1 to 64 characters)
- `definition` (`Record<string, any> | string`): The trigger and steps as JSON: {"trigger": {...}, "entry": "<key of the first step>", "steps": [...]}. Triggers: {"kind": "audience_joined", "audienceId", "includeImported": false}, {"kind": "form_submitted", "formId"}, {"kind": "event", "eventName", "filters": []}, {"kind": "date", "field": "birthday" or "joined", "audienceId", "offsetDays": 0} and {"kind": "manual"}. Every step has a unique key of 3 to 24 lowercase letters and digits starting with a letter, and points at the next step by key in next, or null to end the path. Steps: {"kind": "send_email", "key", "next", "templateId", "templateVersion": null, "from": {"email", "name"}, "replyTo": null, "subject": null, "props": {}}, {"kind": "wait", "key", "next", "wait": {"mode": "duration", "amount": 3, "unit": "days"}}, {"kind": "branch", "key", "condition": {"kind": "email_clicked", "stepKey"}, "yes", "no"}, {"kind": "add_to_audience" or "remove_from_audience", "key", "next", "audienceId"}, {"kind": "update_field", "key", "next", "field", "value": {"source": "static", "value"}}, {"kind": "webhook", "key", "next", "endpointId"} and {"kind": "exit", "key"}. A wait can also be {"mode": "until", "weekdays": [1], "hour": 9, "minute": 0} or {"mode": "event", "eventName", "timeout": {"amount": 7, "unit": "days"}}. Conditions: email_opened and email_clicked with stepKey, in_audience with audienceId, field with field, operator and value, and event with eventName and withinDays. A props value is {"source": "static", "value"}, {"source": "contact", "field"} or {"source": "event", "path"}. Paths never join or loop. getAutomation shows a saved definition in this shape, and listAutomationStarters has ready-made ones.
- `settings` (`Record<string, any> | string`): How it runs, as JSON with any of: timezone (an IANA zone such as Europe/London), sendWindow ({"days": [1, 2, 3, 4, 5], "startMinute": 540, "endMinute": 1020} or null for any time), reentryDays (days after finishing before a contact may enter again, or null for once only), exitOnLeave (true takes a contact out when they leave the audience that started it) and listAudienceId (the audience unsubscribes are recorded in).

Also available in: API [`POST /automations`](https://openemail.uk/docs/api/reference/automations#post-automations); TypeScript [`automations.create()`](https://openemail.uk/docs/sdk/reference/automations#create); Python [`automations.create()`](https://openemail.uk/docs/python/reference/automations#create); Ruby [`automations.create`](https://openemail.uk/docs/ruby/reference/automations#create); PHP [`automations->create`](https://openemail.uk/docs/php/reference/automations#create); Go [`Automations.Create`](https://openemail.uk/docs/go/reference/automations#create); Java [`automations().create`](https://openemail.uk/docs/java/reference/automations#create); C# [`Automations.CreateAsync`](https://openemail.uk/docs/csharp/reference/automations#create).

### `updateAutomation`

Change an automation. Its name, description and settings apply at once. definition replaces the whole draft, so start from getAutomation, change the JSON and pass all of it back. A live automation keeps running its published version until publishAutomation, and contacts already in it stay on the version they entered on. Pass only what changes.

- Scopes: `automations:write`.
- The app's assistant asks first unless you asked for it.
- Toolkit: `automations`.

**Inputs**

- `id` (`string`, required, 1 to 64 characters): The automation, by id (aut_...). listAutomations finds it by name.
- `name` (`string`, 1 to 120 characters)
- `description` (`string`, nullable, up to 500 characters)
- `definition` (`Record<string, any> | string`): The trigger and steps as JSON: {"trigger": {...}, "entry": "<key of the first step>", "steps": [...]}. Triggers: {"kind": "audience_joined", "audienceId", "includeImported": false}, {"kind": "form_submitted", "formId"}, {"kind": "event", "eventName", "filters": []}, {"kind": "date", "field": "birthday" or "joined", "audienceId", "offsetDays": 0} and {"kind": "manual"}. Every step has a unique key of 3 to 24 lowercase letters and digits starting with a letter, and points at the next step by key in next, or null to end the path. Steps: {"kind": "send_email", "key", "next", "templateId", "templateVersion": null, "from": {"email", "name"}, "replyTo": null, "subject": null, "props": {}}, {"kind": "wait", "key", "next", "wait": {"mode": "duration", "amount": 3, "unit": "days"}}, {"kind": "branch", "key", "condition": {"kind": "email_clicked", "stepKey"}, "yes", "no"}, {"kind": "add_to_audience" or "remove_from_audience", "key", "next", "audienceId"}, {"kind": "update_field", "key", "next", "field", "value": {"source": "static", "value"}}, {"kind": "webhook", "key", "next", "endpointId"} and {"kind": "exit", "key"}. A wait can also be {"mode": "until", "weekdays": [1], "hour": 9, "minute": 0} or {"mode": "event", "eventName", "timeout": {"amount": 7, "unit": "days"}}. Conditions: email_opened and email_clicked with stepKey, in_audience with audienceId, field with field, operator and value, and event with eventName and withinDays. A props value is {"source": "static", "value"}, {"source": "contact", "field"} or {"source": "event", "path"}. Paths never join or loop. getAutomation shows a saved definition in this shape, and listAutomationStarters has ready-made ones.
- `settings` (`Record<string, any> | string`): How it runs, as JSON with any of: timezone (an IANA zone such as Europe/London), sendWindow ({"days": [1, 2, 3, 4, 5], "startMinute": 540, "endMinute": 1020} or null for any time), reentryDays (days after finishing before a contact may enter again, or null for once only), exitOnLeave (true takes a contact out when they leave the audience that started it) and listAudienceId (the audience unsubscribes are recorded in).
- `expectedUpdatedAt` (`string`, format `date-time`): The Updated time getAutomation gave. When somebody saved the automation since, the change is refused instead of written over theirs.

Also available in: API [`PATCH /automations/{id}`](https://openemail.uk/docs/api/reference/automations#patch-automations-id); TypeScript [`automations.update()`](https://openemail.uk/docs/sdk/reference/automations#update); Python [`automations.update()`](https://openemail.uk/docs/python/reference/automations#update); Ruby [`automations.update`](https://openemail.uk/docs/ruby/reference/automations#update); PHP [`automations->update`](https://openemail.uk/docs/php/reference/automations#update); Go [`Automations.Update`](https://openemail.uk/docs/go/reference/automations#update); Java [`automations().update`](https://openemail.uk/docs/java/reference/automations#update); C# [`Automations.UpdateAsync`](https://openemail.uk/docs/csharp/reference/automations#update).

### `deleteAutomation`

Delete an automation for good, with its versions, its enrollments and its numbers. Contacts in it stop at once. The emails it already sent stay. It cannot be undone: to retire one and keep its history, use archiveAutomation.

- Scopes: `automations:write`.
- The app's assistant always asks first.
- Asks for a verification code, the same as [`DELETE /automations/{id}`](https://openemail.uk/docs/api/reference/automations#delete-automations-id).
- Toolkit: `automations`.

**Inputs**

- `id` (`string`, required, 1 to 64 characters): The automation, by id (aut_...). listAutomations finds it by name.

Also available in: API [`DELETE /automations/{id}`](https://openemail.uk/docs/api/reference/automations#delete-automations-id); TypeScript [`automations.delete()`](https://openemail.uk/docs/sdk/reference/automations#delete); Python [`automations.delete()`](https://openemail.uk/docs/python/reference/automations#delete); Ruby [`automations.delete`](https://openemail.uk/docs/ruby/reference/automations#delete); PHP [`automations->delete`](https://openemail.uk/docs/php/reference/automations#delete); Go [`Automations.Delete`](https://openemail.uk/docs/go/reference/automations#delete); Java [`automations().delete`](https://openemail.uk/docs/java/reference/automations#delete); C# [`Automations.DeleteAsync`](https://openemail.uk/docs/csharp/reference/automations#delete).

### `publishAutomation`

Publish an automation: its draft becomes the version that runs and it goes live, so its trigger starts putting contacts in and its emails start going out. Use it for a first publish and to put later changes to work. The draft has to be complete, and a refusal lists every problem that blocks it. Contacts already in it stay on the version they entered on.

- Scopes: `automations:write`, `emails:send`.
- The app's assistant always asks first.
- Toolkit: `automations`.

**Inputs**

- `id` (`string`, required, 1 to 64 characters): The automation, by id (aut_...). listAutomations finds it by name.

Also available in: API [`POST /automations/{id}/publish`](https://openemail.uk/docs/api/reference/automations#post-automations-id-publish); TypeScript [`automations.publish()`](https://openemail.uk/docs/sdk/reference/automations#publish); Python [`automations.publish()`](https://openemail.uk/docs/python/reference/automations#publish); Ruby [`automations.publish`](https://openemail.uk/docs/ruby/reference/automations#publish); PHP [`automations->publish`](https://openemail.uk/docs/php/reference/automations#publish); Go [`Automations.Publish`](https://openemail.uk/docs/go/reference/automations#publish); Java [`automations().publish`](https://openemail.uk/docs/java/reference/automations#publish); C# [`Automations.PublishAsync`](https://openemail.uk/docs/csharp/reference/automations#publish).

### `pauseAutomation`

Pause a live automation. Nobody new enters, and everyone in it stays where they are and moves on when it is resumed with resumeAutomation.

- Scopes: `automations:write`.
- The app's assistant asks first unless you asked for it.
- Toolkit: `automations`.

**Inputs**

- `id` (`string`, required, 1 to 64 characters): The automation, by id (aut_...). listAutomations finds it by name.

Also available in: API [`POST /automations/{id}/pause`](https://openemail.uk/docs/api/reference/automations#post-automations-id-pause); TypeScript [`automations.pause()`](https://openemail.uk/docs/sdk/reference/automations#pause); Python [`automations.pause()`](https://openemail.uk/docs/python/reference/automations#pause); Ruby [`automations.pause`](https://openemail.uk/docs/ruby/reference/automations#pause); PHP [`automations->pause`](https://openemail.uk/docs/php/reference/automations#pause); Go [`Automations.Pause`](https://openemail.uk/docs/go/reference/automations#pause); Java [`automations().pause`](https://openemail.uk/docs/java/reference/automations#pause); C# [`Automations.PauseAsync`](https://openemail.uk/docs/csharp/reference/automations#pause).

### `resumeAutomation`

Turn a paused automation back on with the version it was running, without publishing the draft. Contacts that were held move on and its emails go out again. One that was paused because something it needs went away stays paused until that is fixed, and the refusal says what.

- Scopes: `automations:write`, `emails:send`.
- The app's assistant always asks first.
- Toolkit: `automations`.

**Inputs**

- `id` (`string`, required, 1 to 64 characters): The automation, by id (aut_...). listAutomations finds it by name.

Also available in: API [`POST /automations/{id}/resume`](https://openemail.uk/docs/api/reference/automations#post-automations-id-resume); TypeScript [`automations.resume()`](https://openemail.uk/docs/sdk/reference/automations#resume); Python [`automations.resume()`](https://openemail.uk/docs/python/reference/automations#resume); Ruby [`automations.resume`](https://openemail.uk/docs/ruby/reference/automations#resume); PHP [`automations->resume`](https://openemail.uk/docs/php/reference/automations#resume); Go [`Automations.Resume`](https://openemail.uk/docs/go/reference/automations#resume); Java [`automations().resume`](https://openemail.uk/docs/java/reference/automations#resume); C# [`Automations.ResumeAsync`](https://openemail.uk/docs/csharp/reference/automations#resume).

### `archiveAutomation`

Retire an automation for good and keep its history. Everyone in it leaves, nobody enters again and it can no longer be changed, published or resumed. Its versions, enrollments and numbers stay readable. To stop one for a while, use pauseAutomation.

- Scopes: `automations:write`.
- The app's assistant always asks first.
- Toolkit: `automations`.

**Inputs**

- `id` (`string`, required, 1 to 64 characters): The automation, by id (aut_...). listAutomations finds it by name.

Also available in: API [`POST /automations/{id}/archive`](https://openemail.uk/docs/api/reference/automations#post-automations-id-archive); TypeScript [`automations.archive()`](https://openemail.uk/docs/sdk/reference/automations#archive); Python [`automations.archive()`](https://openemail.uk/docs/python/reference/automations#archive); Ruby [`automations.archive`](https://openemail.uk/docs/ruby/reference/automations#archive); PHP [`automations->archive`](https://openemail.uk/docs/php/reference/automations#archive); Go [`Automations.Archive`](https://openemail.uk/docs/go/reference/automations#archive); Java [`automations().archive`](https://openemail.uk/docs/java/reference/automations#archive); C# [`Automations.ArchiveAsync`](https://openemail.uk/docs/csharp/reference/automations#archive).

### `duplicateAutomation`

Copy an automation into a new draft with "(copy)" after its name: the same draft definition and settings, and none of its versions, contacts or numbers.

- Scopes: `automations:write`.
- The app's assistant asks first unless you asked for it.
- Toolkit: `automations`.

**Inputs**

- `id` (`string`, required, 1 to 64 characters): The automation, by id (aut_...). listAutomations finds it by name.

Also available in: API [`POST /automations/{id}/duplicate`](https://openemail.uk/docs/api/reference/automations#post-automations-id-duplicate); TypeScript [`automations.duplicate()`](https://openemail.uk/docs/sdk/reference/automations#duplicate); Python [`automations.duplicate()`](https://openemail.uk/docs/python/reference/automations#duplicate); Ruby [`automations.duplicate`](https://openemail.uk/docs/ruby/reference/automations#duplicate); PHP [`automations->duplicate`](https://openemail.uk/docs/php/reference/automations#duplicate); Go [`Automations.Duplicate`](https://openemail.uk/docs/go/reference/automations#duplicate); Java [`automations().duplicate`](https://openemail.uk/docs/java/reference/automations#duplicate); C# [`Automations.DuplicateAsync`](https://openemail.uk/docs/csharp/reference/automations#duplicate).

### `sendAutomationTest`

Send the email of one step of the draft to one address, to read it before publishing. It goes to the user's own account address unless to names another. Contact values come from a sample contact, the subject starts with [Test], and nobody is enrolled. It counts toward the monthly sends.

- Scopes: `automations:write`, `emails:send`.
- The app's assistant always asks first.
- Toolkit: `automations`.

**Inputs**

- `id` (`string`, required, 1 to 64 characters): The automation, by id (aut_...). listAutomations finds it by name.
- `stepKey` (`string`, required, 1 to 64 characters): The key of the email step, from the definition getAutomation returns.
- `to` (`string`, up to 320 characters, format `email`): Where the test goes, when not to the user themselves.

Also available in: API [`POST /automations/{id}/test`](https://openemail.uk/docs/api/reference/automations#post-automations-id-test); TypeScript [`automations.sendTest()`](https://openemail.uk/docs/sdk/reference/automations#sendTest); Python [`automations.send_test()`](https://openemail.uk/docs/python/reference/automations#sendTest); Ruby [`automations.send_test`](https://openemail.uk/docs/ruby/reference/automations#sendTest); PHP [`automations->sendTest`](https://openemail.uk/docs/php/reference/automations#sendTest); Go [`Automations.SendTest`](https://openemail.uk/docs/go/reference/automations#sendTest); Java [`automations().sendTest`](https://openemail.uk/docs/java/reference/automations#sendTest); C# [`Automations.SendTestAsync`](https://openemail.uk/docs/csharp/reference/automations#sendTest).

### `listAutomationVersions`

The published versions of an automation, the newest first: number, when it was published and whether it is the one running. includeDefinitions adds each definition as JSON. restoreAutomationVersion copies one back into the draft.

- Scopes: `automations:read`.
- The app's assistant runs it without asking.
- Toolkit: `automations`.

**Inputs**

- `id` (`string`, required, 1 to 64 characters): The automation, by id (aut_...). listAutomations finds it by name.
- `includeDefinitions` (`boolean`, default `false`)

Also available in: API [`GET /automations/{id}/versions`](https://openemail.uk/docs/api/reference/automations#get-automations-id-versions); TypeScript [`automations.listVersions()`](https://openemail.uk/docs/sdk/reference/automations#listVersions); Python [`automations.list_versions()`](https://openemail.uk/docs/python/reference/automations#listVersions); Ruby [`automations.list_versions`](https://openemail.uk/docs/ruby/reference/automations#listVersions); PHP [`automations->listVersions`](https://openemail.uk/docs/php/reference/automations#listVersions); Go [`Automations.ListVersions`](https://openemail.uk/docs/go/reference/automations#listVersions); Java [`automations().listVersions`](https://openemail.uk/docs/java/reference/automations#listVersions); C# [`Automations.ListVersionsAsync`](https://openemail.uk/docs/csharp/reference/automations#listVersions).

### `restoreAutomationVersion`

Copy the definition of an earlier version back into the draft, replacing what the draft holds. Nothing that is running changes until publishAutomation.

- Scopes: `automations:write`.
- The app's assistant asks first unless you asked for it.
- Toolkit: `automations`.

**Inputs**

- `id` (`string`, required, 1 to 64 characters): The automation, by id (aut_...). listAutomations finds it by name.
- `version` (`integer`, required, at least 1): The version number, from listAutomationVersions.

Also available in: API [`POST /automations/{id}/versions/{version}/restore`](https://openemail.uk/docs/api/reference/automations#post-automations-id-versions-version-restore); TypeScript [`automations.restoreVersion()`](https://openemail.uk/docs/sdk/reference/automations#restoreVersion); Python [`automations.restore_version()`](https://openemail.uk/docs/python/reference/automations#restoreVersion); Ruby [`automations.restore_version`](https://openemail.uk/docs/ruby/reference/automations#restoreVersion); PHP [`automations->restoreVersion`](https://openemail.uk/docs/php/reference/automations#restoreVersion); Go [`Automations.RestoreVersion`](https://openemail.uk/docs/go/reference/automations#restoreVersion); Java [`automations().restoreVersion`](https://openemail.uk/docs/java/reference/automations#restoreVersion); C# [`Automations.RestoreVersionAsync`](https://openemail.uk/docs/csharp/reference/automations#restoreVersion).

### `getAutomationStats`

How one automation did over a window, 30 days by default: contacts that entered, are in it now, completed it or left early, emails sent, delivered, opened, clicked, bounced and marked as spam, and unsubscribes, in total and for each step. Opens are a floor, because many mail apps hide them. includeDaily adds a line for each day.

- Scopes: `automations:read`.
- The app's assistant runs it without asking.
- Toolkit: `automations`.

**Inputs**

- `id` (`string`, required, 1 to 64 characters): The automation, by id (aut_...). listAutomations finds it by name.
- `since` (`string`, format `date-time`): Where the window starts, as an ISO 8601 instant.
- `until` (`string`, format `date-time`): Where the window ends, as an ISO 8601 instant. Left out, now.
- `includeDaily` (`boolean`, default `false`)

Also available in: API [`GET /automations/{id}/stats`](https://openemail.uk/docs/api/reference/automations#get-automations-id-stats); TypeScript [`automations.stats()`](https://openemail.uk/docs/sdk/reference/automations#stats); Python [`automations.stats()`](https://openemail.uk/docs/python/reference/automations#stats); Ruby [`automations.stats`](https://openemail.uk/docs/ruby/reference/automations#stats); PHP [`automations->stats`](https://openemail.uk/docs/php/reference/automations#stats); Go [`Automations.Stats`](https://openemail.uk/docs/go/reference/automations#stats); Java [`automations().stats`](https://openemail.uk/docs/java/reference/automations#stats); C# [`Automations.StatsAsync`](https://openemail.uk/docs/csharp/reference/automations#stats).

### `listAutomationEnrollments`

The contacts that are in an automation or have been, the most recent entry first: which step each is at, what they are waiting for, what holds a step that is due, when they move next and how it ended. Narrow it by status, by step or by a piece of the address or name. One page at a time: when more follow, the last line gives a cursor.

- Scopes: `automations:read`.
- The app's assistant runs it without asking.
- Toolkit: `automations`.

**Inputs**

- `id` (`string`, required, 1 to 64 characters): The automation, by id (aut_...). listAutomations finds it by name.
- `status` (`string`, one of `"active"`, `"completed"`, `"exited"`)
- `stepKey` (`string`, 1 to 64 characters)
- `q` (`string`, up to 200 characters)
- `limit` (`integer`, at least 1, at most 200)
- `cursor` (`string`, 1 to 64 characters)

Also available in: API [`GET /automations/{id}/enrollments`](https://openemail.uk/docs/api/reference/automations#get-automations-id-enrollments); TypeScript [`automations.listEnrollments()`](https://openemail.uk/docs/sdk/reference/automations#listEnrollments), [`automations.listAllEnrollments()`](https://openemail.uk/docs/sdk/reference/automations#listAllEnrollments), [`automations.iterateEnrollments()`](https://openemail.uk/docs/sdk/reference/automations#iterateEnrollments); Python [`automations.list_enrollments()`](https://openemail.uk/docs/python/reference/automations#listEnrollments), [`automations.list_all_enrollments()`](https://openemail.uk/docs/python/reference/automations#listAllEnrollments), [`automations.iterate_enrollments()`](https://openemail.uk/docs/python/reference/automations#iterateEnrollments); Ruby [`automations.list_enrollments`](https://openemail.uk/docs/ruby/reference/automations#listEnrollments), [`automations.list_all_enrollments`](https://openemail.uk/docs/ruby/reference/automations#listAllEnrollments), [`automations.iterate_enrollments`](https://openemail.uk/docs/ruby/reference/automations#iterateEnrollments); PHP [`automations->listEnrollments`](https://openemail.uk/docs/php/reference/automations#listEnrollments), [`automations->listAllEnrollments`](https://openemail.uk/docs/php/reference/automations#listAllEnrollments), [`automations->iterateEnrollments`](https://openemail.uk/docs/php/reference/automations#iterateEnrollments); Go [`Automations.ListEnrollments`](https://openemail.uk/docs/go/reference/automations#listEnrollments), [`Automations.ListAllEnrollments`](https://openemail.uk/docs/go/reference/automations#listAllEnrollments), [`Automations.IterateEnrollments`](https://openemail.uk/docs/go/reference/automations#iterateEnrollments); Java [`automations().listEnrollments`](https://openemail.uk/docs/java/reference/automations#listEnrollments), [`automations().listAllEnrollments`](https://openemail.uk/docs/java/reference/automations#listAllEnrollments), [`automations().iterateEnrollments`](https://openemail.uk/docs/java/reference/automations#iterateEnrollments); C# [`Automations.ListEnrollmentsAsync`](https://openemail.uk/docs/csharp/reference/automations#listEnrollments), [`Automations.ListAllEnrollmentsAsync`](https://openemail.uk/docs/csharp/reference/automations#listAllEnrollments), [`Automations.IterateEnrollmentsAsync`](https://openemail.uk/docs/csharp/reference/automations#iterateEnrollments).

### `getAutomationEnrollment`

One contact's way through an automation: where they are, and what each step did for them, oldest first, such as an email sent, a wait, a yes or no at a branch, or why a step was skipped or failed.

- Scopes: `automations:read`.
- The app's assistant runs it without asking.
- Toolkit: `automations`.

**Inputs**

- `id` (`string`, required, 1 to 64 characters): The automation, by id (aut_...). listAutomations finds it by name.
- `enrollmentId` (`string`, required, 1 to 64 characters): The enrollment, by id (aen_...), from listAutomationEnrollments.

Also available in: API [`GET /automations/{id}/enrollments/{enrollmentId}`](https://openemail.uk/docs/api/reference/automations#get-automations-id-enrollments-enrollmentid); TypeScript [`automations.getEnrollment()`](https://openemail.uk/docs/sdk/reference/automations#getEnrollment); Python [`automations.get_enrollment()`](https://openemail.uk/docs/python/reference/automations#getEnrollment); Ruby [`automations.get_enrollment`](https://openemail.uk/docs/ruby/reference/automations#getEnrollment); PHP [`automations->getEnrollment`](https://openemail.uk/docs/php/reference/automations#getEnrollment); Go [`Automations.GetEnrollment`](https://openemail.uk/docs/go/reference/automations#getEnrollment); Java [`automations().getEnrollment`](https://openemail.uk/docs/java/reference/automations#getEnrollment); C# [`Automations.GetEnrollmentAsync`](https://openemail.uk/docs/csharp/reference/automations#getEnrollment).

### `enrollInAutomation`

Put one contact into a live automation at its first step, whatever starts it normally, so its emails start going to them. The contact has to exist already. A contact is in an automation once at a time, and an address that is suppressed or unsubscribed is refused.

- Scopes: `automations:write`.
- The app's assistant always asks first.
- Toolkit: `automations`.

**Inputs**

- `id` (`string`, required, 1 to 64 characters): The automation, by id (aut_...). listAutomations finds it by name.
- `email` (`string`, required, up to 320 characters, format `email`): The contact to enroll, by email address.
- `data` (`Record<string, any>`): Values the steps read wherever a value comes from the event, such as an order number. At most 50 keys and 4 KB of JSON.

Also available in: API [`POST /automations/{id}/enrollments`](https://openemail.uk/docs/api/reference/automations#post-automations-id-enrollments); TypeScript [`automations.enroll()`](https://openemail.uk/docs/sdk/reference/automations#enroll); Python [`automations.enroll()`](https://openemail.uk/docs/python/reference/automations#enroll); Ruby [`automations.enroll`](https://openemail.uk/docs/ruby/reference/automations#enroll); PHP [`automations->enroll`](https://openemail.uk/docs/php/reference/automations#enroll); Go [`Automations.Enroll`](https://openemail.uk/docs/go/reference/automations#enroll); Java [`automations().enroll`](https://openemail.uk/docs/java/reference/automations#enroll); C# [`Automations.EnrollAsync`](https://openemail.uk/docs/csharp/reference/automations#enroll).

### `removeFromAutomation`

Take one contact out of an automation at once, by the id of their enrollment from listAutomationEnrollments. They get nothing more from it, and stay in the contacts and in their audiences.

- Scopes: `automations:write`.
- The app's assistant asks first unless you asked for it.
- Toolkit: `automations`.

**Inputs**

- `id` (`string`, required, 1 to 64 characters): The automation, by id (aut_...). listAutomations finds it by name.
- `enrollmentId` (`string`, required, 1 to 64 characters): The enrollment, by id (aen_...), from listAutomationEnrollments.

Also available in: API [`POST /automations/{id}/enrollments/{enrollmentId}/exit`](https://openemail.uk/docs/api/reference/automations#post-automations-id-enrollments-enrollmentid-exit); TypeScript [`automations.exitEnrollment()`](https://openemail.uk/docs/sdk/reference/automations#exitEnrollment); Python [`automations.exit_enrollment()`](https://openemail.uk/docs/python/reference/automations#exitEnrollment); Ruby [`automations.exit_enrollment`](https://openemail.uk/docs/ruby/reference/automations#exitEnrollment); PHP [`automations->exitEnrollment`](https://openemail.uk/docs/php/reference/automations#exitEnrollment); Go [`Automations.ExitEnrollment`](https://openemail.uk/docs/go/reference/automations#exitEnrollment); Java [`automations().exitEnrollment`](https://openemail.uk/docs/java/reference/automations#exitEnrollment); C# [`Automations.ExitEnrollmentAsync`](https://openemail.uk/docs/csharp/reference/automations#exitEnrollment).

### `sendContactEvent`

Record that something happened to one contact, such as order.placed or trial.started. Every live automation that starts on that event name takes the contact in, so its emails start going to them, and a wait step holding out for the name moves on. The answer says which automations it started. Events are kept for 90 days.

- Scopes: `contacts:write`.
- The app's assistant always asks first.
- Toolkit: `automations`.

**Inputs**

- `name` (`string`, required, 1 to 100 characters): What happened, such as order.placed: letters, digits, dots, colons, dashes and underscores. Names are matched exactly, case included.
- `email` (`string`, required, up to 320 characters, format `email`): The contact the event is about, by email address.
- `properties` (`Record<string, any>`): Details of the event as a JSON object, at most 50 keys and 4 KB. An event trigger can filter on them and steps can use them.
- `occurredAt` (`string`, format `date-time`): When it happened, as an ISO 8601 instant. Left out, it is now. Not in the future, and at most 90 days ago.
- `createContact` (`boolean`): true adds the address to the contacts when nobody has it yet.
- `contactName` (`string`, up to 200 characters): The name to give a contact that createContact adds.

### `sendContactEvents`

Record up to 100 events in one call, each handled as sendContactEvent handles one, in order. One event failing does not stop the rest: the answer says which were recorded, what each started, and why any was not.

- Scopes: `contacts:write`.
- The app's assistant always asks first.
- Toolkit: `automations`.

**Inputs**

- `events` (`object[]`, required, 1 to 100 items)
  - `name` (`string`, required, 1 to 100 characters): What happened, such as order.placed: letters, digits, dots, colons, dashes and underscores. Names are matched exactly, case included.
  - `email` (`string`, required, up to 320 characters, format `email`): The contact the event is about, by email address.
  - `properties` (`Record<string, any>`): Details of the event as a JSON object, at most 50 keys and 4 KB. An event trigger can filter on them and steps can use them.
  - `occurredAt` (`string`, format `date-time`): When it happened, as an ISO 8601 instant. Left out, it is now. Not in the future, and at most 90 days ago.
  - `createContact` (`boolean`): true adds the address to the contacts when nobody has it yet.
  - `contactName` (`string`, up to 200 characters): The name to give a contact that createContact adds.

### `listContactEventNames`

The names of the events this workspace has recorded in the last 90 days, to choose the event that starts an automation or that a wait step holds out for.

- Scopes: `automations:read`.
- The app's assistant runs it without asking.
- Toolkit: `automations`.

**Inputs**

Takes no input.

Also available in: API [`GET /events/names`](https://openemail.uk/docs/api/reference/events#get-events-names); TypeScript [`events.listNames()`](https://openemail.uk/docs/sdk/reference/events#listNames); Python [`events.list_names()`](https://openemail.uk/docs/python/reference/events#listNames); Ruby [`events.list_names`](https://openemail.uk/docs/ruby/reference/events#listNames); PHP [`events->listNames`](https://openemail.uk/docs/php/reference/events#listNames); Go [`Events.ListNames`](https://openemail.uk/docs/go/reference/events#listNames); Java [`events().listNames`](https://openemail.uk/docs/java/reference/events#listNames); C# [`Events.ListNamesAsync`](https://openemail.uk/docs/csharp/reference/events#listNames).

### `listContactEvents`

The events recorded for one contact in the last 90 days, the most recent first: name, when it happened and its properties. Narrow it to one event name. One page at a time: when more follow, the last line gives a cursor.

- Scopes: `contacts:read`.
- The app's assistant runs it without asking.
- Toolkit: `automations`.

**Inputs**

- `email` (`string`, required, 3 to 320 characters): The contact the event is about, by email address.
- `name` (`string`, 1 to 100 characters)
- `limit` (`integer`, at least 1, at most 200)
- `cursor` (`string`, 1 to 64 characters)

Also available in: API [`GET /contacts/{email}/events`](https://openemail.uk/docs/api/reference/events#get-contacts-email-events); TypeScript [`contacts.listEvents()`](https://openemail.uk/docs/sdk/reference/contacts#listEvents), [`contacts.listAllEvents()`](https://openemail.uk/docs/sdk/reference/contacts#listAllEvents), [`contacts.iterateEvents()`](https://openemail.uk/docs/sdk/reference/contacts#iterateEvents); Python [`contacts.list_events()`](https://openemail.uk/docs/python/reference/contacts#listEvents), [`contacts.list_all_events()`](https://openemail.uk/docs/python/reference/contacts#listAllEvents), [`contacts.iterate_events()`](https://openemail.uk/docs/python/reference/contacts#iterateEvents); Ruby [`contacts.list_events`](https://openemail.uk/docs/ruby/reference/contacts#listEvents), [`contacts.list_all_events`](https://openemail.uk/docs/ruby/reference/contacts#listAllEvents), [`contacts.iterate_events`](https://openemail.uk/docs/ruby/reference/contacts#iterateEvents); PHP [`contacts->listEvents`](https://openemail.uk/docs/php/reference/contacts#listEvents), [`contacts->listAllEvents`](https://openemail.uk/docs/php/reference/contacts#listAllEvents), [`contacts->iterateEvents`](https://openemail.uk/docs/php/reference/contacts#iterateEvents); Go [`Contacts.ListEvents`](https://openemail.uk/docs/go/reference/contacts#listEvents), [`Contacts.ListAllEvents`](https://openemail.uk/docs/go/reference/contacts#listAllEvents), [`Contacts.IterateEvents`](https://openemail.uk/docs/go/reference/contacts#iterateEvents); Java [`contacts().listEvents`](https://openemail.uk/docs/java/reference/contacts#listEvents), [`contacts().listAllEvents`](https://openemail.uk/docs/java/reference/contacts#listAllEvents), [`contacts().iterateEvents`](https://openemail.uk/docs/java/reference/contacts#iterateEvents); C# [`Contacts.ListEventsAsync`](https://openemail.uk/docs/csharp/reference/contacts#listEvents), [`Contacts.ListAllEventsAsync`](https://openemail.uk/docs/csharp/reference/contacts#listAllEvents), [`Contacts.IterateEventsAsync`](https://openemail.uk/docs/csharp/reference/contacts#iterateEvents).
