DocumentationCreate and send a campaign

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

  1. Prepare audience and template

    Import contacts with bulk import. Publish a template version and note its templateVersionId. Include {{unsubscribeUrl}} in the template footer.

  2. 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 in DRAFT.

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

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

  5. Monitor and cancel if needed

    Poll GET /campaigns/{id} until status is SENT. 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

RuleValue
Min test recipients1
Max test recipients5
Scopecampaigns: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