Skip to main content
CampaignsVersion: v3New

Create Email Campaign

POST/emails/locations/{locationId}/campaigns/emails

Create a draft email campaign: an email you intend to send to contacts, in the code (html), plain-text (text) or design (builder) editor: blank, from an existing template (templateId), or with initial editorContent. Then set content, subject and sender with Update Email Campaign and send with Schedule Campaign. For a reusable design that is not sent by itself, or when the user asks for a template, use Create an email template instead; a campaign can later start from it with templateId. A/B versions of a campaign are made with Upsert A/B Variation, not by creating another campaign.

Authorizations

Authorizationstringheaderrequired

Bearer authentication header of the form Bearer <token>, where <token> is your access token.

Scope:emails/campaigns.write
Auth methods:OAuthPrivate Integration
Token type:Sub-Account Token

Request​

Headers

Idempotency-Keystring

Unique key per intended write (max 255 chars). Retrying with the same key and body within 24 hours returns the first response instead of creating another resource. Reusing the key with a different body returns 422; a retry while the first request is still running returns 409.

Example:0f8fad5b-d9cb-469f-a165-70867728950e
Versionstringrequired

API Version

Available optionsv3
Example:v3

Path Parameters

locationIdstringrequired

Location ID

Example:ve9EPM428h8vShlRW1KT

Body

namestringrequired

Campaign name

Example:Untitled campaign name
editorTypestringrequired

