Skip to main content
About this page · Updated 2026-10-27 14:09 UTC

What this page is: Create, schedule, duplicate and track email campaigns through the Marketing Communications Block API, with the rules and error codes each step enforces.

How far to trust this page: the build checked 43 names, paths, tools, scopes and error codes against the real product (0 do not match). Names, paths and numbers checked on 2026-10-22; behaviour prose not verified claim by claim.

Updated 2026-10-27 14:09 UTCLatest change: Communications MCP: how a campaign didRecently updated pages

Campaign Management

Create a campaign, schedule it, watch it send, and duplicate it to send again. Every step below says what the API checks and which error code you get when it refuses.

All calls need an account API key and a workspace ID; see Authentication rules. Errors have the shape { "success": false, "error": "...", "code": "..." }; the codes are listed under Errors.

Campaign Workflow​

  1. Create a draft: name, template, lists and a marketing Motor Block.
  2. Schedule it: send as soon as the sender picks it up, or at a time you choose. Scheduling checks and compiles the campaign in the same step.
  3. Monitor delivery, opens, clicks, bounces and unsubscribes.
  4. Duplicate a finished or cancelled campaign to send it again.

Creating a Campaign​

curl -X POST https://motorical.com/comm-api/api/campaigns \
-H "Authorization: ApiKey ak_live_YOUR_KEY" \
-H "X-Tenant-Id: YOUR_WORKSPACE_ID" \
-H "Idempotency-Key: newsletter-2026-11-create" \
-H "Content-Type: application/json" \
-d '{
"name": "Monthly Newsletter",
"template_id": "TEMPLATE_ID",
"list_ids": ["LIST_ID_1", "LIST_ID_2"],
"motor_block_id": "MOTOR_BLOCK_ID",
"from_address": "news@example.com",
"from_name": "Example News"
}'
FieldRequiredRule
nameYesAt most 200 characters.
template_idYesA template in this workspace (404 TEMPLATE_NOT_FOUND otherwise).
list_idsYes1 to 50 lists in this workspace (404 LIST_NOT_FOUND, 400 TOO_MANY_LISTS).
motor_block_idYesA marketing Motor Block assigned to the workspace; see below.
from_addressNoMust be an address at the Motor Block's own sending domain; defaults to noreply@<that domain>. Another domain is 400 FROM_DOMAIN_MISMATCH and the response names the expected domain.
from_nameNoThe name recipients see next to the From address. Cleaned rather than rejected: control characters, quotes, <, > and @ are removed; at most 100 characters. When empty, the workspace name is shown (the internal campaign name never is).
reply_toNoOne email address, on any domain, where replies go (Reply-To header). Without it replies go to the From address. An invalid address is 400 INVALID_REPLY_TO.
google_analyticsNoUTM settings: enabled, utm_source, utm_medium, utm_campaign, utm_content.
consent_requestNotrue makes this a consent-request campaign; the template must contain {{consent_url}}.

The new campaign is a draft. The same From-domain rule is checked again when you schedule and by the sender, so a campaign can never go out signed as a domain that is not the Motor Block's.

motor_block_id is the id of a Marketing Motor Block assigned to the active workspace under Comm → Workspaces.

A marketing block is a sender identity for Communications (campaigns, lists, templates). It has no SMTP login and no API key of its own. You send through campaigns in the dashboard, or through the Comms Block API with your account API key and a workspace. For transactional email (receipts, password resets) use a transactional block.

Comms-managed ("… — Campaigns")Manual (Create dialog)
Sends viaComms Block: dashboard campaigns, Comms API (account API key + X-Tenant-Id)Same
Own SMTP / API keyNoneNone
CreatedAutomatically when you pick a sending domain in Comm → WorkspacesBy you, then assigned under Comm → Workspaces → Advanced
Editable in Motorical dashboardNo (managed from Comm)Rename, pause, delete

Sending with a manual marketing block​

A manual marketing block (one you created yourself in Motor Blocks) is used for sending through a workspace and your account API key. Comms-managed <domain> — Campaigns blocks are assigned to a workspace automatically, so you can skip the assignment step for those.

  1. Create and verify the block in Motor Blocks.
  2. Go to Comm → Workspaces → Advanced, assign the block to your workspace, and save.
  3. Create a campaign with the block's id as motor_block_id.
  4. Schedule the campaign.

