Hand in one mail for an API send
curl --request POST \ --url https://rocketem.fotone.io/api/v2/campaigns/example/messages \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "email": "kunde@example.com", "reference": "RE-2026-0001", "data": { "first_name": "Ada", "invoice_no": "2026-0001" }, "attachments": [ { "filename": "rechnung.pdf", "content": "JVBERi0xLjQK…" } ] }'Required scope: campaigns:trigger
A campaign created as an API send takes single mails from your system, for example an invoice with its PDF. One mail per call. The HTTP status alone says what became of it:
| Status | Meaning | What to do |
|---|---|---|
202 |
Taken, will be sent | nothing |
200 |
This reference was handed in before; state names what became of it |
nothing, it is not sent twice |
422 not_sent |
Not sent to this address; detail names the reason |
deliver the document another way |
422 (other codes) |
The call is refused (see below) | correct the call |
503 retry_later |
Could not be taken right now | hand in the same mail again under the same reference after Retry-After seconds |
429 |
More than 300 calls per minute | wait for Retry-After seconds and repeat |
Fields
reference(required): your own id for this mail (an invoice number, an order id, anything). It is never interpreted. A reference is taken once per campaign and address, letter for letter (RE-1aandRE-1Aare two references). Repeating a call is therefore always safe. A reference is remembered for 90 days; one answered with503, and one whose mail ended asfailedor was not sent (422 not_sent), can be handed in again: it is then checked and sent anew. While an earlier call with the same reference is still being taken, the answer is503.language: the language version of the campaign this mail goes out in (de,fr). See “Languages” below.data: values for the placeholders of the campaign’s template ({first_name}). Plain values only, names without a leading underscore, 64 KB in all. Values are HTML-escaped when inserted. The reference of the call is available as{reference}without being repeated indata.attachments: up to 3 files, base64-encoded, 5 MB each and 6 MB per mail: PDF, CSV (.csv) and plain text (.txt). The content decides: a PDF goes out as.pdfwhatever its name; text is taken only under.csvor.txt, and only text under these names. CSV and text go out byte for byte (any encoding, formulas included).html_data: up to 20 HTML blocks for placeholders of the template ({positions}), inserted as they are, 200 KB in all. Requires thecampaigns:send_htmlscope.html: the complete mail. The template of the campaign is not used then, and braces in it are plain text. Requirescampaigns:send_html.subject: a subject of the call’s own, with or withouthtml. The names the call brings itself are filled in (data,{reference},{email}); any other brace stays as it is. Withoutsubjectthe subject of the campaign applies, with its placeholders. Requirescampaigns:send_html.tracking_consent:true= the person agreed in your system to opens and clicks being measured,false= do not measure this mail (also where the organisation does not ask for consent). Not stored; opens and clicks of earlier mails of the campaign to the same address follow the answer of the latest mail sent to it (without one, the consent kept in rocketEM). A revocation kept in rocketEM or an entry on the organisation’s suppression list wins. Without it, the consent kept in rocketEM decides; where the organisation requires consent, only with the consent link in the layout ({{tracking_consent_link}}; not possible withhtml). The mail is sent either way; tracking also needs the campaign’s tracking setting.
One call may be 12 MB in all.
Languages
A campaign can carry several language versions, each with its own template, subject
and sender. They are set up on the campaign page in the card “Languages” (“Add
language”); the card appears when the organisation has more than one language
configured. language in the call picks the version:
languagenames a version of the campaign: that template, subject and sender.languagenames a language the campaign has no version of: the main language.- No
language: the fallback language of the campaign. - An address that is in the organisation’s recipient list and chose a language in the preference center gets that language, whatever the call says.
A mail handed in complete carries its own subject and html; language does not
change them.
What holds a mail back
Nothing, unless the campaign says so: it has two switches, both off by default.
“Check suppression list” leaves out addresses on the organisation’s suppression list,
“Check bounces” addresses that hard-bounced before. An exclusion list attached to the
campaign itself always applies; global exclusion lists apply to a promotional campaign only.
One entry holds a mail back whatever the switches say: ‘block_all’, set on the app’s privacy
page for an address that must get no mail at all (not_sent, detail blacklisted:block_all).
Transactional or promotional
A campaign is transactional unless “Promotional emails” is switched on at it. A transactional mail (an invoice) carries no unsubscribe headers, no list headers and no unsubscribe link.
A promotional campaign is for newsletters and offers your system triggers. Every
mail carries List-Unsubscribe (one click) and List-ID, and needs an unsubscribe
link: the template of the campaign holds an unsubscribe merge tag such as {unsubscribe}, and
html handed in with a call must contain a link whose href is the placeholder
{unsubscribe_url} (<a href="{unsubscribe_url}">…</a>, not inside a comment),
otherwise the call is refused with 422 unsubscribe_link_required. A mail built
from the template that would still leave without a visible unsubscribe link gets one
line with the link at its end. An opt-out applies to this campaign: further calls
for the address answer 422 not_sent with detail: unsubscribed, also after the
campaign is switched back to transactional, and a copy of the campaign takes the
opt-outs along. Both checks
(“Check suppression list”, “Check bounces”) are always on, and global exclusion
lists apply. Whether a recipient has consented to promotional mails is for the
system handing them in to know.
Neither kind has a web version or a preference page (placeholders for them have no target and do not belong in the template).
Tracking is off unless it is chosen at the campaign (“opens only” or “opens and clicks”). It then applies to every mail of the campaign, a mail handed in complete included: a pixel is added, and with click tracking the links are rewritten.
Limits for waiting mails
Mails that were taken and not sent yet are limited: 5,000 per campaign, 20,000 per
organisation and 2 GB of files and HTML per organisation. Sending is faster than
handing in, so the limits only matter while sending stands still. Above them a call
is answered with 503 and Retry-After; the same mail under the same reference is
taken later, nothing is lost and nothing goes out twice.
Requires the campaigns:trigger scope.
Authorizations
Abschnitt betitelt „Authorizations“Parameters
Abschnitt betitelt „Parameters“Path Parameters
Abschnitt betitelt „Path Parameters“Campaign public_id of an API send
Request Bodyrequired
Abschnitt betitelt „Request Bodyrequired“object
Recipient email
Your own id for this mail
Values for the placeholders of the template (flat, plain values, max 64 KB)
object
Language version of the campaign to send (de, en, fr). Without it the fallback language of the campaign.
object
Base64-encoded PDF, CSV or plain text, max 5 MB
HTML blocks by placeholder name, at most 20, 200 KB in all. A name the mail fills in itself (such as unsubscribe_link or salutation) is refused. Scope campaigns:send_html
object
Subject of this mail instead of the campaign’s. Names from data, {reference} and {email} are filled in. Scope campaigns:send_html
HTML of a complete mail, max 500 KB. Scope campaigns:send_html
Whether the person agreed to opens and clicks being measured, for this mail only. false = not measured, also where the organisation asks for no consent. A revocation kept in rocketEM or a suppression-list entry wins; without the field the stored consent decides. Sending never depends on it.
Examples
Layout in the campaign, values and PDF from outside
{ "email": "kunde@example.com", "reference": "RE-2026-0001", "data": { "first_name": "Ada", "invoice_no": "2026-0001" }, "attachments": [ { "filename": "rechnung.pdf", "content": "JVBERi0xLjQK…" } ]}Layout in the campaign, one HTML block from outside
The template contains the placeholder {positionen}; the block is inserted there as it is.
{ "email": "kunde@example.com", "reference": "RE-2026-0002", "data": { "first_name": "Ada", "invoice_no": "2026-0002" }, "html_data": { "positionen": "<table><tr><td>1 x Ball</td><td>9,99 €</td></tr></table>" }, "attachments": [ { "filename": "rechnung.pdf", "content": "JVBERi0xLjQK…" } ]}Complete mail from outside
{ "email": "kunde@example.com", "reference": "RE-2026-0003", "subject": "Ihre Rechnung 2026-0003", "html": "<html><body><p>Guten Tag, anbei Ihre Rechnung.</p></body></html>", "attachments": [ { "filename": "rechnung.pdf", "content": "JVBERi0xLjQK…" } ]}Responses
Abschnitt betitelt „Responses“The reference was handed in before; nothing is sent again
object
object
The state the first mail reached (see the status query)
Example
{ "data": { "reference": "RE-2026-0001", "status": "duplicate", "state": "delivered" }}Taken, will be sent
object
object
Example
{ "data": { "reference": "RE-2026-0001", "status": "queued" }}Missing scope, trigger mails not in the plan (feature_not_available), or content handed in without campaigns:send_html (html_not_allowed)
object
object
Example generated
{ "error": { "code": "example", "message": "example", "status": 1 }}No API send with this id in the organisation
object
object
Example generated
{ "error": { "code": "example", "message": "example", "status": 1 }}not_sent: the mail is not sent to this address; detail names the reason (blacklisted:<reason>,
hard_bounce, campaign_blacklist, unsubscribed for an opt-out of a promotional campaign).
invalid_email: the address cannot be mailed.
The call is refused: campaign_inactive, payload_too_large, data_not_scalar, data_key_reserved,
html_data_invalid, html_required (no template at the campaign or an empty one, and no html in the call),
unsubscribe_link_required (promotional campaign, html without a link to {unsubscribe_url}),
api_send_unavailable, attachments_not_enabled, attachment_too_large,
attachment_type_not_allowed, attachment_invalid. A missing or malformed field answers with the
usual validation error.
object
object
Examples
The campaign checks the suppression list and the address is on it
{ "error": { "code": "not_sent", "message": "The mail is not sent to this address", "status": 422, "detail": "blacklisted:unsubscribe", "reference": "RE-2026-0001" }}The file is not a PDF, CSV or plain text
{ "error": { "code": "attachment_type_not_allowed", "message": "API attachment #0 has a disallowed type image/png", "status": 422 }}Text under another name than .csv or .txt, or a PDF named .csv
{ "error": { "code": "attachment_invalid", "message": "API attachment #0: text is taken only as .csv or .txt", "status": 422 }}More than 300 calls per minute for the organisation, or more than 60 refused calls per minute from one address (unknown key, address not allowed, missing scope). Wait for the number of seconds in Retry-After and send the call again.
The mail could not be taken right now (a check or the queue was unavailable, an earlier call with the same reference is still being taken, or too many mails are waiting to be sent, see “Limits for waiting mails”). Hand it in again under the same reference after Retry-After seconds.
object
object
Example
{ "error": { "code": "retry_later", "message": "The mail could not be taken right now. Hand it in again under the same reference.", "status": 503 }}Headers
Abschnitt betitelt „Headers“Seconds to wait