Campaigns

Create a campaign

POST/campaigns

Creates 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

  • namestring

    Your name for the campaign (shown in the app). Not seen by recipients.

    At most 255 characters.

  • fromstringrequired

    The 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.

  • subjectstringrequired

    The subject line. Merge tags such as {{ first_name }} are filled in per recipient.

    At least 1 characters. At most 500 characters.

  • preview_textstring

    The short text inbox apps show after the subject.

    At most 255 characters.

  • htmlstringrequired

    The 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[]required

    The 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_idstring

    The 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

  • objectstringrequired

    One of: campaign

    At most 2,000 characters.

  • idstringrequired

    At most 2,000 characters.

  • namestring | nullrequired

    At most 100,000 characters.

  • subjectstringrequired

    At most 500 characters.

  • preview_textstring | nullrequired

    At most 100,000 characters.

  • statusstringrequired

    At most 20 characters.

  • scheduled_atstring | nullrequired

    At most 40 characters.

  • sent_atstring | nullrequired

    At most 40 characters.

  • stopped_atstring | nullrequired

    At most 40 characters.

  • recipientsnumberrequired
  • sentnumberrequired
  • failednumberrequired
  • tagsstring[]required

    At most 10 items.

  • created_atstring | nullrequired

    At most 40 characters.