Skip to main content

Campaigns

A campaign is an email you send to a selection of contacts in your account.

Overview​

Each campaign has a name, a status that tracks where it is in its lifecycle, and the details of the message to send — its subject, preview text, sender, and audience. A campaign starts as a draft and is built up incrementally across update calls. It can also start from a template — see Creating from a template.

Endpoints​

MethodEndpointDescription
GET/campaignsList campaigns
POST/campaignsCreate a campaign
GET/campaigns/{uuid}Get a campaign
PATCH/campaigns/{uuid}Update a campaign
DELETE/campaigns/{uuid}Delete a campaign
POST/campaigns/{uuid}/sendSend a campaign now
POST/campaigns/{uuid}/testSend a test email
POST/campaigns/{uuid}/scheduleSchedule a campaign
POST/campaigns/{uuid}/unscheduleUnschedule a campaign
POST/campaigns/{uuid}/cancelCancel a campaign
GET/campaigns/{uuid}/contactsList a campaign's live audience
GET/campaigns/{uuid}/recipientsList who a campaign was sent to
GET/campaigns/{uuid}/link-clicksList a campaign's link clicks

Statuses​

A campaign's status tracks where it is in its lifecycle:

StatusMeaning
draftBeing edited. Not scheduled or sent.
scheduledScheduled to send at a future time.
queuedQueued for sending.
sendingCurrently being sent.
sentFully sent.
failedSending did not complete successfully.
canceledCanceled before it finished sending.

A/B test campaigns​

An A/B test sends two versions of a campaign to a share of its audience, picks the better one, and sends that version to everyone else. You can test the subject line, the preheader, or both. Variant A is the campaign's own subject and preheader; variant B's values and the test settings live in the ab_test object.

Setting up a test​

Send ab_test on Create Campaign or Update Campaign:

{
"subject": "Free shipping all weekend",
"ab_test": {
"b_subject": "Free shipping ends Sunday"
}
}

The object is merged onto the campaign's stored test: keys you send change, and keys you leave out keep their values. The exception is the winner schedule: switching winner_schedule_type to at_time clears duration_hours, switching it to after_hours clears winner_at, and an after_hours test without a duration_hours gets 24 unless you send one. b_subject, b_preheader, duration_hours, and winner_at can be sent as null to clear them; the other keys can't be null. Send ab_test: null to remove the test. On a campaign without a test the merge starts from these defaults:

FieldDefault
test_subjecttrue if you sent a non-null b_subject, otherwise false
test_preheadertrue if you sent a non-null b_preheader, otherwise false
pool_percent20
winner_criteriaclicks
winner_schedule_typeafter_hours
duration_hours24

So {"b_subject": "…"} alone sets up a complete subject test. If both test_subject and test_preheader end up false, an existing test is removed; on a campaign without a test that's rejected with 422 VALIDATION_ERROR on ab_test. Each field is described in A/B Test Object.

A test can be saved before it's complete, so you can build it up over several requests: a tested field without a B value, at_time without winner_at, or after_hours with duration_hours sent as null, is saved, and readiness.missing lists ab_test until the test is complete. Out-of-range values return 422 VALIDATION_ERROR on the offending key, such as ab_test.pool_percent, and keys other than the nine writable fields of the A/B Test Object return The ab_test field must be an object with only these keys: test_subject, test_preheader, b_subject, b_preheader, pool_percent, winner_criteria, winner_schedule_type, duration_hours, winner_at. on ab_test. A rejected ab_test changes nothing: on create, no draft is created; on update, no other field is saved either.

Winner time​

For at_time, winner_at must be at least 1 hour and at most 72 hours after the send time. The send time is the campaign's scheduled_at when it is in the future, otherwise now.

  • An Update Campaign or Create Campaign request that sends winner_at or winner_schedule_type returns 422 VALIDATION_ERROR on ab_test.winner_at when the winner time doesn't fit that window. A stored winner_at that no longer fits doesn't block changes to other ab_test keys.
  • Sending or scheduling when the stored winner_at doesn't fit the new send time returns 409 CAMPAIGN_NOT_SENDABLE with the message The winner time must be at least 1 hour and at most 72 hours after the send time. The campaign is left unchanged: a scheduled campaign keeps its status and scheduled_at.

How a test runs​

The test's progress is in ab_test.phase:

PhaseMeaning
configuredSet up; no test email has gone out yet.
testingThe test emails to variants A and B are going out.
choosing_winnerThe test emails are out; waiting for the winner to be picked.
sending_winnerThe winner is picked and its send to the rest of the audience has started. The phase stays sending_winner after that send finishes.