Your workspace ID is shown at Comm → Workspaces; see Find your workspace ID. You can get the block id in two ways:

  • The dashboard prefills it in the "How to send with this block" example shown under each manual block in Comm → Workspaces → Advanced.
  • The Comms API lists the marketing blocks assigned to a workspace:
curl https://motorical.com/comm-api/api/workspaces/current/motor-blocks \
-H "Authorization: ApiKey ak_live_YOUR_KEY" \
-H "X-Tenant-Id: YOUR_WORKSPACE_ID"

The response is { "success": true, "data": [ ... ] }. Each item has id, name, type, active, and domain ({ name, verified }, or null when the block has no domain). data is an empty array when nothing is assigned yet. Use the id as motor_block_id.

# 1. Create a campaign that sends from this block
curl -X POST https://motorical.com/comm-api/api/campaigns \
-H "Authorization: ApiKey ak_live_YOUR_KEY" \
-H "X-Tenant-Id: YOUR_WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d '{"name":"My campaign","template_id":"TEMPLATE_ID","list_ids":["LIST_ID"],"motor_block_id":"YOUR_MOTOR_BLOCK_ID"}'

# 2. Schedule it (use the campaign id returned by step 1)
curl -X POST https://motorical.com/comm-api/api/campaigns/CAMPAIGN_ID/schedule \
-H "Authorization: ApiKey ak_live_YOUR_KEY" \
-H "X-Tenant-Id: YOUR_WORKSPACE_ID"

:::note Which key is which The account key ak_live_... is used for Communications and for token minting. mk_live_... keys are for POST /v1/send only; a marketing block has none. :::

Scheduling​

curl -X POST https://motorical.com/comm-api/api/campaigns/CAMPAIGN_ID/schedule \
-H "Authorization: ApiKey ak_live_YOUR_KEY" \
-H "X-Tenant-Id: YOUR_WORKSPACE_ID" \
-H "Idempotency-Key: newsletter-2026-11-schedule"

To send at a particular time, set it first with PATCH .../settings (scheduled_at, a UTC ISO time in the future), or send it in the body of this call: scheduled_at and timezone are then stored in the same statement that schedules the campaign. With no scheduled_at the campaign sends as soon as the sender picks it up (send_immediately: true in the response).

Three optional body fields make scheduling safer. "dry_run": true runs every check, including a fresh compile, and answers what would happen (dry_run: true, the recipients, the forecast, the warnings) without scheduling anything. "expected_preflight_version": N names a compile you looked at: scheduling compiles again and compares the two (the subject and bodies, the lists, the exclusions and the number of recipients); if anything differs, or the compile is older than 30 minutes, nothing is scheduled and you get 409 PREFLIGHT_STALE with changes saying what is different (PREFLIGHT_NOT_FOUND if there is no such version). timezone is an IANA name such as Europe/Riga.

When the call arrives through a connected assistant (an MCP connection) rather than from you, stricter rules apply and the dashboard is unaffected: a send time is required and must be at least 15 minutes and at most 90 days ahead (AGENT_SEND_TIME_REQUIRED, AGENT_SEND_TOO_SOON, AGENT_SEND_TOO_FAR), expected_preflight_version is required (PREFLIGHT_REQUIRED), a connection can schedule at most 50 campaigns a day (429 AGENT_SCHEDULE_LIMIT with retryAfter), and the account owner is emailed about every schedule and every cancel.

Scheduling does the whole preparation in one step, so you never need a separate compile call:

  1. re-checks the Motor Block, template, lists and From address;
  2. compiles the campaign: the HTML is sanitised (scripts, embeds, inline event handlers and script-bearing links are removed), links are tracked, and the audience is frozen as a snapshot;
  3. moves the campaign to scheduled.

It refuses, and changes nothing, when:

