Automations
Define a sequence once, enrol a person, and let it end itself.
An automation is a multi-step sequence defined here rather than as scheduled sends in the calling app. Enrol someone and each step goes out after its delay. The reason to prefer it over four scheduled emails is the exits: the sequence stops on its own when the person unsubscribes, replies, bounces, or is tagged as having converted, which are the things you would otherwise have to track and cancel by hand. Every field and error is in the automations API reference.
Defining one
POST /v1/automations takes a name, a slug, the from address, its identity_id, a trigger and one to twenty steps. Each step has delay_minutes (measured from enrolment for the first, from the previous step for the rest), a subject, and either inline html or a template_slug. {{name}} placeholders in the subject, the inline body and the template are all filled from the enrolment's variables, escaped in the body as a template's are. A step with no body, or a template_slug that does not exist, is refused when the automation is created, and a slug already in use answers 409 conflict. exit_on_reply defaults to true; turn it off for something like a dunning sequence that should continue after a reply.
reply_to sends every step with a Reply-To other than from: a founder's drip usually wants answers in their own inbox rather than on the sending domain. The cost is the reply exit. SendRaven only receives mail for its own domains, so with a reply-to elsewhere a reply never reaches it and exit_on_reply cannot end the sequence for that automation. Leave it out when you want replies threaded and the drip to stop on its own.
Triggers: api for enrolling by call, contact_added with an audience_id to start when someone joins a list, event with an event_name to start on a named event from your app, tag_added with a tag to start when a contact gains that tag, or date to start relative to a date on the contact. An event name is matched exactly, and POST /v1/events takes names of up to 120 characters.
date takes an audience_id, the date_attribute holding the date (renewal_date, birthday), an offset_days (-7 is a week before) and, for birthdays and anniversaries, recurring_yearly: true. The date is read as YYYY-MM-DD or an ISO timestamp, in UTC; anything else is skipped rather than guessed at. Each contact is enrolled at most once per date. Switching it on does not backfill: only dates that come due from that day on enrol anyone, so a renewal reminder turned on today does not mail everyone whose renewal is already inside the week, and the same holds when it is activated again after a pause.
contact_added starts for people added one at a time (POST /v1/contacts, a single contact to POST /v1/audiences/{id}/contacts, or the dashboard), and only when they were not already on that audience. A batch import does not start it unless you pass ?trigger_automations=true: a migrated list is not a few thousand signups, and a welcome sequence to all of it at once is a cold blast from a domain that has never mailed those people. The batch response reports automations_started.
tag_added is for when one audience holds everyone and a tag says who the sequence is for: a welcome series for one product, sent only to contacts tagged with that product. It starts when a contact gains the tag, through POST /v1/contacts/{id}/tags, a contact added one at a time carrying it, a dashboard edit, or a batch import with ?trigger_automations=true. A contact that already carried the tag starts nothing, so a sync that re-sends every contact's tags on every run does not restart anyone, and switching the automation on does not mail everyone already tagged.
A step can carry one condition, asked when the step comes due: has_tag or lacks_tag with a tag, attribute_equals with a key and value, or engaged / not_engaged, whether the person opened or clicked anything this sequence has sent them so far (scanner hits excluded). When it does not hold, the step is skipped and the person moves on to the next one. { "type": "lacks_tag", "tag": "customer" } on the upgrade pitch is the usual one.
default_variables gives every enrolment the same template values, under whatever an enrolment passes in variables. contact_added, tag_added and date enrol with no values of their own, so their placeholders must all have a default, and create answers 422 missing_variables with a missing array when one does not. A changed default reaches people already on the sequence from their next step.
topic_key sends every step under a topic. The unsubscribe link in each step then opts the person out of that topic only, rather than out of all marketing mail, and opting out of the topic ends the sequence. The topic must exist when the automation is created (422 unknown_topic).
exit_tags is a list of contact tags that take someone out of the sequence: anyone carrying one is not enrolled, and an enrolment in flight ends when the tag is added, or at the latest before its next step. Tag a contact customer when they upgrade and a trial sequence stops, without your app knowing which sequences exist.
required_tags is the inverse: only people carrying every one of them are enrolled, and removing one ends the enrolment. Use it for a sequence tied to a state, such as trial. Someone enrolled by API or event with no contact record has no tags, so an automation with required tags never enrols them.
Every step sends as marketing, because a sequence is bulk mail and that is what gets it an unsubscribe footer, so from must sit on a verified marketing domain, and identity_id must be that domain's. Both are checked when the automation is created, with 422 no_verified_identity or 422 invalid_request, rather than surfacing later as a failed enrolment per contact.
A new automation is a draft. POST /v1/automations/{id}/status with { "status": "active" } turns it on; paused stops it: nobody new is enrolled and no step is sent, but enrolments already in flight are held on their current step rather than ended. Activating it again continues each person from where they were, and any step that came due while it was paused goes out on the worker's next run.
Enrolling someone
POST /v1/automations/{id}/enroll with an email and optional variables returns 201 with enrolled: true and the enrolment. Enrolling the same person twice returns 200 with enrolled: false and reason: "already_enrolled". A retried call looks the same as the first, and the guarantee is a unique index on active enrolments rather than a check, so it holds under concurrency too.
Once an enrolment has ended, whether it completed, was cancelled by an exit or failed, the same person can be enrolled again and starts from the first step. That is reenrollment: "after_completion", the default. Set reenrollment: "never" on create, or later with PATCH /v1/automations/{id}, for a sequence each person should get once: a welcome series that must not restart when someone leaves and rejoins a list, or when your app emits signed_up twice. Enrolling someone who has been through it then returns 200 with enrolled: false and reason: "previously_enrolled", and events, contact_added and tag_added skip them the same way.
A suppressed address answers 200 with reason: "suppressed" rather than creating a row that can only ever be cancelled, and so does someone opted out of the automation's topic (unsubscribed_from_topic), already carrying one of its exit tags (exit_tag), or missing one of its required tags (required_tag_missing). An automation that is not active, has no steps, or names a topic that has since been deleted (topic_missing) answers 409 invalid_state, with the same reason in the body.
The key you enrol with is held to its guardrails. A key that holds its sends for approval cannot enrol anyone, because the steps go out later with nobody approving them, and a key with a recipient allowlist can enrol only addresses on it; both answer 403. The steps an enrolment sends do not count against the key's daily limit. POST /v1/events follows the same rules.
Events
POST /v1/events with a name, an email and optional variables enrols the person in every active automation whose trigger waits on that event, and returns automations_started. One call from your app (trial_started, invoice_overdue) instead of it knowing which sequences exist.
Automatic exits
| Exit | What happens |
|---|---|
| Unsubscribe | Every active enrolment for the address is cancelled with reason unsubscribed, along with any sends already scheduled. The same happens for a contact marked unsubscribed, a contact imported as unsubscribed and a suppression added through the API with reason unsubscribe. Cancelling the sends alone would stop one email and let the sequence generate the next, which reads to the recipient as an unsubscribe that did not work. |
| Reply | A message the enrolled person writes cancels the enrolment with reason replied, for every automation with exit_on_reply. It does not have to answer a step: an unrelated email from that address to any of the workspace's domains ends it too. Automatic mail does not: an out-of-office, an auto-reply or a bounce report is not the person answering, and the sequence carries on. A drip that keeps arriving after someone has answered is the most common way a sequence reads as broken. The message has to land on a domain SendRaven receives for: an automation with a reply_to elsewhere never sees the reply, so this exit does not fire there. |
| Hard bounce or complaint | The address is suppressed, and the enrolment is cancelled with reason suppressed when its next step comes due. A contact imported with status: "bounced" or "complained" has it cancelled at once. Suppression is checked before every step, not only at enrolment, so someone who opted out on day two does not receive day three. |
| Topic opt-out | For an automation with a topic_key, opting out of that topic (the step's own unsubscribe link, the preference centre, POST /v1/topics/preferences, or an opt-out import through POST /v1/topics/{key}/import) cancels the enrolment with reason unsubscribed_from_topic. Sequences under other topics carry on. |
| Tag change | Adding one of the automation's exit_tags cancels the enrolment with reason exit_tag, and removing one of its required_tags cancels it with required_tag_missing; GET /v1/automations/{id}/enrollments?status=canceled lists the enrolments that ended. Tags changed by creating or importing a contact are caught before the next step. Someone enrolled by API or event with no contact row has no tags, so no exit tag ends their sequence until they have one. |
Editing a live automation
PATCH /v1/automations/{id} changes the steps, the exits (topic_key, exit_tags, required_tags and exit_on_reply), reply_to, which sits with them because it decides whether a reply can end the sequence at all, and reenrollment. Fields left out keep their value; a null topic or reply-to, or an empty list, clears it, and any other field is refused with 422, so a caller passing trigger learns it did not apply. People already enrolled are checked against the new rules before their next step rather than all at once, so a rule edited by mistake can be put back before it has ended anyone's sequence.
Every step has an id, and an enrolment remembers the id of its next step rather than its position. steps in a PATCH replaces them all: pass back each step you keep with its id and the people on it stay on it, wherever it moves. A step with no id is new, and nobody already past it is sent it. Someone on a step you remove continues from the next step after it that you kept, or completes. An id the automation does not have is refused, so a typo cannot quietly remove a step.
GET /v1/automations/{id}/metrics gives each step's sent, delivered, opened and clicked, counting unique people and leaving out link scanners. GET /v1/conversions/metrics?automation_id= adds the conversions credited to each step. Both report by step id, so a step's figures stay with it when the sequence is edited.
Steps are read from the automation each time one is due rather than snapshotted at enrolment, so a fix to step three reaches people already partway through. A step whose variables are missing marks that enrolment failed with the reason rather than retrying: it is a definition problem, and would fail identically every time. A send refused for a reason that may clear, such as throttling or the domain's daily warm-up allowance, is retried, with the reason in last_error meanwhile; a plan limit or a missing postal address, which never clear by waiting, is given about a day before the enrolment is marked failed.
GET /v1/automations/{id} returns the definition with enrolment counts by status, and GET /v1/automations/{id}/enrollments lists the enrolments themselves, newest first and paged, filterable by status. DELETE /v1/automations/{id} stops every active enrolment, then deletes the automation together with all of its enrolment rows, active and finished, so its enrolment history is gone with it. enrollments_canceled reports how many were still active. To stop a sequence and keep the record, set its status to paused instead.