While the test runs:

  • status stays sending from the first test email until the winner send finishes. That includes a wait of up to 72 hours after the test emails go out, plus however long the winner send itself takes.
  • recipients_count is the size of the test group until the winner is picked, then grows to the full total. The recipient list grows in the same two steps: first the test group (variant a and b), then the rest of the audience (variant winner).
  • subject and preheader are variant A's. Results per variant are in ab_test.variants.
  • Canceling during the wait stops the winner send.

After the test has started​

Once ab_test.phase is anything other than configured, the test can't be changed or run again:

  • Update Campaign rejects every change to the campaign — not only to ab_test — with 409 CAMPAIGN_NOT_EDITABLE and the message Campaign cannot be edited because its A/B test has already started. This holds even when the campaign's status is failed.
  • The campaign can't be sent or scheduled again. While it is sending its status already rules that out; if it ends up failed, readiness.missing lists ab_test_started, and Send Campaign and Schedule Campaign return 409 CAMPAIGN_NOT_SENDABLE with a message saying the A/B test has already started.

Audience size​

An A/B test needs at least 3 contacts in the audience — enough for variant A, variant B and the winner. A smaller audience lists ab_test_audience in readiness.missing, and sending or scheduling returns 422 CAMPAIGN_NOT_READY. The check uses the audience at the moment you ask, so a scheduled campaign whose audience drops below 3 before its send time ends up failed.

Testing a variant​

Send a Test Email can preview either variant — see A/B test variants.

Editing and deleting by status​

Which write operations a campaign allows depends on its status:

  • A campaign can be updated only while its status is draft, scheduled, or failed. Updating a campaign in any other status returns 409 CAMPAIGN_NOT_EDITABLE. A campaign whose A/B test has started follows its own rule — see After the test has started.
  • A campaign can be deleted only while its status is draft, sent, failed, or canceled. Deleting a campaign in any other status returns 409 CAMPAIGN_NOT_DELETABLE.

Sending lifecycle​

Which lifecycle transition a campaign allows also depends on its status:

  • A campaign can be sent (Send Campaign) or scheduled (Schedule Campaign) only while its status is draft, failed, or scheduled, and only once it is ready (see Readiness). Any other status returns 409 CAMPAIGN_NOT_SENDABLE, and a campaign that is not ready returns 422 CAMPAIGN_NOT_READY.
  • A scheduled campaign can be unscheduled (Unschedule Campaign), returning it to draft. Any other status returns 409 CAMPAIGN_NOT_UNSCHEDULABLE.
  • A queued or sending campaign can be canceled (Cancel Campaign). Any other status returns 409 CAMPAIGN_NOT_CANCELABLE. A scheduled campaign is unscheduled, not canceled.

While one of these transitions is being processed for a campaign, a concurrent transition on the same campaign returns 409 CAMPAIGN_TRANSITION_IN_PROGRESS; retry after a moment.

To see who a campaign would send to right now, list its live audience with List Campaign Contacts. To see who a sent campaign was actually sent to and how each recipient engaged, use List Campaign Recipients.

Active plan required​

An account can only send while it has an active plan. Send Campaign, Schedule Campaign, and Send a Test Email return 403 PLAN_INACTIVE when the account is not allowed to send: it has no active plan, it has been deactivated, or sending has been disabled for it by support. The same code is returned in all three cases.

A refused call leaves the campaign untouched — its status, schedule, and content are unchanged, and no email goes out. Repeating the request returns the same error until the account owner activates a plan or contacts support; changing the request does not resolve it.

When the account's plan cannot be verified, the same three calls return 503 SERVICE_UNAVAILABLE, leaving the campaign untouched in the same way. This one is temporary and needs no action from the account owner — retry the request, with backoff.

Sending a test​

Send a Test Email sends a one-off preview to a single address without changing the campaign's status, reaching its audience, or recording recipients, so it works from any status. It needs only a subject, a body, and a sender identity.

Audience​

A campaign's audience is a contact list, a contact segment, or both. You set it with the list_uuid and segment_uuid fields on Create Campaign and Update Campaign, and read it back in the audience object:

FieldTypeDescription
list_uuidstring|nullUUID of the contact list the campaign sends to. null when not set.
segment_uuidstring|nullUUID of the contact segment the campaign sends to. null when not set.