CodeWhy
400 EMPTY_AUDIENCENo recipient is eligible: the lists are empty, or everyone is unsubscribed, suppressed or not yet eligible.
400 SCHEDULED_AT_IN_PASTscheduled_at is more than a minute in the past.
400 MISSING_CONSENT_URLA consent-request campaign whose template lacks {{consent_url}}.
400 UNSUBSCRIBE_LINK_MISSINGNeither the HTML nor the text of the template contains {{unsubscribe_url}}. Every campaign needs a way out in the message body.
400 MERGE_VARIABLE_IN_URLA link or image address in the template contains a merge variable, which cannot be filled there. urls lists each one. Put the variable in the visible text. See Links and the text version.
400 UNKNOWN_MERGE_VARIABLEThe subject or a body uses a {{tag}} outside the closed set, or writes one wrongly. variables lists each tag. Validate the template first; nothing is sent with literal braces.
400 CAMPAIGN_CANNOT_COMPLETEAt your sending limits the campaign can never be sent: it would take longer than 7 days, or a limit is zero. reason is too_long or cap_zero and forecast shows the numbers. Only when limits are enforced for campaigns.
400 FROM_DOMAIN_MISMATCHThe From address is no longer on the Motor Block's domain.
400 SECURITY_VALIDATION_FAILEDThe content failed the security check.
409 INVALID_STATEThe campaign is sending, completed or cancelled.

The response carries status, scheduled_at, send_immediately, total_recipients, artifact_version, from_address, a forecast and warnings.

Sending is chunked: chunk_size recipients at a time with delay_seconds_between_chunks between chunks, which protects sender reputation.

Send a test to yourself​

curl -X POST https://motorical.com/comm-api/api/campaigns/CAMPAIGN_ID/test-send \
-H "Authorization: ApiKey ak_live_YOUR_KEY" \
-H "X-Tenant-Id: YOUR_WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d '{ "sample": { "name": "Ada Lovelace", "identity_name": "Example Co" } }'

Sends the campaign as it would be sent, to the account owner's verified email address only. You cannot choose the recipient (409 TEST_RECIPIENT_UNAVAILABLE when the owner has no verified email), so a test can never reach a customer. The body is optional; sample supplies the values for {{name}} and {{identity_name}} (defaults Test Recipient and Example Co).

  • It uses the current template and the real sending path, so the From domain, DKIM signing and gateway rules are the real ones.
  • The subject starts with [TEST], links are placeholders, and there is no tracking pixel and no List-Unsubscribe header.
  • It records no campaign events, statistics or webhooks. It works in any campaign status.
  • Limits: 5 per campaign per hour and 20 per account per day. Beyond that the answer is 429 TEST_SEND_LIMIT with retryAfter (seconds).

The response is { "success": true, "data": { "sent_to": "...", "subject": "...", "warnings": [] } }. An unknown merge variable does not stop a test; it is listed in warnings, so you see the problem before scheduling refuses it.

Preview with compile (optional)​

POST /comm-api/api/campaigns/{id}/compile produces the same compiled message and audience snapshot for a draft or scheduled campaign without scheduling it, so you can inspect the final HTML and tracked links first. It also returns the audience size and the forecast, which makes it the right call to make before schedule: you learn how many will be sent and roughly how long it will take. It is a preview, never a required step and it never refuses on the forecast.

Sending limits and pacing​

A Motor Block has an hourly and a daily sending limit, and your plan has an account-wide ceiling shared by all your blocks. Campaigns are held to the same limits as every other way of sending, so a big campaign can take hours or days. It is not stuck when it waits: it pauses when a limit is reached and continues by itself when the hour or day rolls over (UTC). Nobody is skipped and nobody gets the message twice. Campaigns use at most 80 percent of the account ceiling, so your transactional mail always has room.

Before you schedule, compile and schedule return a forecast:

"forecast": {
"total_recipients": 50000,
"estimated_completion_at": "2026-10-29T09:00:00Z",
"estimated_duration_seconds": 262800,
"limiting_cap": "acct_daily",
"caps": { "burst": 2500, "hourly": 5000, "daily": 20000, "account_hourly": 4000, "account_daily": 16000 },
"assumes_no_other_traffic": true,
"enforced": true
},
"warnings": [{ "type": "will_span_multiple_days", "message": "..." }]
FieldMeaning
estimated_completion_atAn estimate from the limits and what is left in the current hour and day. Other traffic on the same block or account moves it. null when it cannot be estimated (see below).
limiting_capWhat holds the campaign back most: chunk_pacing (your own chunk settings), burst, hourly, daily, acct_hourly or acct_daily; null when nothing does.
enforcedtrue: the limits are applied to this campaign. false: they are not applied yet, the campaign sends at its chunk pace, and the forecast shows what it will be once they are.
warnings[].typewill_take_hours (an hour or more) or will_span_multiple_days (a day or more). Only when enforced is true.

