MailCraft API Reference
REST API for sending, contacts, campaigns, and automation — built for programmatic access alongside the MailCraft dashboard.
Overview
Every endpoint is versioned: all paths below are relative to:
https://<your-mailcraft-domain>/api/v1
Replace <your-mailcraft-domain> with wherever this instance is deployed.
Authentication
API requests are authenticated with a Bearer API key:
Authorization: Bearer mc_live_<your_api_key>
Generate a key from the dashboard under Organization Settings → API Keys. The
full key is shown exactly once at creation time — store it somewhere safe, it cannot be retrieved
again. A revoked or unknown key returns 401.
Endpoints marked dashboard only below are used by MailCraft's own web app and are not currently reachable with an API key — you'll need to use the dashboard UI for those.
A few endpoints are public and unauthenticated by design (signup-form submission, the public preference-center page, tracking pixels, and provider inbound webhooks) — each is verified by its own narrow mechanism (an embed/preference token, or an HMAC signature) instead of an API key.
Errors & pagination
Errors use a consistent shape, with the matching 4xx/5xx HTTP status:
{
"error": {
"code": "validation_error",
"message": "Human-readable description of what went wrong"
}
}
List endpoints that support pagination use a forward-only cursor:
GET /api/v1/contacts?limit=20&after=<id>
Responses are shaped { "data": [...], "hasMore": true }. Passing before
for backward pagination is rejected with 400 — only forward paging is supported.
Where a limit is optional and omitted, most list endpoints return everything in one
response (an explicit exception is called out per-endpoint below, e.g. API Request Logs).
Contacts
| Endpoint | Description |
|---|---|
GET /contacts |
List contacts. Filter by tagId or listId; paginated.VerifiedGET response example |
POST /contacts |
Create a contact. Accepts email, phoneNumber, firstName,
lastName, custom fields, and optional listIds/tagIds/
topicSubscriptions to wire it up in the same call.VerifiedPOST response example |
GET /contacts/{id|email} |
Get a contact by id or email address.VerifiedGET response example |
PUT /contacts/{id} |
Full replace — every field required, omitted fields are overwritten.VerifiedPUT response example |
PATCH /contacts/{id|email} |
Partial update. Only firstName/lastName/unsubscribed/
customFields are patchable; omitted fields are left unchanged.VerifiedPATCH response example |
DELETE /contacts/{id|email} |
Delete a contact.VerifiedDELETE response example
|
POST /contacts/{id|email}/lists/{listId} |
Add one contact to one list (idempotent).VerifiedPOST response example |
GET /contacts/{id|email}/lists |
List every list this contact belongs to.VerifiedGET response example |
DELETE /contacts/{id|email}/lists/{listId} |
Remove a contact from a list (idempotent).VerifiedDELETE response example
|
GET /contacts/{id|email}/topics |
Get a contact's subscription state for every preference topic.VerifiedGET response example |
PATCH /contacts/{id|email}/topics |
Update subscription state for one or more topics. Body: { "<topicId>": true }.VerifiedPATCH response example |
POST /contacts/import-json |
Bulk-create/update up to 1000 contacts per call. Query: onConflict=upsert|skip,
listIds, tagIds, topicSubscriptions (applied to every row).VerifiedPOST response example |
GET /contacts/import/{jobId} |
Get an import job's status: createdCount/updatedCount/failureCount/errors.VerifiedGET response example |
GET /contacts/import |
List import jobs run since the server process last started.VerifiedGET response example |
GET /contacts/{id}/timeline |
A merged, conversation-grouped timeline of sends, opens/clicks, and inbound replies for one contact.VerifiedGET response example |
GET /contacts/{id}/recommendations |
Co-purchase/same-category product recommendations for one contact (requires a connected store).ExpectedGET response exampleRequires a connected Shopify/WooCommerce store. Field names are not documented anywhere in docs/API.md — this is a best-effort guess at the shape, not a confirmed contract. |
Example — create a contact
curl https://<your-domain>/api/v1/contacts \
-H "Authorization: Bearer mc_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{
"email": "jane@example.com",
"firstName": "Jane",
"listIds": ["<list-id>"]
}'
Lists & tags
| Endpoint | Description |
|---|---|
GETPOST /lists |
List / create.VerifiedGET response exampleVerifiedPOST response example |
GETPUTDELETE /lists/{id} |
Get / replace / delete a list.VerifiedGET response exampleVerifiedPUT response exampleVerifiedDELETE response example
|
GETPOST /tags |
List / create tags. dashboard onlyExpectedGET response exampleNot yet verified against the live API — if your actual response differs, tell us so we can fix this doc. ExpectedPOST response exampleNot yet verified against the live API — if your actual response differs, tell us so we can fix this doc. |
Contact properties
Organization-level custom-field schema definitions — register a field's expected type once, and every contact write is validated against it.
| Endpoint | Description |
|---|---|
GETPOST /org/contact-properties |
List / create a property definition: { key, type: "string"|"number", fallbackValue? }.VerifiedGET response exampleVerifiedPOST response example |
GETPATCHDELETE /org/contact-properties/{id} |
Get / update fallbackValue (only) / delete. key/type are locked after creation.VerifiedGET response exampleVerifiedPATCH response exampleVerifiedDELETE response example
|
Templates
| Endpoint | Description |
|---|---|
GET /templates |
List starter + your own templates. Filter with ?category=.VerifiedGET response example |
POST /templates |
Create a template: from/subject/replyTo/html/
text, optional alias and up to 50 typed variables. Created as
a draft (isPublished: false).VerifiedPOST response example |
GETPUTPATCHDELETE /templates/{id|alias} |
Get / replace / partial-update / delete. A starter template (no Organization owner) can't be
mutated — duplicate it instead.VerifiedGET response exampleExpectedPUT response exampleSame resource shape as the verified GET/Create Template responses above — PUT is a full replace, so omitted fields come back cleared/default rather than unchanged. VerifiedPATCH response exampleVerifiedDELETE response example
|
POST /templates/{id|alias}/publish |
Marks a template published. Idempotent.VerifiedPOST response example |
POST /templates/{id|alias}/duplicate |
Copies a template's content (including variables) into a new, unpublished template.VerifiedPOST response example |
Campaigns
| Endpoint | Description |
|---|---|
GET /campaigns | List campaigns.ExpectedGET response exampleField names are our best guess, grounded in docs/API.md's Campaign text (purpose, channel, status, approvalStatus, topicId, scheduledSendAt are each named there) — not a confirmed full contract. |
POST /campaigns |
Create. Body includes purpose: "Marketing"|"Transactional" (locked after creation) and
optional topicId to restrict recipients to a preference topic's subscribers.ExpectedPOST response exampleSame caveat as List Campaigns — constructed from field names mentioned in docs/API.md, not a captured response. |
GETPUTDELETE /campaigns/{id} |
Get / replace / delete.ExpectedGET response exampleNot yet verified against the live API — if your actual response differs, tell us so we can fix this doc. ExpectedPUT response exampleFull replace — expect omitted fields to reset, same pattern as Templates' PUT. ExpectedDELETE response exampleThis codebase's own established delete-response shape (seen verbatim in docs/API.md for Webhooks/Threads/Suppression deletes) — reused here by convention, not individually confirmed for Campaigns. |
POST /campaigns/{id}/schedule | Schedules a future send.ExpectedPOST response exampleExpect `status: "Scheduled"` and `scheduledSendAt` set; exact response body not documented. |
POST /campaigns/{id}/send-now | Enqueues an immediate send.ExpectedPOST response exampleExpect `status: "Sending"`; exact response body not documented. |
POST /campaigns/{id}/cancel |
Cancels a Scheduled or in-progress Sending campaign; already-sent emails are unaffected.ExpectedPOST response exampleExpect `status` reverted to `"Draft"` (if cancelled from Scheduled) or moved to `"Cancelled"` (if cancelled from Sending) — both states are named in docs/API.md; exact response body not documented. |
GET /campaigns/{id}/report | Send/open/click/bounce/revenue summary.ExpectedGET response exampleField names follow the same pattern as the confirmed Analytics `GET /analytics/metrics` shape and docs/API.md's own wording ("send/open/click/bounce/revenue-attribution summary") — not individually confirmed for this specific endpoint. |
Broadcasts
A simpler, template+audience shaped wrapper over Campaigns — create and optionally send in one call.
| Endpoint | Description |
|---|---|
GET /broadcasts | List broadcasts.ExpectedGET response exampleFields are the exact list docs/API.md gives for the Broadcast response shape (id, name, status, audienceId, topicId, from, subject, replyTo, html, text, scheduledAt, timestamps) — this is grounded, but the array-of-this-shape wrapper for List specifically isn't shown verbatim anywhere. |
POST /broadcasts |
Create: { name, from, subject, html, text, segmentId, topicId?, send?, scheduledAt? }.
send: true dispatches immediately in the same call.ExpectedPOST response exampleThis exact shape — id, name, status, audienceId, topicId, from, subject, replyTo, html, text, scheduledAt, timestamps — is stated directly in docs/API.md for Create Broadcast's response. |
GET /broadcasts/{id} | Get one broadcast.ExpectedGET response exampleSame shape docs/API.md names for Get Broadcast (ADR-056), except `previewText` is explicitly never returned. |
PATCH /broadcasts/{id} | Partial update (rejected once sending/sent).ExpectedPATCH response exampleAssumed to return the updated broadcast in the same shape as Get/Create; not independently confirmed. |
POST /broadcasts/{id}/send | Send now, or at scheduledAt.ExpectedPOST response exampleExpect `status` moved to `"Sending"`/`"Scheduled"`; exact response body not documented. |
POST /broadcasts/{id}/cancel | Cancel.ExpectedPOST response exampleThin pass-through to Cancel Campaign per docs/API.md; exact response body not documented. |
DELETE /broadcasts/{id} | Delete (not while sending/sent).ExpectedDELETE response exampleThis codebase's established delete-response convention, reused by analogy — not individually confirmed for Broadcasts. |
POST /broadcasts/{id}/duplicate | Duplicate as a new draft.ExpectedPOST response exampleA fresh Draft copy, same shape, per docs/API.md's description of what Duplicate Broadcast copies. |
GET /broadcasts/{id}/recipients |
Paginated recipients by type (sent/delivered/opened/clicked/bounced/complained/unsubscribed/suppressed).ExpectedGET response exampleThe `{ data, hasMore }` envelope and cursor params are confirmed in docs/API.md; the per-recipient row's exact field names are our best guess, not individually confirmed. |
GET /broadcasts/{id}/clicked-links | Per-link click counts, most-clicked first.ExpectedGET response example`clicks`/`uniqueClicks` and the ordering (descending by clicks) are stated directly in docs/API.md; `url` as the link field name is our best guess. |
Automations
| Endpoint | Description |
|---|---|
GET /automations |
List. Filter ?status=enabled|disabled.ExpectedGET response example`id`/`name`/`status`/`triggerType`/`createdAt`/`updatedAt` are the exact fields docs/API.md names for Get Automation; List's per-row shape is assumed to match, not independently confirmed. `status` values Active/Draft/Paused and `triggerType` values (Signup/DateBased/Purchase/CartAbandoned/Webhook/ApiTrigger) are all named in docs/API.md. |
POST /automations |
Create — either { name, triggerType } (empty draft) or a full
steps[]/connections[] graph. Supported step types: trigger,
condition (single rule), delay, send_email.ExpectedPOST response example`nodes`/`edges` as the native graph field names are confirmed in docs/API.md ("the graph stays in Mailcraft's native GUID-keyed nodes/edges shape"); the rest matches Get Automation's documented fields. |
GETPUTPATCHDELETE /automations/{id} |
Get / replace graph / partial update / delete. A graph change is rejected while the
workflow is Active — pause first, or duplicate and edit the copy.ExpectedGET response exampleExact fields named in docs/API.md for Get Automation. ExpectedPUT response exampleFull graph replace — response shape assumed same as Get. ExpectedPATCH response examplePartial update — response shape assumed same as Get. ExpectedDELETE response exampleThis codebase's established delete-response convention, reused by analogy. |
POST /automations/{id}/duplicate | Duplicate as a new draft.ExpectedPOST response exampleA fresh Draft copy with a new id, per docs/API.md's description. |
POST /automations/{id}/activate | Activate.ExpectedPOST response exampleExpect `status: "Active"`; exact response body not documented — may be a minimal ack instead of the full resource. |
POST /automations/{id}/pause | Pause (also available as /stop).ExpectedPOST response exampleExpect `status: "Paused"`; exact response body not documented. |
GET /automations/{id}/runs |
List enrollment "runs". Filter ?status=running|completed|failed.ExpectedGET response exampleThe `{ id, status, startedAt, completedAt, createdAt }` row shape and the `{ data, hasMore }` envelope are both stated directly in docs/API.md. |
GET /automations/{id}/runs/{runId} | Get one run.ExpectedGET response exampleExact shape docs/API.md names for Get Run — "same summary shape as a List Runs row". No per-step execution trace is included (deliberately, per docs/API.md). |
POST /automations/{id}/trigger |
Enrolls a specific contactId into a Webhook/ApiTrigger-type
automation — the external-trigger entry point.ExpectedPOST response exampleNot documented — modeled on this API's own confirmed convention of echoing back the ids involved as a confirmation (see the real `POST /contacts/.../lists/{listId}` response above). |
Custom events
Registers a named event definition — a schema, not a firing mechanism. There is currently no endpoint to record an occurrence of an event against a contact.
| Endpoint | Description |
|---|---|
POST /events |
Create: { name, schema?: { field: "string"|"number"|"boolean"|"date" } }.ExpectedPOST response exampleExact shape stated directly in docs/API.md: `200 OK: the full created resource { id, name, schema, createdAt }`. |
GET /events | List.ExpectedGET response example`{ data, hasMore }` envelope stated directly in docs/API.md; row shape matches Create Event's documented response. |
GET /events/{id} | Get one.ExpectedGET response exampleRow shape matches Create Event's documented response; not independently confirmed for this specific route. |
Transactional email
One-off sends (password resets, receipts, alerts) through your connected provider — bypasses campaign approval, suppression-list, and opt-in checks.
| Endpoint | Description |
|---|---|
POST /transactional/send |
Send one message. channel: "Email"|"Sms"|"WhatsApp", recipient, content
fields, optional cc/bcc (Email only), optional future scheduledAt,
optional attachments (up to 10, 10MB each). Returns 202 with { sendId }.VerifiedPOST response example |
POST /transactional/send/batch |
Up to 100 independently-addressed sends in one call. Partial success — each item gets its
own { sendId } or { error } at its original index.VerifiedPOST response example |
GET /transactional |
List your transactional sends, newest first. Cursor-paginated.VerifiedGET response example |
GET /transactional/{sendId} |
Poll a send's current status: Scheduled|Queued|Sent|Delivered|Failed|Bounced|Cancelled.VerifiedGET response example |
PATCH /transactional/{sendId} |
Reschedule a still-pending scheduled send's scheduledAt.VerifiedPATCH response example
|
POST /transactional/{sendId}/cancel |
Cancel a still-pending scheduled send.VerifiedPOST response example
|
POST /transactional/{sendId}/share |
Create a public, time-limited share link for a sent email's rendered content.VerifiedPOST response example |
Example — send and poll
curl https://<your-domain>/api/v1/transactional/send \
-H "Authorization: Bearer mc_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{
"channel": "Email",
"recipient": "jane@example.com",
"subject": "Your receipt",
"body": "<p>Thanks for your order!</p>"
}'
# => 202 Accepted { "sendId": "..." }
curl https://<your-domain>/api/v1/transactional/<sendId> \
-H "Authorization: Bearer mc_live_xxxxx"
# => { "sendId": "...", "status": "Delivered", "channel": "Email", ... }
Bulk email
| Endpoint | Description |
|---|---|
POST /bulk/send |
One subject/body sent to up to 1000 recipients at once, no Campaign/List required:
{ subject, body, recipients: string[] }.ExpectedPOST response exampleNot documented anywhere in docs/API.md — this guess follows Transactional Send's confirmed `{ sendId }` async-dispatch pattern, but Bulk Send addresses many recipients at once, so the real shape may differ (e.g. one id per recipient). Treat this as the lowest-confidence guess on this whole page. |
Attachments
Attachments are supplied Base64-encoded on POST /transactional/send and retrieved
afterward via fresh, time-limited signed URLs.
| Endpoint | Description |
|---|---|
GET /transactional/{sendId}/attachments |
List a send's attachments, each with a fresh 1-hour download URL.VerifiedGET response example |
GET /transactional/{sendId}/attachments/{attachmentId} |
Get one attachment's metadata and a fresh download URL.VerifiedGET response example |
Inbound email
Email replies received on a provisioned inbox (not a general-purpose receive-anything mailbox).
| Endpoint | Description |
|---|---|
GET /inbound |
List the most recently received emails, newest first (default 20, max 100).VerifiedGET response example |
GET /inbound/{id} |
Get one received email: { id, from, subject, body, receivedAt, conversationId }.VerifiedGET response example |
POST /inbound/{id}/reply |
Reply to a received email through your connected provider: { subject, body }.
Returns 202 with a pollable sendId, same as Transactional Send.ExpectedPOST response exampleExact shape stated directly in docs/API.md: "Dispatches through the exact same async pipeline as POST /api/v1/transactional/send — 202 Accepted { sendId }" (confirmed for Transactional Send itself, above). |
Webhooks
Subscribe to outbound event notifications instead of polling.
| Endpoint | Description |
|---|---|
GET /org/webhook-subscriptions | List.ExpectedGET response exampleExact shape stated directly in docs/API.md: `200 OK: { data: [{ id, endpoint, events, status, createdAt }], hasMore }`. |
GET /org/webhook-subscriptions/{id} | Get one.ExpectedGET response exampleSame per-row shape as List Webhooks, stated directly in docs/API.md. |
POST /org/webhook-subscriptions |
Create: { endpoint, events: string[] }. Returns a signingSecret
shown exactly once.ExpectedPOST response exampleExact shape stated directly in docs/API.md, including that `signingSecret` is shown once at creation and never again. |
PATCH /org/webhook-subscriptions/{id} |
Update endpoint/events/status: "enabled"|"disabled".ExpectedPATCH response exampleAssumed to return the updated row in the same shape as List/Get, minus `signingSecret` (shown once only, at creation) — not independently confirmed. |
DELETE /org/webhook-subscriptions/{id} | Delete.ExpectedDELETE response exampleExact shape stated directly in docs/API.md: "200 OK: { id, deleted: true } — replaces this endpoint's previous bare 204 No Content". |
Event types
email.opened · email.clicked · email.bounced ·
email.failed · InboundMessageReceived · Unsubscribe ·
CampaignSent (not yet fired by any current code path)
Verifying a delivery
Every delivery carries two headers:
X-Mailchimp-Clone-Event— the event type, verbatim.X-Mailchimp-Clone-Signature— Base64-encoded HMAC-SHA256 of the raw request body, using your subscription'ssigningSecret.
// Node.js example
const crypto = require('crypto');
const expected = crypto.createHmac('sha256', signingSecret)
.update(rawRequestBody)
.digest('base64');
if (expected !== req.headers['x-mailchimp-clone-signature']) {
return res.status(401).end();
}
Failed deliveries retry with exponential backoff for up to 5 attempts before being marked exhausted — your endpoint should respond quickly and idempotently.
Analytics
| Endpoint | Description |
|---|---|
GET /analytics/metrics |
Account-level Email-channel totals and rates over a date range: ?from=&to=.
Returns sent/delivered/failed/bounced/opened/clicked/complained/unsubscribed counts and rates.ExpectedGET response exampleExact field list stated directly in docs/API.md (ADR-020) — only the numbers themselves are illustrative. |
API request logs
An audit trail of your own API-key-authenticated requests — useful for debugging integrations. Request/response bodies are redacted for sensitive fields before storage and kept for 30 days.
| Endpoint | Description |
|---|---|
GET /logs |
List your logged requests, newest first. limit defaults to 20 —
unlike most list endpoints here, omitting it does not return everything.ExpectedGET response exampleThe `{ data, hasMore }` envelope is this codebase's established list convention; the row shape is docs/API.md's exact Get Log shape (confirmed for the single-row endpoint below) — assumed, not confirmed, that List returns the same full shape per row rather than a trimmed summary. |
GET /logs/{id} | Get one logged request.ExpectedGET response exampleExact field list stated directly in docs/API.md, including that sensitive JSON keys are redacted before storage. |
Dashboard-only features
These exist in MailCraft but aren't currently reachable with an API key — use the web dashboard instead:
- Organization settings, connected sending providers, inbox/domain provisioning
- Segments (dynamic contact-matching rules)
- Landing pages & signup forms (the builder itself — published forms' public submit endpoint is open)
- Preference topics (management) & the suppression list
- AI content assistance (subject-line/copy suggestions)
- Audit log