Campaigns
API reference for creating campaign drafts, sending or scheduling them with warm-up, and reading their results.
Create a draft#
Creates a draft. Nothing is sent. The response says whether it's ready (ready_to_send), what's missing (problems), and how many people it would reach (recipients). When that's more than your daily campaign limit allows today, sends_over says how it continues on the following days, e.g. { "days": 3, "today": 1000, "per_day": 1000 }; otherwise it's null. The send response has it too.
Body
namestringrequiredInternal name.fromstringrequiredSender on a verified domain:Acme <[email protected]>.liststring | string[]requiredA list name or id, or up to 50 of them. Someone on several lists gets it once.subjectstringRequired unless the template has one.htmlstringThe email HTML. Plain content (paragraphs, headings, lists, links) gets the Maillayer layout and opens in the visual editor; a full document with tables or <style> is sent as is. Your postal address and an unsubscribe link are added automatically.templatestringUse a saved template's content instead of html.preheaderstringPreview text.reply_tostringWhere replies go.
curl https://maillayer.com/api/v1/campaigns \
-H "Authorization: Bearer $MAILLAYER_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "November update",
"from": "Acme <[email protected]>",
"list": ["Newsletter", "Customers"],
"subject": "What we shipped in November",
"html": "<h1>Hi {{ first_name | default: \"there\" }}</h1><p>…</p>"
}'{
"id": "c7d2…",
"name": "November update",
"status": "draft",
"subject": "What we shipped in November",
"from": "Acme <[email protected]>",
"lists": ["Newsletter", "Customers"],
"scheduled_at": null,
"sent_at": null,
"ready_to_send": true,
"problems": [],
"recipients": 4812,
"sends_over": null,
…
}Edit a draft#
Changes a draft. Send only the fields you want to change; the rest stay as they are. It takes the same fields as creating a draft, and preheader and reply_to can be removed with null. list replaces the lists. template replaces the content with that template's, and its subject and preheader too unless you give them. The response is the same as creating a draft, with ready_to_send, problems and recipients.
curl -X PATCH https://maillayer.com/api/v1/campaigns/c7d2… \
-H "Authorization: Bearer $MAILLAYER_KEY" \
-H "Content-Type: application/json" \
-d '{ "subject": "What we shipped this month", "reply_to": null }'not_editable; unschedule a scheduled campaign in the dashboard first. Other errors: 422 nothing_to_change, invalid_from, missing_subject or missing_content; 404 list_not_found or template_not_found.Fix a mistake mid-send#
Wrong link or a typo in a campaign that's already going out? Pause it, fix it with PATCH /campaigns/:id, then resume. The emails still queued go out with the fix; the ones already sent keep the earlier version. While paused you can change the subject, preheader, content, sender and reply-to, but not the lists (409 audience_locked): recipients were queued and paid for when sending started.
Stops a sending campaign. Emails already handed over still go out. Returns the campaign with status: "paused", or 409 not_sending.
Continues a paused campaign with your changes. A paced campaign keeps its spacing from now on. Errors: 409 not_paused, or cannot_resume when we paused it for review.
curl -X POST https://maillayer.com/api/v1/campaigns/c7d2…/pause -H "Authorization: Bearer $MAILLAYER_KEY"
curl -X PATCH https://maillayer.com/api/v1/campaigns/c7d2… \
-H "Authorization: Bearer $MAILLAYER_KEY" \
-H "Content-Type: application/json" \
-d '{ "html": "<p>…the right link…</p>" }'
curl -X POST https://maillayer.com/api/v1/campaigns/c7d2…/resume -H "Authorization: Bearer $MAILLAYER_KEY"After an edit, the campaign's edited field says when, and how many had gone out before it: { "at": "2026-11-19T16:40:00Z", "sent_before_edit": 1240 }. It's null for campaigns never edited mid-send.
Delete a draft#
Deletes a draft and returns { "id": "c7d2…", "deleted": true }. Campaigns that were sent or scheduled can't be deleted (409 not_draft).
Send or schedule#
An empty body sends now. The campaign must be a draft and ready.
Body
scheduled_atstringISO 8601 time at least a minute from now, to schedule instead.review_notestringOnly when asked withreview_required: a new sender's first campaign to 5,000+ people is reviewed before it goes out. Say where the contacts came from and how they agreed to get email. The campaign then showsstatus: "review".warmuptrue | objectSend in growing batches.trueuses the defaults, or setinitial_batch(50),growth_factor(2),interval_hours(24) andmax_batch(10,000).per_hournumberSpread the send evenly at this many emails per hour, 1 to 100,000.120sends one email every 30 seconds. Can't be combined withwarmup.
curl https://maillayer.com/api/v1/campaigns/c7d2…/send \
-H "Authorization: Bearer $MAILLAYER_KEY" \
-H "Content-Type: application/json" \
-d '{ "scheduled_at": "2026-11-18T09:00:00Z", "warmup": true }'not_draft, 422 not_ready, invalid_schedule or invalid_pace.Get a campaign#
Status and results:
{
"id": "c7d2…",
"status": "sent",
…,
"warmup": null,
"per_hour": null,
"finishes_at": null,
"stats": {
"recipients": 4812, "sent": 4812, "delivered": 4760,
"opened": 2015, "clicked": 402, "bounced": 52,
"complained": 1, "unsubscribed": 9,
"open_rate": 42.3, "click_rate": 8.4, "bounce_rate": 1.1
},
"dashboard_url": "https://maillayer.com/campaigns/c7d2…"
}List campaigns#
Recent campaigns, newest first, in data. limit goes up to 100. See the Campaigns guide.