Zum Inhalt springen

Trigger a campaign for specific recipients

POST
/campaigns/{campaignId}/trigger
Code sample: Shell / cURL
curl --request POST \
--url https://rocketem.fotone.io/api/v2/campaigns/example/trigger \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "email": "hello@example.com", "data": {}, "language": "example" }'

Required scope: campaigns:trigger

Send a trigger campaign to one or more recipients. The campaign must be of type trigger and have mail_status: trigger_active.

Supports single recipient (email + data) or batch mode (recipients array, max 100). Each recipient can include personalization data that is available as merge tags: the keys of data are used flat ({first_name}), values are HTML-escaped when inserted. data may be at most 64 KB per recipient (payload_too_large).

A campaign created as an API send does not take this call (use_messages_endpoint): its mails are handed in one by one with POST /campaigns/{campaignId}/messages.

campaignId
required
string

Campaign public_id

Idempotency-Key
string
<= 255 characters

Unique key for idempotent requests. Responses cached 24h.

Media typeapplication/json
One of:
object
email
required

Recipient email

string format: email
data

Personalization data (available as merge tags)

object
key
additional properties
any
language

Language code (de, en, fr)

string
<= 10 characters

Example generated

{
"email": "hello@example.com",
"data": {},
"language": "example"
}

Trigger result

Media typeapplication/json
object
data
object
triggered

Number of recipients successfully queued

integer
skipped

Number of recipients skipped

integer
details
Array<object>
object
email
string
status

deferred (reason retry_later): a suppression check was temporarily unavailable — nothing was sent; send this recipient again later.

string
Allowed values: queued sent skipped deferred error
reason
string
detail

Why a recipient was skipped (e.g. blacklisted:unsubscribe, hard_bounce, not_in_audience)

string
nullable

Example

{
"data": {
"details": [
{
"status": "queued"
}
]
}
}

Missing scope or trigger mails not in the plan (feature_not_available)

Media typeapplication/json
object
error
object
code
string
message
string
status
integer

Example generated

{
"error": {
"code": "example",
"message": "example",
"status": 1
}
}

Resource not found

Media typeapplication/json
object
error
object
code
string
message
string
status
integer

Example generated

{
"error": {
"code": "example",
"message": "example",
"status": 1
}
}

Campaign is not a trigger campaign, not active, an API send (use_messages_endpoint) or an e-mail of an automation (owned_by_automation: start the automation with POST /automations/trigger)

Media typeapplication/json
object
error
object
code
string
message
string
status
integer

Example generated

{
"error": {
"code": "example",
"message": "example",
"status": 1
}
}