Skip to main content

Create Campaign

Create a new campaign in your account.

A campaign is always created as a draft. Only name is required; any other fields you include are applied to the draft in the same request, and you can fill in the rest later with Update Campaign.

Request​

POST /campaigns

Request Body​

ParameterTypeRequiredDescription
namestringYesCampaign name (max 255 characters)
template_uuidstring|nullNoUUID of a template to pre-fill the draft from. See Creating from a template. null is the same as leaving it out.
subjectstring|nullNoEmail subject line (max 255 characters)
preheaderstring|nullNoPreview text shown after the subject in the inbox (max 255 characters)
from_namestring|nullNoSender display name (max 255 characters)
reply_tostring|nullNoReply-to email address. See Email Address Format.
from_identitystring|nullNoUUID of a sender identity to send from
list_uuidstring|nullNoUUID of a contact list to use as the audience
segment_uuidstring|nullNoUUID of a contact segment to use as the audience. See Audience.
contentstring|nullNoThe email body, in Markdown (max 65000 characters). See Campaign body for the supported Markdown.
overwritebooleanNoDefaults to false. Only needed with template_uuid, when content replaces a body that carries formatting Markdown can't preserve.
ab_testobject|nullNoA/B test settings: variant B's b_subject / b_preheader and the test settings. Omit or send null for a campaign without a test. See Setting up a test and A/B Test Object.

from_identity, list_uuid, segment_uuid, and template_uuid must reference resources that belong to your account; an unknown value returns 422 VALIDATION_ERROR.

The content body accepts a subset of Markdown — headings, bold, italic, links, lists, blockquotes, code blocks, images, and horizontal rules. Tables, strikethrough, task lists, inline `code`, and raw HTML are silently dropped rather than rejected, so stick to the supported subset. See Campaign body for the full list.

Creating with an A/B test​

Send ab_test to set up an A/B test of the subject line or preheader. The defaults, which values are accepted, and how an incomplete test is reported are described in Setting up a test.

Creating from a template​

Send template_uuid to pre-fill the draft from a template. The draft receives the template's subject, preheader, sender, body with its full layout and styling, language, and audience. name is still required, and the template itself doesn't change.

  • Fields. A field sent in the request overrides the copied value, and null clears it. A field left out keeps the template's value.
  • Audience. Sending list_uuid or segment_uuid, even as null, replaces the template's whole audience: its list, its segment, and any filter conditions. Only what the request sets remains, so sending list_uuid alone also drops the template's segment. If the result has no audience, audience is listed in readiness.missing.
  • Body. Sending content when the template reports content_overwrite_required: true requires overwrite: true, which discards the template's layout and styling in the new draft. Without it, the request returns 409 CONTENT_OVERWRITE_REQUIRED.
  • Unknown template. A template_uuid that doesn't match a template on your account returns 422 VALIDATION_ERROR, and no draft is created.

Example Request​

curl -X POST "https://email.easy.tools/api/v1/campaigns" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"name": "Spring Sale",
"subject": "Up to 40% off this week",
"preheader": "Our biggest sale of the season",
"reply_to": "support@acme.com",
"content": "## Spring sale\n\nUp to **40% off**. [Shop now](https://acme.com/sale)"
}'

Example Request (name only)​

curl -X POST "https://email.easy.tools/api/v1/campaigns" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"name": "June Newsletter"
}'

Example Request (with an A/B test)​

Tests two subject lines on 20% of the audience and, 24 hours after the test emails go out, sends the version with the higher click rate to everyone else — the defaults for everything except b_subject.

curl -X POST "https://email.easy.tools/api/v1/campaigns" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"name": "Weekend Flash Sale",
"subject": "Free shipping all weekend",
"ab_test": {
"b_subject": "Free shipping ends Sunday"
}
}'

The response carries the stored test in ab_test, with the defaults filled in and phase: "configured". See A/B Test Object.

Example Request (from a template)​

This draft keeps the template's body and sender, overrides its subject, and targets a segment in place of the template's audience.

curl -X POST "https://email.easy.tools/api/v1/campaigns" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"name": "Welcome back",
"template_uuid": "94c6cd70-6747-4f1d-8cbc-b83150f33bb7",
"subject": "Welcome back",
"segment_uuid": "60707a92-80d0-468e-8a13-38b90c0511db"
}'

Response​

Success Response (201 Created)​

The full campaign, including its audience and a readiness report.

{
"data": {
"uuid": "c0578a15-1b1d-41e4-8dd3-caa3ac7ccf47",
"name": "Spring Sale",
"status": "draft",
"subject": "Up to 40% off this week",
"preheader": "Our biggest sale of the season",
"from_name": null,
"reply_to": "support@acme.com",
"from_identity": null,
"from_email": null,
"content": "## Spring sale\n\nUp to **40% off**. [Shop now](https://acme.com/sale)",
"content_editable_via_api": true,
"content_overwrite_required": false,
"audience": {
"list_uuid": null,
"segment_uuid": null
},
"ab_test": null,
"readiness": {
"can_send": false,
"missing": ["from_name", "sender_email", "audience"]
},
"created_at": "2026-06-24T10:00:00Z",
"updated_at": "2026-06-24T10:00:00Z",
"last_updated_at": "2026-06-24T10:00:00Z"
}
}

Response Fields​

The created campaign has the fields described in Get Campaign → Response Fields. A new campaign's status is always draft.

Error Responses​

Conflict Error (409 — Overwrite Required)​

Returned when content would replace a body copied from a template, the body carries formatting Markdown can't preserve, and overwrite was not true. See Creating from a template.

{
"error": {
"code": "CONTENT_OVERWRITE_REQUIRED",
"message": "This campaign's body contains layout blocks (columns/socials/countdown) that Markdown can't represent; pass overwrite=true to replace it."
}
}

Validation Error (422 Unprocessable Entity)​

Returned when name is missing, a field is malformed, or a referenced from_identity, list_uuid, segment_uuid, or template_uuid does not belong to your account. An unknown template returns Template not found on template_uuid. A segment with no filter conditions returns Contact segment has no filter conditions on segment_uuid. A content body that is too long once formatted returns The content is too long once formatted. on content, even within the 65000-character limit.

An invalid ab_test is reported on the offending key, such as ab_test.pool_percent or ab_test.winner_at. See Setting up a test and Winner time for the rules.

{
"error": {
"code": "VALIDATION_ERROR",
"message": "The given data was invalid",
"details": {
"from_identity": ["Sender identity not found"]
}
}
}