forecast is null when it cannot be known (limits are not checked for campaigns, or the limit service is unreachable). Scheduling is never blocked because a forecast is missing.

Refusal. When limits are enforced, schedule answers 400 CAMPAIGN_CANNOT_COMPLETE if the campaign could never be sent: it would take longer than 7 days at your limits (reason: too_long), or a limit is zero (reason: cap_zero). Send to fewer recipients at a time, or raise your limits. Nothing is scheduled and nothing is sent.

While it runs, the campaign's pacing tells you what it is doing (also in the list and detail responses):

pacing.stateMeaning
not_startedA draft, or scheduled and not yet due.
runningBeing sent.
waiting_for_capA limit was reached. reason is burst, hourly, daily, acct_hourly or acct_daily, and resumes_at says when it continues.
doneCompleted.
stoppedCancelled.

The report adds sent (handed to delivery) and remaining to pacing.

Who will get it, and why not the others​

POST /comm-api/api/campaigns/{id}/compile and POST /comm-api/api/campaigns/{id}/schedule return an audience breakdown, and the number of recipients is its included figure, so the explanation can never disagree with the count:

{
"audience": {
"lists": [{ "id": "...", "name": "Newsletter", "member_count": 14, "eligible_count": 7 }],
"list_members_total": 14,
"unique_contacts": 14,
"overlap_removed": 0,
"included": 7,
"excluded": { "unsubscribed": 5, "bounced": 2, "other_inactive": 0, "suppressed": 0, "excluded_by_list": 0, "consent_not_eligible": 0 },
"adds_up": true
}
}

Each person is counted once, under the first reason that applies, in the order shown. A campaign with nobody left to send to is refused with 400 EMPTY_AUDIENCE, and the breakdown shows why.

Leave people out: exclusion lists​

Send to some lists but never to anyone on others, for example everyone on the newsletter except people who already bought:

curl -X POST https://motorical.com/comm-api/api/campaigns \
-H "Authorization: ApiKey ak_live_YOUR_KEY" \
-H "X-Tenant-Id: YOUR_WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d '{
"name": "Autumn offer, non-buyers",
"description": "Autumn offer for newsletter subscribers who have not bought yet.",
"template_id": "TEMPLATE_ID",
"list_ids": ["NEWSLETTER_LIST_ID"],
"exclude_list_ids": ["BUYERS_LIST_ID"],
"motor_block_id": "MOTOR_BLOCK_ID"
}'

exclude_list_ids takes up to 50 lists of this workspace. Only the active members of an excluded list are held back. Exclusions are fixed when the campaign is created and are copied by Duplicate. A list cannot be both sent to and excluded (400 EXCLUDE_OVERLAPS_LISTS); the other errors are TOO_MANY_EXCLUDE_LISTS, LIST_NOT_FOUND and SYSTEM_LIST_NOT_ALLOWED. People held back show as excluded_by_list in the breakdown. An excluded list cannot be deleted while a campaign excludes it (409 LIST_IN_USE).

description (at most 1000 characters) says what the campaign is and why. It is optional, shown in the detail and list, copied by Duplicate, and editable until the campaign is final.

Multi-List Targeting​

Send to multiple contact lists with automatic deduplication. If a contact appears in multiple selected lists, they receive the campaign only once. Contacts that are unsubscribed, suppressed, or in the recycle bin are never sent to.

Managing Campaigns​

List Campaigns​

GET /comm-api/api/campaigns

Use compact=true when you need campaign summaries without large compiled artifacts in the response:

GET /comm-api/api/campaigns?compact=true

Compact mode keeps campaign status, schedule, sender settings, latest audience snapshot, and a small latest artifact summary, but omits compiled HTML/text bodies. A cancelled campaign also carries status_reason when the system cancelled it (for example, a failed From-address check).

Get Campaign Details​

GET /comm-api/api/campaigns/{id}

Update Campaign Settings​

PATCH /comm-api/api/campaigns/{id}/settings
Content-Type: application/json