With a segment, the campaign sends to the contacts matching the segment's conditions — and when a list is also set, only to those in the list. A segment must have at least one filter condition. Setting segment_uuid replaces any filter conditions already on the campaign, and sending segment_uuid: null removes the segment and its conditions. On Update Campaign, setting list_uuid changes only the list: a segment and its conditions stay. Creating from a template follows its own rule — see Creating from a template.

A list_uuid or segment_uuid that does not belong to your account, or a segment with no filter conditions, is rejected with 422 VALIDATION_ERROR.

Filter conditions saved in the dashboard are also part of the audience, but the API does not return them. A campaign with only those conditions reports null for both fields, and does not list audience in missing. List Campaign Contacts shows who it would send to.

Readiness​

Every single-campaign response carries a readiness object describing whether the campaign is ready to send:

FieldTypeDescription
can_sendbooleantrue only when every requirement is met (missing is empty).
missingarrayThe requirements not yet met.

Each entry in missing names a requirement and how to satisfy it:

RequirementHow to satisfy
from_nameSet from_name on the campaign.
sender_emailSet from_identity to a sender identity.
sender_enabledThe campaign's sender identity is not ready to send from. See Sending readiness.
subjectSet subject on the campaign.
contentSet the email body with the content field (Markdown) on Create Campaign or Update Campaign, or build it in the dashboard. See Campaign body.
audienceSet list_uuid and/or segment_uuid. A campaign whose segment's conditions are not applied to it also lists audience, with or without a list, and can't be sent — send segment_uuid again to apply them. See Audience.
audience_filtersThe campaign's audience filters reference a custom field that no longer exists. Edit them so they no longer reference it.
ab_testThe campaign's A/B test is incomplete: a tested field has no B value, winner_schedule_type is at_time without a winner_at, or after_hours without a duration_hours. Complete it with ab_test on Update Campaign, or remove the test with ab_test: null. See A/B test campaigns.
ab_test_audienceThe campaign has an A/B test but fewer than 3 contacts in its audience. Grow the audience or remove the test with ab_test: null. See Audience size.
ab_test_startedThe campaign's A/B test has already started, so the campaign can't be sent or scheduled again. See After the test has started.

New requirements can be added to this list. Treat a value you don't recognize as a requirement that is not yet met: can_send stays false until it drops out of missing.

A campaign with no body lists content in missing, and can_send reports false until the body is set. Once a body is set, content drops out of missing.

Campaign Object​

Create, Get, and Update return the full campaign object:

FieldTypeDescription
uuidstringUnique identifier for the campaign
namestringCampaign name
statusstringCurrent status (see Statuses)
subjectstring|nullEmail subject line. null until set. On an A/B test campaign, variant A's.
preheaderstring|nullPreview text shown after the subject in the inbox. null until set. On an A/B test campaign, variant A's.
from_namestring|nullSender display name. null until set.
reply_tostring|nullReply-to email address. null until set.
from_identitystring|nullUUID of the sending identity the campaign sends from. null until set.
from_emailstring|nullEmail address of the selected sending identity. null when no identity is set.
contentstring|nullThe email body as Markdown, or null — either no body is set, or the body uses layout with no Markdown form (distinguish via content_editable_via_api). See Campaign body.
content_editable_via_apibooleanfalse when the body uses layout the API can't author (see Campaign body).
content_overwrite_requiredbooleantrue when replacing the body with content requires overwrite: true (see Campaign body).
audienceobjectThe campaign's recipients (see Audience).
ab_testobject|nullThe campaign's A/B test settings and state, or null without a test (see A/B Test Object).
readinessobjectWhether the campaign is ready to send (see Readiness).
created_atstringISO 8601 timestamp (UTC)
updated_atstringISO 8601 timestamp (UTC) the campaign itself last changed, such as an edit or a status change. Messages being sent, opened, or clicked don't change it.
last_updated_atstring|nullISO 8601 timestamp (UTC) the campaign was last edited.

The List Campaigns endpoint returns a condensed version of each campaign: it omits preheader, reply_to, from_identity, from_email, content, content_editable_via_api, content_overwrite_required, audience, readiness, and last_updated_at, and instead includes language, scheduled_at, and recipients_count. Its ab_test is a short summary — phase, winner_variant, and winner_at — or null (see A/B Test Summary Object).

A/B Test Object​

ab_test is null for a campaign without an A/B test. Otherwise it holds the settings you write with ab_test on Create Campaign and Update Campaign — see Setting up a test — and the test's current state. Variant A is the campaign's own subject and preheader, so only variant B's values appear here. The first nine fields are the ones you can write; the rest are read-only.