Editor type for the campaign content. html = code editor (raw HTML string), text = plain-text email (string), builder = design (drag-and-drop) editor (JSON, see BuilderEditorContentPublicV2Dto). Merge fields are Handlebars: {{contact.first_name}}, a fallback is {{default contact.first_name "there"}}, a condition is {{#if contact.city}}...{{/if}}. Liquid filters such as {{contact.first_name | default: "there"}} are not supported and block the send. Send editorType alone (optionally with templateId) to create a blank or from-template campaign.

Available optionshtmlbuildertext
Example:html
templateIdstring

Existing template ID to create the campaign from. Omit this field to create a blank campaign.

Example:507f1f77bcf86cd799439011
editorContentobject

Optional initial editor content to persist immediately after campaign creation: an HTML or plain-text string for html/text, or design-editor JSON for builder. Design-editor (builder) JSON. elements is the layout tree: mj-section > mj-column > leaf elements. Every node has a unique id and a tagName. attrs is a flat map keyed by node id (one entry for every node in the tree, sections and columns included): { tagName, content, attributes: [{ name, default, unit? }] }. content holds the text/HTML of leaf elements such as mj-text and mj-button. Each attribute is { name, default, unit? }: default is the value, and sizes are a number plus unit (px or %), e.g. { name: "font-size", default: 16, unit: "px" }. Padding is split into padding-top, padding-right, padding-bottom and padding-left with enable-padding set to true; the padding shorthand and inline style are not read by the editor. Send the full attribute set below for every element, changing only the values you need. When an element is selected in the editor, every listed attribute missing from the JSON is written in with the default shown here, so a partial list changes the design (background, padding, font) on first click. Text and image backgrounds use container-background-color; section and button backgrounds use background-color. Element attributes and the editor defaults: mj-section: enable-padding=true, padding-top=10px, padding-right=20px, padding-bottom=10px, padding-left=20px, background-color=#ffffff, background-url="", background-size=auto, background-repeat=repeat, full-width=false, text-align=center, border-radius=0px, border-width=0px, border-color="". mj-column: enable-padding=true, padding-top=0px, padding-right=0px, padding-bottom=0px, padding-left=0px, is-unstacked=false. mj-text: enable-padding=true, padding-top=12px, padding-right=24px, padding-bottom=12px, padding-left=24px, font-family=arial, helvetica, sans-serif, font-size=14px, line-height=1.5, container-background-color="". mj-image: enable-padding=true, padding-top=10px, padding-right=20px, padding-bottom=10px, padding-left=20px, src=https://..., alt="", href="", width=null, height=null, align=center, border-radius=0px, container-background-color="". mj-button: enable-padding=true, padding-top=10px, padding-right=20px, padding-bottom=10px, padding-left=20px, background-color=#00a4bd, color=#ffffff, font-family=Ubuntu, Helvetica, Arial, sans-serif, font-size=14px, align=center, border-radius=6px, border-width=0px, border-color=#00a4bd, redirectAction=url, url="". mj-divider: enable-padding=true, padding-top=10px, padding-right=20px, padding-bottom=10px, padding-left=20px, border-width=2px, border-color=#99acc2, border-style=solid, width=100%, align=center. mj-spacer: height=20px, container-background-color="". Buttons are mj-button elements (text in content, colors and link in attributes). mj-text content is edited as rich text and keeps only paragraphs, headings <h1>-<h6>, text-align, <span style> font/size/color, <strong>, <em>, <u>, <s>, links <a href>, lists and <br>; other markup (a link styled as a button with background or padding, tables, <div>, block styles) renders in the email but the editor drops it on edit, so the canvas shows something different from what is sent. Images: mj-image needs src set to a public https URL of the image (upload a file first with the Medias API and use its URL); without src the editor shows a placeholder. Set alt for accessibility and href to make the image a link. Leave width and height as null for the natural size (capped to the column) or set a number with unit: "px"; never omit them or send "". templateSettings holds template-wide theme settings as lists of { name, default, unit? } grouped by body (width, background-color, body-color, border, background image), button, divider, text (fonts, line-height, link styles) and header (customCss). To keep the current theme, send back the templateSettings that Get returned. Text fonts: inside mj-text content set font-family, font-size and color on a <span style="..."> around the text (e.g. <h1><span style="font-family: georgia, palatino, serif; font-size: 32px">Title</span></h1>); the editor toolbar reads fonts only from these spans, so styles on <h1>/<p> themselves show as the default font and size. Use one of these exact font-family values: arial, helvetica, sans-serif, helvetica, arial, sans-serif, verdana, geneva, sans-serif, georgia, palatino, serif, 'times new roman', times, serif, 'trebuchet ms', geneva, sans-serif, 'arial black', sans-serif, 'andale mono', monospace, Ubuntu, Helvetica, Arial, sans-serif. Google fonts: use 'Font Name', <fallback from the list above> (quotes only when the name has a space) and list every Google font used in templateSettings.text as { name: "custom-fonts", default: "Font One;Font Two" }; fonts not listed there are not loaded and fall back. Brand-board fonts: use 'Brand Font Name', <fallback> and list their brand font ids in { name: "brand-custom-fonts", default: "id1;id2" }. Keep both entries when sending back templateSettings. Supported leaf tags: mj-text, mj-image, mj-logo, mj-button, mj-divider, mj-spacer, mj-social, mj-video, mj-raw, mj-footer, mj-accordion, mj-carousel, mj-countdown-timer, mj-form, mj-product, mj-shopping-cart, mj-review-link, mj-rss-header, mj-rss-item, mj-preview-url. For tags not listed above, copy an existing element of that tag from a Get response. Buttons link through redirectAction (url, mail, telephone, sms, skype, other, file) plus the attribute it names, e.g. { name: "redirectAction", default: "url" } with { name: "url", default: "https://..." }; href alone renders no link. Nodes without an attrs entry are skipped when rendering. Merge fields are Handlebars: {{contact.first_name}}, a fallback is {{default contact.first_name "there"}}, a condition is {{#if contact.city}}...{{/if}}. Liquid filters such as {{contact.first_name | default: "there"}} are not supported and block the send.

Example:<html><body>Hello World</body></html>
parentFolderIdstring

Parent folder ID

Example:67f15c2ae99226d5bcccb8f0
timeZonestringrequired

Timezone for the campaign

Example:Asia/Kolkata
userIdstringrequired

ID of the user performing this action

Example:507f1f77bcf86cd799439099
userNamestring

Name of the user performing this action

Example:John Doe

Response

Success

idstringrequired

Campaign ID

Example:67f15c2ae99226d5bcccb8f3
sourcestring

Source of the campaign

Example:email-campaign
sourceIdstring

Source ID of the campaign

Example:bulkRequest_abc123
namestring

Campaign name

Example:February Newsletter
statusstring

Campaign status. Status lifecycle: draft (created, editable) → Schedule Campaign → scheduled (waiting for sendAt or the next batch) → processing (sending) → sent. RSS campaigns have no scheduled state: while active, including between feed checks, they report processing or the status of their latest send. failed = sending errored. Pause Email Campaign: scheduled/processing → paused; Resume Email Campaign: paused → processing. Cancel Email Campaign: scheduled/processing/paused → cancelled. draft, paused and cancelled campaigns can be (re)scheduled with Schedule Campaign. archived = archived campaign (any underlying status).

Available optionsallsentfailedarchiveddraftprocessingscheduledcancelledpaused
Example:sent
campaignTypestring

Campaign type

Example:bulk-email
campaignCategorystring

Campaign category

Example:email-campaign
variationsobject[]

AB test variation identifiers (available only for AB test campaigns)

deletedbooleanrequired

Whether the campaign is deleted

Example:false
createdAtstringrequired

Created at timestamp

Example:2025-07-24T11:55:43.598Z
updatedAtstringrequired

Last updated timestamp

Example:2026-02-09T04:49:12.322Z
editorContentUrlstring

URL of the rendered campaign HTML after this write. Issue a GET against it to see the result; a new URL is issued on every content save.

Example:https://firebasestorage.googleapis.com/v0/b/bucket/o/index.html?alt=media&token=abc
traceIdstring

Trace ID of request

Example:019e4ef5-a65e-4198-8cf9-8e93dca9bda4