{
"scheduled_at": "2026-11-20T09:00:00Z",
"timezone": "Europe/Riga",
"chunk_size": 200,
"delay_seconds_between_chunks": 60
}

What can change depends on the status:

StatusCan change
draftfrom_address, from_name, reply_to (null clears it), description, template_id, list_ids and exclude_list_ids (null clears them), timezone, scheduled_at (null clears it), chunk_size (1 to 1000), delay_seconds_between_chunks (1 to 86400)
scheduledWhen it goes (scheduled_at, timezone) and the pacing. Clearing the time of a scheduled campaign would mean "send now", so it is refused: cancel it or set a new time.
sendingPacing only
completed, cancelledNothing (409 INVALID_STATE)

Only a draft can have its template_id, list_ids or exclude_list_ids changed (409 INVALID_STATE otherwise). They follow the rules of create: the template and every list must belong to this workspace, a list cannot be both sent to and excluded, and the whole change is applied or none of it. Send "dry_run": true on this call, or on POST /campaigns, to run every check and get the result without anything being written: the answer carries dry_run: true, and for an edit the changes and the previous values.

from_name and reply_to can only change while the campaign is a draft (409 INVALID_STATE afterwards), because recipients of a scheduled campaign see what was frozen when it was scheduled. The template, lists and Motor Block of a campaign are fixed once it is created. To change them, duplicate the campaign and edit the copy. Invalid values are refused before anything is written: INVALID_CHUNK_SIZE, INVALID_DELAY, INVALID_TIMEZONE (an IANA name such as Europe/Riga), INVALID_SCHEDULED_AT.

Duplicate a Campaign​

curl -X POST https://motorical.com/comm-api/api/campaigns/CAMPAIGN_ID/duplicate \
-H "Authorization: ApiKey ak_live_YOUR_KEY" \
-H "X-Tenant-Id: YOUR_WORKSPACE_ID" \
-H "Idempotency-Key: newsletter-2026-11-copy"

Works on a campaign in any status, including completed and cancelled, which are final. It creates a new draft named <name> (copy) with the same template, lists, Motor Block, From address and name, consent flag, tracking settings, timezone and pacing. The schedule, the compile and all results are not copied.

The Motor Block, template and lists are checked again as for a new campaign. Lists deleted since are left out of the copy; if none are left the answer is 409 SOURCE_LISTS_GONE. If the Motor Block has moved to another sending domain, the copy uses noreply@<new domain>. The response is the new campaign, with list_ids and copied_from.

Cancel a Campaign​

POST /comm-api/api/campaigns/{id}/cancel

Allowed for draft, scheduled and sending campaigns. Cancelled is final: a cancelled or completed campaign cannot be cancelled again, edited, restarted or rescheduled (409 INVALID_STATE). To send it again, duplicate it.

Delete a Campaign​

DELETE /comm-api/api/campaigns/{id}

Deleted campaigns go to the recycle bin and can be restored (PATCH /campaigns/{id}/restore) or removed for good (DELETE /campaigns/{id}/permanent). A scheduled campaign is cancelled as it is deleted, so it cannot send from the bin. A campaign that is sending cannot be deleted (409); cancel it first. DELETE /campaigns/cleanup permanently removes items that have been in the bin longer than olderThanDays (default 30; a whole number from 0 to 3650, otherwise 400 INVALID_DAYS).

Campaign Results​

One report computes every result, so the numbers agree across endpoints. The unit is the recipient: each recipient counts once, at the furthest stage reached.

GET /comm-api/api/campaigns/{id}/report
GET /comm-api/api/campaigns/{id}/stats
GET /comm-api/api/campaigns/{id}/analytics?days=7
  • /report returns funnel (handed_off, accepted, delivered, opened, clicked), outcomes (bounced, failed, complained), engagement, rates, a basis sentence saying how each number is counted, and pacing (is the campaign running, or waiting for a sending limit, how many were sent and how many remain).
  • /stats returns the headline counts and rates plus unsubscribed, and includes the full report.
  • /analytics adds the day-by-day breakdown for the last days days.

The report also carries sync: delivery outcomes reach the report from the mail servers with a delay, so a zero in accepted or delivered while sync.synced is false means not known yet, not failed.

Open counts exclude obvious security scanners and crawlers. Apple Mail Privacy Protection and image-proxy fetches look like real opens and are included, so treat opens as an upper bound.

