MessagePipedocs
API Reference

Campaigns and newsletters

Create, test, start, pause and report on campaigns and newsletters with an API key. Templates, scopes, credit cost and safety limits.

Everything the dashboard does for campaigns and newsletters is also available at https://api.messagepipe.dev/v1/... with a workspace API key. The calls reach the same handlers the dashboard uses, so validation, roles, the pre-flight and the consent rules are the ones a person gets. Sends are charged from the same credit balance as transactional sends: there is no separate API meter and no API surcharge.

The full contract, with request and response schemas, is the Send API reference. Every operation carries its scope, role, rate class, idempotency mode and credit cost in x-mp-* extension fields.

For a walk-through from an empty workspace to a sent newsletter, read Send your first newsletter by API.

Scopes

A key only gets the scopes someone ticks. A write scope does not imply its read scope.

ScopeAllows
campaigns:readList and get campaigns, pre-flight, report.
campaigns:writeCreate, edit and duplicate drafts; pause and cancel.
campaigns:sendStart, resume and test-send. These spend credits. Never pre-selected.
content:read, content:writeCampaign templates, versions, layouts, content preview and checks.
audience:readRead brands, topics and consent statements (you need a brand and a topic to make a campaign).

Campaigns

OperationScopeRate classIdempotency-KeyCredits
GET /v1/campaignscampaigns:readread0
POST /v1/campaignscampaigns:writewriteoptional0
GET /v1/campaigns/{id}campaigns:readread0
PATCH /v1/campaigns/{id}campaigns:writewriteoptional0
POST /v1/campaigns/{id}/duplicatecampaigns:writewriteoptional0
GET /v1/campaigns/{id}/preflightcampaigns:readread0
GET /v1/campaigns/{id}/reportcampaigns:readread0
POST /v1/campaigns/{id}/pausecampaigns:writewriteoptional0
POST /v1/campaigns/{id}/cancelcampaigns:writewriteoptional0
POST /v1/campaigns/{id}/test-sendcampaigns:sendstartrequired1 per test recipient
POST /v1/campaigns/{id}/startcampaigns:sendstartrequired1 per recipient message
POST /v1/campaigns/{id}/resumecampaigns:sendstartrequired1 per message still to send

A campaign names a brand_id, a topic_id (what the recipients subscribed to), usually a segment_id and a template_id. kind is campaign (the default) or newsletter. Status moves draft, scheduled, running, paused, completed, cancelled or failed. Editing a campaign that has failed to start puts it back to draft.

What a send costs

StepCredits
Creating, editing and duplicating drafts, templates, segments and counts0
Pre-flight, previews and content checks0
Test send1 email credit per test recipient
Start / resume1 email credit per recipient message, taken just before the message is queued and refunded if it cannot be queued
A recipient who is suppressed, unsubscribed or has no valid consent0 (recorded, not sent)
Reading the report0

Credits are taken as the campaign sends, not all at once. The debit has a durable reference per campaign run and contact, so a retried worker, a Redis flush or a replayed request cannot charge the same message twice.

When the balance is zero, start is refused with 400 validation_failed and a no_credits problem in details.problems: no run is created and nothing is reserved. When credits are short (fewer than recipients), the start succeeds with a credits_short warning in its preflight, and the run pauses with pause_reason: credits_exhausted when the balance reaches zero. Add credits and call resume. GET /v1/campaigns/{id} and the report carry run.status and run.pause_reason, so you do not need to poll the balance to see it; subscribe to the campaign.paused and credits.low webhook events to be told.

Starting safely

A key can start a bulk send with nobody watching, so the human steps of the dashboard are replaced by explicit limits.

  • The pre-flight must pass. start runs it again and refuses on any error-level problem (400, details.problems); a scheduled start is checked again when it fires. The 200 response carries the preflight it passed.
  • Idempotency-Key is required on start, resume and test-send (400 naming the header when it is missing or over 255 characters). A repeat returns the first answer and queues nothing twice; the same key with a different request is 422 idempotency_mismatch; a second call while the first is running is 409 idempotency_in_progress. See Idempotency.
  • Daily recipient cap per key. Default 10,000 recipients per UTC day. Over it is 422 daily_recipient_cap, with cap, used, requested, remaining and resets_at. Unsent recipients are given back when a run is cancelled or fails. Only a workspace owner or admin raises the cap, in the dashboard; a key cannot change it.
  • Start rate limit. 10 requests per minute per key for start, resume and test-send (Retry-After on 429), 120 for writes and 600 for reads. Override per key in the dashboard. See Rate limits.
  • Consent is not bypassable. Suppressed addresses, topic consent, the brand's verified-domain rule and link screening apply to an API start exactly as to a dashboard start.
  • Audit. Every change is audited with the key as the actor. Start, resume, cancel and test sends by a key are warnings. A running campaign that a key started carries on if the key is later revoked; it belongs to the workspace.

Content

Campaign content lives in campaign templates: POST /v1/campaign-templates takes a project_id, a name and content with mode (markdown, html or mjml), source, subject, and optional preheader and text. Edit with PUT /v1/campaign-templates/{id}, then publish. The content routes (/v1/content/preview, /v1/content/preflight, /v1/content/variables, /v1/content/layouts) render and check content without sending and cost nothing.

OperationScope
GET /v1/campaign-templates, GET /v1/campaign-templates/{id}, .../versions, .../versions/{v}content:read
POST /v1/campaign-templates, PUT /v1/campaign-templates/{id}, .../publish, .../archivecontent:write
GET /v1/content/variables, GET /v1/content/layouts, GET /v1/content/layouts/{id}content:read
POST /v1/content/preview, POST /v1/content/preflight, POST /v1/content/layouts/validatecontent:write
POST /v1/content/layouts, PUT /v1/content/layouts/{id}, POST /v1/content/layouts/{id}/archivecontent:write

Previews and checks can render a real contact's data, which the dashboard shows to marketers only, so they need the write scope.

Not available by API

Campaign archive (DELETE) and the standalone /content/test-send are not exposed; a campaign's own test-send is. Provider credentials, billing, members and API-key management stay in the dashboard.