Campaigns
Audiences, a preview you should always run, and a send that cannot be recalled.
A campaign mails an audience, or a segment of it, from a marketing identity. The order is: build the audience, create the campaign as a draft, preview it, then send. Every field, status and error is in the campaigns API reference.
Audiences and contacts
POST /v1/audiences with a name creates a list. POST /v1/audiences/{id}/contacts accepts either one contact or an array of up to 5,000 of them, each with email, first_name, last_name, tags, attributes (custom properties, created on first use), status and last_active_at. Importing a list one call at a time is how a migration takes a week, so use the array. A contact exists once per workspace and can be on any number of audiences; adding an address that already exists joins it to this list rather than creating a second copy. The {id} is the audience's id from GET /v1/audiences, not its name. A name in the path answers 404 with the id to use.
status is how a migration brings the opt-outs across. unsubscribed flags the contact and suppresses the address for marketing; bounced and complained flag it and suppress it for everything. Each of the three also cancels anything already scheduled for the address and ends its automation enrolments. Send your previous provider's unsubscribed, bounced and complained lists with the matching status before the first campaign: they are the one record of who must not be mailed, and an import never resubscribes someone who opted out here. The dashboard's CSV import at /contacts/import does the same from a Mailchimp, Loops, Resend, SendGrid or Mailgun export, with a column-mapping step.
Adding someone who was not already on the audience starts any automation with a contact_added trigger for it. A single contact always does; an array does only with ?trigger_automations=true, and the response then counts automations_started. The default is off because an array is usually a migration, and a welcome sequence to a whole existing list at once is a cold blast from a domain that has never mailed those people. The dashboard's CSV import never starts them.
last_active_at is when the person was last active in your own product: a login, a session, anything that shows they still use it. Set it on the add, and keep it current with PATCH /v1/contacts/{id}. Once a day per person is plenty, since segments ask about weeks, not hours. It only moves forward, so sending an older value than the one stored changes nothing, and a retried or out-of-order update cannot make an active person look idle. It is what lets a campaign reach people who use your product but never open email; see Choosing who to mail.
POST /v1/contacts/{id}/tags with add and remove arrays changes a contact's tags across every audience, and GET /v1/contacts/tags lists the tags in use with their counts. A tag change re-checks the person's automation enrolments: adding a tag an automation exits on, or removing one it requires, ends that enrolment at once; the response is the contact with its new tags, and the ended enrolment shows in GET /v1/automations/{id}/enrollments?status=canceled.
GET /v1/audiences pages through the workspace's audiences, each with its id and contact_count, and GET /v1/audiences/{id} returns one. GET /v1/audiences/{id}/contacts pages through a list by address: pass limit (up to 100) and, while has_more is true, the next_cursor back as cursor.
Every response comes back in snake_case, the same spelling the request took: first_name and audience_ids on a contact, contact_count on an audience, total_recipients and failure_reason on a campaign. POST /v1/contacts with an audience_id is the same call as the nested one, for a caller that starts from the person.
GET /v1/audiences/{id}/contacts/export returns the whole list as CSV, streamed, with every attribute as a column (the first 100 by how many contacts carry them), and segment_id narrows it to a saved segment. The audience page has the same as an Export CSV button. The columns are the ones the import reads, so a file exported here imports again.
GET /v1/contacts?email= finds an address across every audience. DELETE /v1/audiences/{id}/contacts/{contact_id} takes someone off one list; DELETE /v1/contacts/{id} removes them from the workspace. Both keep the person's suppression and topic preferences: those belong to the person, and discarding them would mean a re-import mails someone who opted out.
Creating a campaign
POST /v1/broadcasts takes audience_id, identity_id, name, subject and html. Narrow the audience with a saved segment_id, or an inline segment of opened_within_days, clicked_within_days, exclude_unengaged_days and engaged_within_days; a saved segment wins when both are given. Pass topic_key so recipients can opt out of this kind of mail rather than everything you send. It must name a topic that exists (GET /v1/topics); an unknown key is refused with 422 unknown_topic, because it would count everyone as opted out and the campaign would reach nobody.
audience_id and identity_id are ids from GET /v1/audiences and GET /v1/domains, not the audience's name or the domain name; either answers 422 naming the id to use. The identity must be a marketing one: the domains list shows each with its risk_class, and a transactional identity is refused at creation with 422 invalid_request. A campaign is created as a draft and can be edited with PATCH /v1/broadcasts/{id} while it is still one. Once it is scheduled only its time can change, and once it has started any edit answers 409 invalid_state.
A campaign has no attachments. For images in its html, upload each one with POST /v1/media and use the url it answers in an <img src>: it is served from your own tracking hostname, which keeps every image in the message on your domain. The campaign editor in the dashboard has an Insert image button that does both steps.
Choosing who to mail
Mailing people who have stopped reading is how a domain loses its reputation. Gmail learns from how recipients treat mail from your domain, and a list of people who never open it teaches Gmail that it is unwanted. Four rules narrow a campaign by engagement, on a saved segment or an inline segment, and they are for different lists:
| Rule | Keeps | Use it for |
|---|---|---|
engaged_within_days | Contacts who opened, clicked, or were active in your product (last_active_at) within N days. Nobody else. | A new sending domain, a list imported from another provider, or a restart after a deliverability problem. |
exclude_unengaged_days | Everyone except contacts who were mailed, have been on the list for the whole window, and neither opened nor clicked. Contacts never mailed and contacts added within the window are kept. | Trimming an established list you have been mailing from this platform. |
opened_within_days | Contacts who opened within N days. | Narrow follow-ups. |
clicked_within_days | Contacts who clicked within N days. | Narrow follow-ups. |
exclude_unengaged_days keeps everyone on a list you imported recently. Its allowance for new and never-mailed contacts exists so a new signup is not dropped before their first chance to open, but every contact in a fresh import is new and never mailed. Use engaged_within_days for the first campaigns to an imported list, and check the count with the preview before sending.
Opens and clicks are only recorded for mail from a domain whose link. tracking hostname is live, and they are an imperfect measure of interest. Apple Mail opens every message it downloads and mail filtered to spam is never opened. The corporate security gateways that open every link in a message within a second of delivery are recognised and not counted (Automated clicks and opens), but one that fetches only images is counted as a reader. A person who logs in to your product every week is engaged whatever their inbox does, which is why engaged_within_days counts last_active_at too. Without last_active_at, the rule sees only opens and clicks.
A restart after a deliverability problem, to people who showed interest in the last 90 days:
Save it with POST /v1/segments and pass its id as segment_id, or build it in the dashboard: each audience page has a Segments section with every rule on this page and a count that updates as you change them, and the new-campaign form can send to one. Rules combine with AND, so adding tags or topic_key narrows it further.
date_conditions select on dates relative to the moment the audience is resolved: created_at, last_opened_at, last_clicked_at, last_active_at, or a date stored on the contact as attributes.<key>. Each is { "field", "op", "days" } with op one of older_than_days, within_last_days, within_next_days and after_next_days, so "trial ends in the next 7 days" is { "field": "attributes.trial_ends_at", "op": "within_next_days", "days": 7 }. A contact without the date, or with one that cannot be read as a date, never matches, whatever the operator. For a sequence that should start on its own as each date comes up, use an automation's date trigger instead. A new marketing domain's warm-up still paces what is sent each day, however small the segment is.
Preview first
GET /v1/broadcasts/{id}/preview returns recipient_count, the number who will actually receive it after suppressed addresses and topic opt-outs are removed, beside resolved_count and suppressed_count, a sample of addresses, and can_send. resolved_count is the audience or segment with topic opt-outs already taken out, and the gap between it and recipient_count is suppressed_count: the addresses suppressed for marketing, by an unsubscribe, a hard bounce or a complaint. That is the number worth seeing before a send. Topic opt-outs are already out of resolved_count and are not counted separately.
can_send is the reputation gate, and for an A/B test also the sample floor described below. Once a workspace has sent a thousand messages in the last fourteen days, a bounce rate above 4% (permanent bounces only) or a complaint rate above 0.08% over that window refuses the campaign, and blocked_reason says which and what to do about it. The gate sits in the send path rather than on a dashboard because its whole point is to refuse the send that would tip the account over. can_send does not cover the plan allowance, the domain's verification or warm-up, a missing postal address or a suspended workspace.
Preview is a separate call on purpose: nobody should discover the size of a 200k campaign by starting it.
Sending
POST /v1/broadcasts/{id}/send with an empty body starts it now and returns 202 with status: "sending". With scheduled_at, a UTC ISO 8601 timestamp such as 2026-09-16T09:00:00.000Z rather than the relative phrases POST /v1/emails accepts, it returns 202 with status: "scheduled". The fan-out runs in the background, because a large send takes far longer than any HTTP timeout; poll GET /v1/broadcasts/{id} for progress and GET /v1/broadcasts/{id}/recipients for what happened to each message.
Once started it cannot be recalled. The reputation gate runs again at send time, and a claim on the row means two callers cannot both start the same campaign. A campaign the gate refuses at that point is marked failed, with the reason in failure_reason, and so is one whose sending domain is not verified. A scheduled campaign can be moved with another send call carrying a new scheduled_at (the response is the campaign at its new time), or with PATCH /v1/broadcasts/{id} and only scheduled_at; PATCH with scheduled_at: null returns it to an editable draft. DELETE /v1/broadcasts/{id} removes a campaign in any status but sending, which answers 409 invalid_state. That includes a draft or a scheduled one, but also one that is paused, testing, sent or failed: the campaign and its frozen recipient list are deleted, so a paused campaign never resumes and a test never sends its remainder.
A campaign is held to the guardrails of the API key that sends it. A key that holds its sends for approval, or one with a recipient allowlist, cannot send, schedule, reschedule or resume a campaign, or decide an A/B test's winner (403 forbidden): a campaign cannot wait for an approval, and an audience cannot be narrowed to an allowlist without becoming a different audience. A key with a daily limit is charged once for each campaign it puts on its way, whoever scheduled it: sending or scheduling a draft counts the recipients as the preview counts them, and starting a scheduled campaign early, moving it earlier, resuming it or deciding its winner counts what is still to send, unless that key already paid for the campaign. When those recipients do not fit what is left of its limit today, the call is refused with 429 daily_limit. A guarded key can still create, edit and preview a draft, and a person can send it from the dashboard, where key guardrails do not apply. See Keys with guardrails.
A campaign larger than the day's remaining sending quota is not refused. It sends what it can and stops as paused, with its audience frozen and every address it reached marked. GET /v1/broadcasts/{id} then carries a progress object of pending, sent, failed and skipped; a campaign that is not in flight has progress: null. It continues on its own once the quota window frees up. POST /v1/broadcasts/{id}/resume continues it at once, but does not wait for quota: called while the quota is still used up, it pauses again. Resuming only ever mails addresses still pending, so calling it twice is harmless. A campaign from a new sending domain also pauses on the domain's daily warm-up allowance; resume_after on the campaign says when that renews (the next 00:00 UTC), it continues on its own then, and a resume before that is refused. A campaign paused because sending was suspended for the workspace, or because it has no postal address, also continues on its own once that is put right. pause_reason says which of these, or another pause described in the API reference, applies.
Permission is re-checked at each address's turn rather than at the freeze, so somebody who unsubscribes on day two of a long send is skipped on day three rather than mailed.
Web version and "View in browser"
Every campaign from a domain whose link. tracking hostname is live has a web version: a public page at web_version_url on the campaign, served on that same hostname. It shows the campaign's HTML as you wrote it, without the unsubscribe footer, tracked links or the open pixel that each message gets, so it is the same page for everyone and safe to share on your site or social accounts. Scripts in the HTML do not run there, as they do not in a mail client. web_version_url is null while the domain has no live tracking hostname.
Set view_in_browser: true when you create or update the campaign to open every message with a small "View this email in your browser" link to that page. It is placed at the top of the body, after a hidden preheader if the body starts with one, so the inbox preview text stays yours. It is off by default, and is refused with 422 invalid_request while the domain has no live tracking hostname. See the campaign object.
UTM tags
Turn on utm_tags for a sending domain (PATCH /v1/domains/{id}, or the Domains page) and every link in its marketing HTML gets utm_source (default newsletter), utm_medium (default email) and utm_campaign, which is the campaign's name or the automation's slug. A link that already carries any utm_ parameter is left exactly as you wrote it, and the unsubscribe and preference links are never touched. The tags go on before click tracking, so the tracked link redirects to the tagged address and your analytics see the same campaign SendRaven reports. Transactional mail is left alone unless you include it.
Testing subject lines, from names and send times
Pass variants, two to ten of them, each with a key you name and any of subject, from_name or send_at, and the campaign becomes an A/B test. Anything a variant leaves unset falls back to the campaign's own value, so a subject test is two variants with two subjects and nothing else. ab_test tunes it: metric is open (default), click or conversion (with an optional goal_id), sample_share is the fraction of the audience in the test (default 0.2), and decide_after_minutes (default 240) is how long to wait after the sample is fully sent before deciding.
The send goes in two phases over one frozen audience. Each address is assigned to a variant, or to the remainder, by a hash of the campaign and the address, split evenly across the variants. The sample goes out, the campaign sits in testing, and when the clock runs out the variant with the best unique open, click or conversion rate gets the rest. GET /v1/broadcasts/{id} carries ab_test.results with sent, opened, clicked and their rates per variant, live, and decide_at. POST /v1/broadcasts/{id}/winner decides early, with variant to pick a key yourself or an empty body to let the metric decide; only a testing campaign accepts it.
Every variant needs at least 100 recipients in the sample, or the campaign is marked failed when it starts, with the shortfall in failure_reason. GET /v1/broadcasts/{id}/preview reports ab_test.per_variant against that floor before you commit. A test that finds nothing, no opens on any variant or a tie, sends the remainder to the first variant, which is why the first one should be your control.
A send-time test sets send_at on every variant. There is no sample and nothing held back: the whole audience is split across the variants and each goes out at its own time, the campaign returning to scheduled between them. After the last one it waits in testing for decide_after_minutes, records a winner for the report, and becomes sent. scheduled_at on the send call is refused for one of these, because the variants own the clock.
metric: "conversion" decides on the share of each variant's recipients with a conversion credited to it, so it measures revenue rather than curiosity. A purchase follows the click by hours or days, so give it a decide_after_minutes of 1440 or more; a shorter wait carries a warning, because the test would read mostly people who have not converted yet.
metric: "click" and metric: "conversion" need click tracking live on the campaign's sending domain: the link. CNAME from the Domains page, or click_tracking.status on GET /v1/domains. The campaign's warnings array says so on every response, whether tracking is live or not, and without tracking every variant shows zero clicks and the first variant wins by default.
Refused whole, not sent partly
On Free, the allowance is checked against the real recipient list, after suppression and before a single message goes out. A campaign larger than what remains this month is marked failed with the reason in failure_reason, and nothing is sent. A half-delivered campaign cannot be re-run without mailing the first half twice, and nobody can tell from the outside who received it: better to refuse 500 than to send 200 and leave that mess. Check GET /v1/usage first, then activate paid sending or narrow the audience. The same check refuses a campaign from a workspace with no verified payment method, one whose payment has failed for good, or one that has reached its own monthly budget. A paid workspace's volume is priced, never refused.
Campaigns go out on the marketing identity
Every message in a campaign is sent as marketing, from a marketing sending domain (conventionally a news. subdomain) with its own reputation, and a campaign pointed at a transactional identity is refused when it is created. That separation is what stops a campaign's complaint rate from affecting password reset delivery. Marketing mail also carries the one-click unsubscribe headers and a footer with an unsubscribe link and your postal address.
Set the postal address in Settings before the first campaign. Without one, marketing mail is refused: POST /v1/emails, POST /v1/broadcasts/{id}/send and POST /v1/broadcasts/{id}/resume all answer 422 no_postal_address. A campaign whose address is removed while it is sending pauses before its next batch rather than mailing anyone without the footer, and continues on its own once an address is set again.