Click Breakdown​

Detailed URL-level click analysis:

GET /comm-api/api/campaigns/{id}/click-breakdown

Campaign Events​

View delivery events with pagination:

GET /comm-api/api/campaigns/{id}/events?page=1&pageSize=25&status=delivered&redact=true

pageSize is at most 200. status is one of queued, sending, sent, delivered, bounced, complained, failed, blocked, opened, clicked, unsubscribed (anything else is 400 INVALID_STATUS). redact=true removes each recipient's IP address and user agent, which is useful when the data goes to an automated agent. When the call arrives through a connected assistant (an MCP connection), redaction is always on, whatever redact says.

Reading results from an assistant​

A connected assistant reads results with five read-only tools (permission read:comms, nothing new to approve): comms_get_campaign_report, comms_get_campaign_links, comms_get_campaign_timeline, comms_list_campaign_events and comms_get_analytics_overview. They return the same numbers as the endpoints above, with the denominator of every rate written out and the time the numbers are from. Recipient addresses are masked, IP addresses and user agents are never returned, and the query string of each clicked link is hidden. Events come 50 to a page. A campaign that has not sent reports that there is no data yet instead of a row of zeros, and open counts are always labelled as estimates.

Track these metrics per campaign:

MetricDescription
Delivery RateDelivered recipients over handed-off recipients
Open RateUnique opens over delivered
Click RateUnique clicks over delivered
Bounce RateHard and soft bounces
Unsubscribe RateRecipients who opted out; see Unsubscribing

Campaign States​

StateDescriptionNext
draftCreated, not scheduled. Fully editable.scheduled, cancelled
scheduledCompiled and queued, now or for scheduled_at.scheduled (reschedule), sending, cancelled
sendingBeing delivered in chunks.completed, cancelled
completedEvery message has been processed. Final.none
cancelledStopped before completion. Final.none

There is no paused state. Any status can be duplicated.

Retrying safely​

POST /campaigns, POST /campaigns/{id}/schedule and POST /campaigns/{id}/duplicate accept an Idempotency-Key header (8 to 128 characters: letters, digits, ., _, :, -). If a request times out, repeat it with the same key and the same body: the first answer is replayed (with the response header Idempotent-Replay: true) and nothing is created twice. The same key with a different request is 422 IDEMPOTENCY_KEY_REUSED; the same key while the first request is still running is 409 IDEMPOTENCY_IN_PROGRESS. Keys are per workspace and kept for 24 hours.

Errors​

CodeStatusMeaning
INVALID_ID400An id in the path or body is not a valid id.
INVALID_STATE409The campaign's status does not allow this action (see Campaign States).
CAMPAIGN_NOT_FOUND404No such campaign in this workspace (another workspace's campaign looks the same).
TEMPLATE_NOT_FOUND, LIST_NOT_FOUND404The template or a list is not in this workspace.
MOTOR_BLOCK_NOT_FOUND, MOTOR_BLOCK_NOT_ASSIGNED, MOTOR_BLOCK_FORBIDDEN400 / 403The Motor Block cannot be used by this workspace.
FROM_DOMAIN_MISMATCH400The From address is not on the Motor Block's domain.
EMPTY_AUDIENCE400Nobody is eligible to receive the campaign.
UNSUBSCRIBE_LINK_MISSING400The template has no {{unsubscribe_url}} in either body.
MERGE_VARIABLE_IN_URL400A merge variable inside a link address; urls lists them.
UNKNOWN_MERGE_VARIABLE400The template uses a tag outside the closed set; variables lists them.
INVALID_REPLY_TO400reply_to is not a single valid email address.
TEST_RECIPIENT_UNAVAILABLE409The account owner has no verified email to send a test to.
TEST_SEND_LIMIT429Too many test sends; wait retryAfter seconds.
CAMPAIGN_CANNOT_COMPLETE400The campaign can never be sent at your sending limits; see Sending limits and pacing.
SOURCE_LISTS_GONE409Every list of the campaign being duplicated has been deleted.
IDEMPOTENCY_KEY_REUSED, IDEMPOTENCY_IN_PROGRESS, INVALID_IDEMPOTENCY_KEY422 / 409 / 400See Retrying safely.