Transactional
Send up to 100 transactional messages
POST/v1/transactional/messages/batch
Requires an API key with the transactional:send scope. About keys and scopes
Each entry takes its own idempotencyKey, so retrying the whole batch never acts twice on an entry that already went through. About idempotency
Each entry is a single send (see POST /v1/transactional/messages) with its own idempotencyKey, answered on its own: results keeps the order of sends, each with its messages and replayed, or the error a single send would have returned. One refused entry does not stop the rest. The call counts against the rate limit as one request per entry.
Request body
sendsobject[]requiredat least 1 item · at most 100 items
2 child attributes
idempotencyKeystringrequiredAs the
Idempotency-Keyheader of a single send: one per message you mean.8–255 characters
sendSendTransactionalInputrequired11 child attributes
toobjectrequiredWho receives it.
One of 3 shapes
- By contact id
1 child attribute
contactIdstringrequiredAn existing contact.
uuid
- By external id
5 child attributes
externalIdstringrequiredYour own id for the contact. Alone it must match an existing contact; with
emailor profile fields the contact is created or updated, as identify does.1–255 characters
emailstringoptionalSets or updates the contact email.
email · up to 320 characters
firstNamestring | nulloptional1–100 characters
lastNamestring | nulloptional1–100 characters
attributesobjectoptionalCustom attributes, merged key by key;
nullremoves one. At most 50 keys and 16 KB.
- By email
4 child attributes
emailstringrequiredThe recipient's address. With profile fields the contact is created or updated, as identify does; alone, an email send creates a transactional-only contact when none has it, and a push-only send needs an existing contact.
email · up to 320 characters
firstNamestring | nulloptional1–100 characters
lastNamestring | nulloptional1–100 characters
attributesobjectoptionalCustom attributes, merged key by key;
nullremoves one. At most 50 keys and 16 KB.
sensitivebooleanoptionalSet when the message carries a secret (a reset link, a one-time code): its content is never kept, whatever
retainContentand the workspace's retention say.correlationIdstringoptionalYour own reference for this send, echoed on its webhooks and its read.
1–255 characters
retainContentbooleanoptionalfalsediscards what was sent as soon as it is sent.emailobjectoptionalInline content (
subject,from,html), or a storedtemplateId.One of 2 shapes
- Stored template
6 child attributes
templateIdstringrequiredThe template's id, or its
alias(such aspassword-reset).dataobjectoptionalValues for the template's
{{ data.* }}merge tags.subjectstringoptionalThe subject line. Merge tags are allowed.
1–998 characters
previewTextstringoptionalShown by inboxes after the subject. Merge tags are allowed; keep it near 100 characters.
1–255 characters
fromstringoptionalThe sender address, on a verified sending domain.
1–320 characters
replyTostringoptionalWhere replies go.
email
- Inline content
6 child attributes
subjectstringrequiredThe subject line. Merge tags are allowed.
1–998 characters
previewTextstringoptionalShown by inboxes after the subject. Merge tags are allowed; keep it near 100 characters.
1–255 characters
htmlstringrequiredThe HTML body. Rendered from the design when one is set.
1–512000 characters
textstringoptionalThe plain-text alternative.
1–512000 characters
fromstringrequiredThe sender address, on a verified sending domain.
1–320 characters
replyTostringoptionalWhere replies go.
email
pushobjectoptionalA push notification to the contact's devices. Give
push,email, or both.2 child attributes
pushProjectIdstringrequiredReaches the contact's devices on every app of the project.
uuid
contentobjectrequired13 child attributes
titlestringrequiredThe notification title (up to 100 characters).
1–100 characters
bodystringrequiredThe notification text (up to 500 characters).
1–500 characters
actionUrlstringoptionalThe HTTPS page opened when the notification is tapped.
uri · up to 2048 characters
imageUrlstringoptionalA large picture: web and Android show it; iOS needs the app's service extension.
uri · up to 2048 characters
iconUrlstringoptionalWeb only; iOS and Android show the app's own notification icon.
uri · up to 2048 characters
dataobjectoptionalUp to 10 string key-value pairs passed to the app untouched, for deep links and in-app routing.
buttonsobject[]optionalUp to 2 action buttons.
at least 1 item · at most 2 items
collapseKeystringoptionalA newer notification with the same key replaces the older one on the device.
soundstringoptionalThe name of a sound the app ships; the device's default if unset.
1–64 characters
badgeintegeroptionalThe number shown on the iOS app icon.
min 0 · max 99999
ttlSecondsintegeroptionalSeconds a provider keeps trying an offline device (up to 28 days); defaults to 86400 (one day).
min 0 · max 2419200
urgencystringoptionalhighwakes the device now;normallets it wait for a good moment to save battery. Unset, a transactional push ishighand any othernormal.one of
high,normaloverridesobjectoptionalFields that differ on one platform, each replacing the shared one there (a whole
datamap, not merged key by key). On iOS and AndroidactionUrlmay be an app link such asmyapp://orders; the shared one and the web one must be HTTPS.
attachmentsEmailAttachmentInput[]optionalFiles the email carries (not push): up to 10, 10 MB in all.
at least 1 item · at most 10 items
3 child attributes
filenamestringrequiredIts extension sets the type it is sent as.
1–255 characters
contentstringrequiredThe file, base64-encoded.
base64
contentIdstringoptionalShows an image inside the body instead of attaching it: the HTML refers to it as
<img src="cid:<contentId>">.
threadingEmailThreadingInputoptionalPlaces the email in an existing conversation, as the
In-Reply-ToandReferencesheaders.2 child attributes
inReplyTostringrequiredThe
Message-IDof the email being replied to, angle brackets included.referencesstring[]optionalThe
Message-IDs earlier in the conversation, oldest first (up to 20).at least 1 item · at most 20 items
trackingTransactionalEmailTrackingInputoptionalOpen and click tracking for this email; off unless asked for. Contacts whose
countryis in the EEA or the UK are never tracked.2 child attributes
opensbooleanoptionalTrack opens with a pixel.
default
falseclicksbooleanoptionalRewrite links to track clicks.
default
false
sendAtstringoptionalWhen to send, up to 90 days ahead, with its UTC offset. Suppression and push reachability are checked when the request is accepted and again when it goes;
deliver: firstpicks its channel when accepted.date-time
deliverstringoptionalWith both
pushandemail:allsends each the contact can receive;firstsends push when the contact has a reachable device, else email.one of
all,first· default"all"
Returns
Returns 202 Accepted with a TransactionalBatchResult in data. Otherwise returns an error; Errors lists every code and which to retry.
resultsobject[]requiredOne of 2 shapes
- Accepted
3 child attributes
idempotencyKeystringrequiredreplayedbooleanrequiredTrue when this key had already been accepted; nothing new was sent.
messagesTransactionalMessage[]required6 child attributes
idstringrequireduuid
channelstringrequiredone of
email,pushstatusstringrequiredone of
queued,sending,skipped,sent,failed,delivered,bounced,complainedcorrelationIdstring | nullrequiredThe
correlationIdgiven when it was sent, if any.createdAtstringrequireddate-time
sendAtstring | nullrequiredWhen a timed email goes out; null when it went at once.
date-time
- Rejected
2 child attributes
idempotencyKeystringrequirederrorobjectrequired4 child attributes
codestringrequiredone of
BAD_REQUEST,ALREADY_EXISTS,CONFLICT,IN_USE,FORBIDDEN,INTERNAL_ERROR,NOT_FOUND,RATE_LIMITED,REVISION_CONFLICT,SERVICE_UNAVAILABLE,UNAUTHORIZED,VALIDATION_ERROR,API_KEY_IP_NOT_ALLOWED,AGENT_CONFIRMATION_REQUIRED,EMBED_ORIGIN_NOT_ALLOWED,WORKSPACE_SUSPENDED,WORKSPACE_DELETION_PENDING,CONTACT_SEND_IN_PROGRESS,EXPORT_UNAVAILABLE,NOTHING_TO_EXPORT,EVENT_NAME_LIMIT_REACHED,PLAN_LIMIT_REACHED,PLAN_FEATURE_UNAVAILABLE,CAMPAIGN_AUDIENCE_CONFLICT,EMPTY_AUDIENCE,INVALID_CAMPAIGN_CONTENT,DRAFT_INCOMPLETE,INVALID_SCHEDULE,UNSUPPORTED_CHANNEL,POSTAL_ADDRESS_MISSING,CONSENT_MISSING,SUPPRESSED,SIGNUP_BLOCKED,INVALID_SENDER_ADDRESS,SENDING_DOMAIN_DMARC_MISSING,SENDING_DOMAIN_IDENTITY_CONFLICT,SENDING_DOMAIN_UNVERIFIED,IDEMPOTENCY_KEY_REUSED,CONTENT_NOT_RETAINED,RECIPIENT_EMAIL_MISSING,TEMPLATE_NOT_PUBLISHED,TEMPLATE_ENVELOPE_INCOMPLETE,PUSH_APP_NOT_READY,PUSH_DESTINATION_MISSINGmessagestringrequireddetailsobjectoptionalrequestIdstringoptional