FieldTypeDescription
test_subjectbooleanWhether the subject line is tested. When true, variant B uses b_subject.
test_preheaderbooleanWhether the preheader is tested. When true, variant B uses b_preheader.
b_subjectstring|nullVariant B's subject line (max 255 characters). null until set.
b_preheaderstring|nullVariant B's preheader (max 255 characters). null until set.
pool_percentintegerShare of the audience, in percent, that gets the test emails, split evenly between A and B — an even number from 2 to 98. The rest of the audience gets the winner.
winner_criteriastringHow the winner is picked: clicks (higher click rate — unique clickers per send) or open_rate (higher open rate).
winner_schedule_typestringWhen the winner is picked: after_hours (duration_hours after the test emails finish going out) or at_time (at winner_at).
duration_hoursinteger|nullHours between the test emails finishing and the winner pick, from 1 to 72. Used with after_hours; null for at_time.
winner_atstring|nullWhen the winner is picked, as an ISO 8601 timestamp (UTC). For at_time, the time you set — send it as an ISO 8601 instant with an explicit offset or Z, within the winner time window. If the test emails haven't finished an hour before that time, the pick moves to one hour after they finish, and winner_at changes to match. For after_hours, null until the test emails finish, then the computed pick time.
phasestringconfigured, testing, choosing_winner, or sending_winner. See How a test runs.
test_audience_countinteger|nullNumber of contacts in the full audience when the test was split — not the size of the test group. null until the test starts.
winner_variantstring|nullThe variant that won, a or b. null until the winner is picked.
test_finished_atstring|nullISO 8601 timestamp (UTC) the test emails finished going out. null until then.
winner_chosen_atstring|nullISO 8601 timestamp (UTC) the winner was picked. null until then.
variantsarrayResults per variant. Only present on Get Campaign with include=stats. See Variant Object.

Variant Object​

ab_test.variants lists the results per variant, in the order a, b, winner, with an entry only for variants that have started sending — the array is empty before the test starts. The campaign's top-level stats add up variant A, variant B and the winner send. See Get Campaign for an example.

FieldTypeDescription
variantstringa, b, or winner (the winning version sent to the rest of the audience).
subjectstring|nullThe subject line this variant was sent with. null when it isn't recorded.
preheaderstring|nullThe preheader this variant was sent with. null when it had none.
sendsintegerMessages of this variant sent.
opensintegerDistinct recipients of this variant who opened.
clicksintegerDistinct recipients of this variant who clicked — counted the same way as stats.clicks.
open_ratenumberopens ÷ sends, a ratio between 0 and 1 rounded to 4 decimals (0 when nothing was sent).
click_ratenumberclicks ÷ sends, a ratio between 0 and 1 rounded to 4 decimals (0 when nothing was sent).
decisionobject|nullThe sends, opens, clicks, open_rate, and click_rate frozen when the winner was picked — the numbers the pick was based on. null for winner and before the pick.

Campaign body​

The campaign body is the email's content. Set it with the content field on Create Campaign and Update Campaign, read it back in the content field, and send content: null to clear it. The body can also be edited in the dashboard.

Writing the body​

content is a Markdown string, up to 65000 characters. Supported:

  • Headings (levels 1–6)
  • Bold and italic text
  • Links — http, https, mailto, tel, sms, or whatsapp
  • Bullet and numbered lists
  • Blockquotes
  • Fenced and indented code blocks
  • Images
  • Horizontal rules (---)
  • Hard line breaks

Tables, strikethrough, task lists, inline `code`, and raw HTML are not supported — they are silently dropped or flattened to plain text, so stick to the supported subset.

Reading the body back​

content returns the stored body as Markdown, or null when no body is set or the body uses layout that has no Markdown form. Two flags describe whether that body can be rewritten through the API:

FieldTypeDescription
content_editable_via_apibooleanfalse when the body uses layout the API can't author (multi-column layouts, social-icon rows, countdown timers); the returned content is then a lossy approximation.
content_overwrite_requiredbooleantrue when the existing body carries formatting Markdown can't preserve — the layout above, or styling such as custom colors, fonts, buttons, or styled images.

When both flags are false, the body is plain enough to overwrite freely.

Overwriting a richer body​

To replace a body that reports content_overwrite_required: true, set overwrite: true on your Update Campaign call — this permanently discards the existing styling or layout. The same applies on Create Campaign when content replaces a body copied from a template. Without it, the write is rejected with 409 CONTENT_OVERWRITE_REQUIRED. A body that is content_editable_via_api: false can only be changed by editing it in the dashboard, or by passing overwrite: true to replace it with Markdown.