Create and send a campaign
Draft → test → schedule or send → cancel.
End-to-end workflow for a newsletter campaign via API. Requires campaigns:write (and campaigns:read to inspect status).
Prepare audience and template
Import contacts with bulk import. Publish a template version and note its
templateVersionId. Include{{unsubscribeUrl}}in the template footer.Create the campaign
curl -X POST "https://api.mailingcore.com/campaigns" \ -H "Authorization: Bearer mc_live_xxxx" \ -H "X-Tenant-Id: clxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "name": "June product update", "templateVersionId": "clxversion...", "subject": "What is new in June", "audienceFilter": { "optIn": true, "locale": "en" } }'Save the returned
id— the campaign starts inDRAFT.Send test emails
Send a preview to 1–5 addresses before going live:
curl -X POST "https://api.mailingcore.com/campaigns/clxcampaign.../test" \ -H "Authorization: Bearer mc_live_xxxx" \ -H "X-Tenant-Id: clxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "emails": ["[email protected]", "[email protected]"] }'Verify rendering, links, and the unsubscribe URL on real inboxes.
Schedule or send immediately
Schedule for a future time:
curl -X POST "https://api.mailingcore.com/campaigns/clxcampaign.../schedule" \ -H "Authorization: Bearer mc_live_xxxx" \ -H "X-Tenant-Id: clxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "scheduledAt": "2026-07-01T09:00:00.000Z", "timezone": "Europe/Madrid" }'Send now (async fan-out):
curl -X POST "https://api.mailingcore.com/campaigns/clxcampaign.../send" \ -H "Authorization: Bearer mc_live_xxxx" \ -H "X-Tenant-Id: clxxxxxxxx"Response: 202 Accepted — delivery proceeds in the background.
Monitor and cancel if needed
Poll
GET /campaigns/{id}until status isSENT. To stop a scheduled or in-flight campaign:curl -X POST "https://api.mailingcore.com/campaigns/clxcampaign.../cancel" \ -H "Authorization: Bearer mc_live_xxxx" \ -H "X-Tenant-Id: clxxxxxxxx"
Test send limits
| Rule | Value |
|---|---|
| Min test recipients | 1 |
| Max test recipients | 5 |
| Scope | campaigns:write |
Before you send
Update a draft
While status is DRAFT, patch fields:
PATCH /campaigns/{id}
{
"subject": "Updated subject line",
"audienceFilter": { "optIn": true, "locale": "en" }
}
Related
- Campaigns overview — states and audience filters
- Unsubscribe —
{{unsubscribeUrl}}and webhooks