Resources

    Email campaigns API

    Create, list, update and delete campaigns, send immediately, or schedule a send for a future time.

    How campaigns work

    A campaign is a one-time email sent to an audience: a newsletter, a product launch, a sale announcement. Each campaign has a sender, a subject line, email content and an audience - either everyone (recipient_type: "all"), one list ("list") or a segment ("segment"). Only subscribers with status active receive the send; suppressed and unsubscribed contacts are excluded automatically.

    A campaign moves through a simple lifecycle: it is created as a draft, can be scheduled for a future time, becomes sending when the send starts, and ends as sent (or failed if the send could not start). Drafts and scheduled campaigns can be edited and deleted; sent campaigns are immutable so your statistics always match what was actually sent.

    Use cases

    • Generate a recurring digest from your own data, create the campaign via API and send it automatically.
    • Build campaigns in your own tooling or CMS and hand them to the platform for delivery.
    • Schedule sends at the optimal local time per audience, computed by your own logic.
    • Poll campaign status and recipient counts to display send progress in an internal dashboard.

    The campaign object

    NameTypeDescription
    idstringUnique campaign id.
    namestringInternal name, not shown to recipients.
    sender_name / sender_emailstringThe from name and address. The email must be on a domain you have verified.
    subject_line / preheader_textstringSubject and inbox preview text. Merge tags such as {{firstName}} are supported.
    email_contentobjectThe email body, for example { "html": "..." }.
    statusstringdraft, scheduled, sending, sent or failed.
    recipient_type / recipient_idstringThe audience: all, or list/segment plus the matching id.
    scheduled_atstringUTC timestamp for scheduled sends.
    sent_count / open_rate / click_ratenumberDelivery and engagement statistics, populated after sending.

    Sending is irreversible

    The send endpoint starts delivery immediately and cannot be cancelled once processing begins. Send and schedule calls are limited to 5 per minute. Test with a small list first, and prefer schedule over send when you need a safety window.

    Endpoints

    GET

    Get campaigns

    /campaigns-api

    Query parameters

    NameTypeDescription
    statusstringFilter by status (draft, scheduled, sent, failed).
    searchstringSearch by name or subject line.
    limitnumberItems per page (default: 50).
    offsetnumberPagination offset.
    curl -X GET "https://api.mailingplatform.net/campaigns-api?status=draft&limit=25" \
      -H "Authorization: Bearer mp_live_..."
    GET

    Get single campaign

    /campaigns-api/{campaignId}

    Retrieve one campaign by id.

    Query parameters

    NameTypeDescription
    campaignIdrequiredstringCampaign id (path).
    include_statsbooleanWhen true, adds recipient_count based on the audience (all, list or segment).
    curl -X GET "https://api.mailingplatform.net/campaigns-api/{campaignId}?include_stats=true" \
      -H "Authorization: Bearer mp_live_..."
    POST

    Create campaign

    /campaigns-api

    Create a new campaign. It starts as a draft unless you pass another status; send it with the send endpoint below.

    Request body

    NameTypeDescription
    namerequiredstringInternal campaign name.
    sender_namerequiredstringFrom name recipients see.
    sender_emailrequiredstringFrom address on your verified domain.
    subject_linerequiredstringSubject line.
    preheader_textstringInbox preview text.
    email_contentobjectEmail content, for example { "html": "..." }.
    recipient_typestringall, list or segment (default: all).
    recipient_idstringList or segment id when recipient_type is list or segment. Required for those types, and must belong to your account - otherwise the request fails with 404 "List not found" or "Segment not found".
    statusstringInitial status (default: draft).
    scheduled_atstringUTC timestamp for a scheduled send.
    curl -X POST "https://api.mailingplatform.net/campaigns-api" \
      -H "Authorization: Bearer mp_live_..." \
      -H "Content-Type: application/json" \
      -d '{
      "name": "Weekly Newsletter",
      "sender_name": "Your Company",
      "sender_email": "news@company.com",
      "subject_line": "This Week's Updates",
      "preheader_text": "The short preview text",
      "recipient_type": "list",
      "recipient_id": "list-456",
      "status": "draft"
    }'
    PUT

    Update campaign

    /campaigns-api/{campaignId}

    Update a draft or scheduled campaign. All fields are optional; only the fields you send are changed. Sent campaigns cannot be edited. If you change recipient_type or recipient_id, the resulting list or segment must belong to your account (404 otherwise).

    NameTypeDescription
    campaignIdrequiredstringCampaign id (path).
    curl -X PUT "https://api.mailingplatform.net/campaigns-api/{campaignId}" \
      -H "Authorization: Bearer mp_live_..." \
      -H "Content-Type: application/json" \
      -d '{
      "subject_line": "Updated subject line",
      "recipient_type": "segment",
      "recipient_id": "segment-789"
    }'
    DELETE

    Delete campaign

    /campaigns-api/{campaignId}

    Delete a campaign. Campaigns that are sending or already sent cannot be deleted.

    NameTypeDescription
    campaignIdrequiredstringCampaign id (path).
    curl -X DELETE "https://api.mailingplatform.net/campaigns-api/{campaignId}" \
      -H "Authorization: Bearer mp_live_..."
    POST

    Send campaign

    /campaigns-api/{campaignId}/send

    Sends the campaign immediately to all recipients. Campaign must be in 'draft' or 'scheduled' status.

    NameTypeDescription
    campaignIdrequiredstringCampaign id (path).
    curl -X POST "https://api.mailingplatform.net/campaigns-api/{campaignId}/send" \
      -H "Authorization: Bearer mp_live_..."
    POST

    Schedule campaign

    /campaigns-api/{campaignId}/schedule

    Request body

    NameTypeDescription
    scheduled_atrequiredstringUTC timestamp, for example 2024-12-25T10:00:00Z.
    curl -X POST "https://api.mailingplatform.net/campaigns-api/{campaignId}/schedule" \
      -H "Authorization: Bearer mp_live_..." \
      -H "Content-Type: application/json" \
      -d '{
      "scheduled_at": "2024-12-25T10:00:00Z"
    }'