POST
cURL
Creates an automation as a draft, optionally with its trigger and steps. Without a trigger it starts on contact.created. Nothing runs until you enable it.
Needs an API key with full access. Not available to a key limited to one domain.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
name
string
required
Required string length: 1 - 100
trigger
object

What starts a run. Either {"type":"event","event":} for something that happens in Ozi (contact.created, email.opened, mailbox.message.received and the rest of the enum), optionally with "contactBookId" to only start for contacts in that book (needed to add existing contacts); or {"type":"custom","name":"signed_up"} for an event your app posts to POST /v1/events.

steps
object[]

Run in order for each person. Each step has a "type": send_email {id, from (on a verified domain), subject, html or text or templateId, replyTo?}, with {{firstName}}, {{email}}, {{firstName,fallback=there}} and {{ozi_unsubscribe_url}} filled in; delay {amount, unit: minutes|hours|days}, at most 30 days; add_to_contact_book and remove_from_contact_book {contactBookId}; update_contact_property {property, value}; unsubscribe_contact; notify_team (emails the team's admins); webhook {url}; condition {check, yes: [steps], no: [steps]}, where yes and no are lists of these same steps and check is {kind:"email_opened"|"email_clicked", stepId: the id of an earlier send_email} or {kind:"contact_property", property, operator:"equals"|"contains", value} or {kind:"topic_subscribed", topicId}. At most 25 steps per list, 50 in all, conditions 3 deep. A mailbox event trigger can't be followed by steps that change a contact.

Response

The new automation, as a draft. Without a trigger it starts on contact.created. Nothing runs until it is enabled.

id
string
required
name
string
required
status
enum<string>
required
Available options:
DRAFT,
ENABLED,
DISABLED
triggerEvent
string | null
required
createdAt
string
required
updatedAt
string
required
trigger
object
steps
object[]
_count
object

How many runs it has had (list and get)