Create a campaign
/campaignsCreates a marketing campaign as a DRAFT (send it with POST /api/v1/campaigns/{id}/send). It goes to the members of the lists and segments in send_to, minus exclude, and is sent like a campaign made in the app: only to people who subscribed, never to anyone who unsubscribed, opted out of its topic or is suppressed, with the unsubscribe footer and your postal address added. It also shows in the app's Campaigns list. For one-off transactional email (receipts, password resets) use POST /api/v1/emails instead. The html is checked like an email made in the app: anything that cannot be sent safely is refused with 422 and a list of what to change, and nothing is saved.
Permission: campaigns:write · on the API key screen: Campaigns → Full access · All permissions
Body parameters
namestringYour name for the campaign (shown in the app). Not seen by recipients.
At most 255 characters.
fromstringrequiredThe sender: one of the account's sender addresses (Settings → Domains), e.g. news@yourdomain.com. Its name and reply-to are the sender address's own. The domain must be verified by the time the campaign is sent.
At least 3 characters. At most 320 characters.
subjectstringrequiredThe subject line. Merge tags such as {{ first_name }} are filled in per recipient.
At least 1 characters. At most 500 characters.
preview_textstringThe short text inbox apps show after the subject.
At most 255 characters.
htmlstringrequiredThe email as an HTML document. Merge tags ({{ first_name }}, {% if %} …) are filled in per recipient. The unsubscribe footer with your postal address is added when it is sent. The HTML is checked like an email made in the app: anything not safe in email (scripts, forms, event handlers …) is refused with 422 and a list of what to change; nothing is removed silently.
At least 1 characters. At most 1,048,576 characters.
send_tostring[]requiredThe lists and segments to send to (their ids, from GET /lists and GET /segments). Each person gets it once, however many of them they are in.
At most 15 items.
excludestring[]Lists and segments whose members are left out.
At most 15 items.
topic_idstringThe subscription topic the campaign belongs to: people who opted out of it are left out.
At most 2,000 characters.
tagsstring[]Labels for the campaign (e.g. Newsletter, Black Friday), to filter campaigns and compare them in Analytics. New names are created; names match without regard to case.
At most 10 items.
Response
objectstringrequiredOne of:
campaignAt most 2,000 characters.
idstringrequiredAt most 2,000 characters.
namestring | nullrequiredAt most 100,000 characters.
subjectstringrequiredAt most 500 characters.
preview_textstring | nullrequiredAt most 100,000 characters.
statusstringrequiredAt most 20 characters.
scheduled_atstring | nullrequiredAt most 40 characters.
sent_atstring | nullrequiredAt most 40 characters.
stopped_atstring | nullrequiredAt most 40 characters.
recipientsnumberrequiredsentnumberrequiredfailednumberrequiredtagsstring[]requiredAt most 10 items.
created_atstring | nullrequiredAt most 40 characters.