Campaigns
Send a campaign to the people you list
POST/v1/campaigns/{id}/trigger
Requires an API key with the campaigns:send scope. About keys and scopes
Takes an Idempotency-Key header: a retry with the same key returns the first result instead of acting twice. Derive the key from what you are sending, and reuse it on every retry. About idempotency
Sends a draft now to the contacts recipients names, by contactId, externalId or email, instead of its saved audience; it needs none. Each person may carry their own data, read in the content as {{ data.<key> }} over the shared data: "the item in your basket is now cheaper", to each their item. Up to 5,000 recipients, the request up to 10 MB. A recipient that names no contact is not sent and comes back in notFound; one contact listed twice is refused with 400. Each message is checked as any campaign send is (consent, suppression, topic, limits), and a message whose content reads a value its recipient lacks is skipped with missing_merge_tag. Data is kept on a message only until it is sent. A campaign whose content reads data can go out only this way. A campaign is sent at most once. An Idempotency-Key header is required: a retry with the same key and request returns the first answer, notFound included, with Idempotency-Replay: true; the same key with a different request is 409 IDEMPOTENCY_KEY_REUSED, and any other trigger of a campaign already sent is 409 CONFLICT: to send again, duplicate it. Agent keys are refused with 403, and a campaign an agent wrote or edited answers 409 AGENT_CONFIRMATION_REQUIRED until a person confirms it in the dashboard.
Path parameters
idstringrequireduuid
Header parameters
Idempotency-Keystringrequired8–255 characters
Request body
dataobjectoptionalValues every recipient shares.
recipientsobject[]requiredThe people to send to, each named by one identifier.
at least 1 item · at most 5000 items
One of 3 shapes
- Recipient by contact ID
2 child attributes
contactIdstringrequiredKirora's id for the contact.
uuid
dataobjectoptionalThis person's values; each key overrides the trigger's shared
data.
- Recipient by external ID
2 child attributes
externalIdstringrequiredYour own id for the contact, as set with identify.
1–255 characters
dataobjectoptionalThis person's values; each key overrides the trigger's shared
data.
- Recipient by email
2 child attributes
emailstringrequiredThe contact's email address, matched trimmed and without case.
dataobjectoptionalThis person's values; each key overrides the trigger's shared
data.
Returns
Returns 202 Accepted with a TriggeredCampaign in data. Otherwise returns an error; Errors lists every code and which to retry.
campaignCampaignrequired17 child attributes
idstringrequireduuid
namestringrequiredchannelsstring[]requiredThe channels it sends on.
groupIdstring | nullrequiredThe group it goes to, if any.
uuid
segmentIdstring | nullrequiredThe segment it goes to, if any.
uuid
audienceRulesobject | nullrequiredInline rules choosing the audience, if any. At most one audience is set.
One of 2 shapes
- Match all
1 child attribute
allobject[]requiredEvery rule or nested group must match.
at least 1 item · at most 20 items
- Match any
1 child attribute
anyobject[]requiredAt least one rule or nested group must match.
at least 1 item · at most 20 items
topicIdstring | nullrequiredSends only to contacts the topic reaches;
nullsends to everyone with consent.uuid
messageLimitsMessageLimitUserequired2 child attributes
applybooleanrequiredretryHoursintegeroptionalmin 0 · max 48
utmobject | nullrequiredUTM parameters added to the links in the email.
6 child attributes
enabledbooleanrequiredsourcestringoptional1–100 characters
mediumstringoptional1–100 characters
campaignstringoptional1–100 characters
contentstringoptional1–100 characters
termstringoptional1–100 characters
contentCampaignContentrequired4 child attributes
emailobjectoptionalThe email fields; any may be missing on a draft.
6 child attributes
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
htmlstringoptionalThe HTML body. Rendered from the design when one is set.
1–512000 characters
textstringoptionalThe plain-text alternative.
1–512000 characters
fromstringoptionalThe sender address, on a verified sending domain.
1–320 characters
replyTostringoptionalWhere replies go.
email
pushProjectIdstringoptionalThe push app the notification goes out through.
uuid
pushobjectoptionalThe notification content.
13 child attributes
titlestringoptionalThe notification title (up to 100 characters).
1–100 characters
bodystringoptionalThe 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
2 child attributes
titlestringrequiredThe button label.
1–30 characters
urlstringrequiredThe HTTPS page the button opens.
uri · up to 2048 characters
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.3 child attributes
iosobjectoptionalReplaces shared fields on iOS.
androidobjectoptionalReplaces shared fields on Android.
webobjectoptionalReplaces shared fields on web.
templateSnapshotobjectoptionalThe email design, copied into the campaign so later template edits do not change it.
4 child attributes
schemaVersionintegerrequiredmin > 0 · max 1000
blocksEmailBlock[]requiredAt most 200 blocks across the entire tree and five levels including the root. Footer blocks must remain at root. Known child fields are validated recursively.
at least 1 item · at most 200 items
7 child attributes
idstringrequiredIdentifies the block within the template; unique among its blocks.
1–128 characters
typestringrequiredThe block type:
header,heading,text,image,button,divider,spacer,columns,columns3,imagetext,imagegroup,boxed,quote,list,product,video,social,menu,html,section,footer,repeat,shared. Each type reads its own fields next totype; an unknown type is kept but not validated.1–64 characters
styleEmailBlockStyleoptionalVisual overrides for this block, such as colours, font and spacing.
visibleIfobjectoptionalShow the block only to contacts these segment rules match, checked as each message is rendered. Omit to show it to everyone. Not allowed on the footer.
showOnstringoptionalShow the block only on phones (screens up to 620px) or only on wider screens. Clients that ignore screen size show the desktop version, and so does plain text. Omit to show it everywhere. Not allowed on the footer.
one of
mobile,desktopcolumnsobject[][]optionalNested child block arrays: exactly two for columns, three for columns3. Each child follows this block contract. Omit to retain legacy text columns.
at most 3 items
blocksobject[]optionalA section's child blocks, drawn inside its box; or a repeat block's, written out once per item of its
list, where{{ item.<field> }}reads that item. Repeats do not nest.at most 200 items
themeEmailThemerequired11 child attributes
fontstringoptionalBody font stack, such as
Inter, sans-serif.up to 200 characters
hfontstringoptionalHeading font stack.
up to 200 characters
bgstringoptionalBackground of the email card, as hex.
canvasstringoptionalBackground behind the card, as hex.
textstringoptionalDefault text colour, as hex.
accentstringoptionalBrand colour for buttons and highlights, as hex.
linkstringoptionalLink colour, as hex.
widthstringoptionalWidth of the email card on wide screens.
one of
560px,600px,680pxradiusstringoptionalCorner rounding of the email's card.
one of
0px,6px,12px,16px,24px,999pxbtnRadiusstringoptionalButton corners;
radiusrounds the email's card and, when this is unset, buttons.one of
0px,6px,12px,16px,24px,999pxbtnstringoptionalButton style.
one of
solid,outline
plainTextOverridestring | nulloptionalPlain text sent instead of the version generated from the blocks.
up to 512000 characters
statusstringrequiredWhere the campaign is in its lifecycle.
one of
draft,scheduled,sending,sent,cancelledsendAtstring | nullrequiredWhen it is scheduled to send, if at all.
date-time
localSendAtstring | nullrequiredSet for a local-time send: the wall-clock time each contact receives it at.
archivedAtstring | nullrequiredWhen it was archived; archived campaigns are left out of the list by default.
date-time
revisionintegerrequiredRaised by every edit. Send it back as
expectedRevisionon the update so a change made since you read it is refused instead of overwritten.min > 0 · max 2147483647
createdAtstringrequireddate-time
updatedAtstringrequireddate-time
notFoundobject[]requiredRecipients that name no contact in the workspace, as listed; not sent.
One of 3 shapes
- Contact ID
1 child attribute
contactIdstringrequiredKirora's id for the contact.
uuid
- External ID
1 child attribute
externalIdstringrequiredYour own id for the contact, as set with identify.
1–255 characters
1 child attribute
emailstringrequiredThe contact's email address, matched trimmed and without case.
email · up to 320 characters