Zum Inhalt springen

Subscribe a recipient

POST
/recipients/subscribe
Code sample: Shell / cURL
curl --request POST \
--url https://rocketem.fotone.io/api/v2/recipients/subscribe \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "audience": "aud_xxxxxxxxxxxx", "email": "hello@example.com", "consent_at": "2026-04-15T12:00:00Z", "consent_source": "example", "tracking_consent": true, "tracking_consent_at": "2026-04-15T12:00:00Z" }'

Required scope: subscriptions:write

Subscribes without double opt-in: lifts an opt-out from the suppression list when its reason is ‘unsubscribe’, ‘shop_unsubscribe’ or ‘legacy_unsubscribe’ and restores the mailable status. Legal blocks, bounces, manual blocks, complaints and GDPR-deleted addresses stay (409). The call is recorded in the organisation’s consent log (channel api_subscribe, the token label as actor).

Shops with write-back hear of the subscribe only when you state the consent with consent_at, or when the organisation switched on write-back for API subscribes without consent details (default: off). consent_at becomes the recipient’s consent date (consent_source as api:<source>) unless a newer one is stored, also for an address that is already subscribed. A consent_at not after the opt-out it would lift is refused (409): the opt-out withdrew that consent.

Idempotency-Key
string
<= 255 characters

Unique key for idempotent requests. Responses cached 24h.

Media typeapplication/json
object
audience

The audience to work on, by its identifier (aud_ plus 12 characters): in the app under Settings > Preference Center > General (and Settings > API with Custom Audiences on), or as id in GET /audiences. The first audience’s identifier, or none, addresses the newsletter. A Custom Audience’s table has no shop figures (total_revenue, order_count, first_order_date, last_order_date: 422); the organisation’s custom fields exist there too (since 2.3.0); its doi_status is one of pending, confirmed, not_required, unsubscribed, cleaned. A newsletter opt-out does not block an audience; complaints, bounces and legal blocks do.

string
/^aud_[A-Za-z0-9]{12}$/

Example

aud_xxxxxxxxxxxx
email
required
string format: email
consent_at

When the person consented to the newsletter in your system (not in the future). With it the subscribe is passed on to the shops with write-back.

string format: date-time
consent_source

Where that consent was given (e.g. checkout), stored as api:<source>

string
<= 80 characters
tracking_consent

Tracking consent (opens/clicks) from your system; needs tracking_consent:write. Same rules as a file import: without tracking_consent_at it never changes a stored decision; false only withdraws an older consent; a withdrawal the person made in rocketEM is never lifted. For single withdrawals use PUT /recipients/tracking-consent.

boolean
tracking_consent_at

When the person decided in your system (not in the future)

string format: date-time

Subscription status

Media typeapplication/json
object
data
object
email_hash
string
status
string
Allowed values: subscribed
previous_status

The opt-out that was lifted, or subscribed when the address was not blocked (nothing changed). For an audience row its previous doi_status (unsubscribed, cleaned).

string
Allowed values: subscribed unsubscribe shop_unsubscribe legacy_unsubscribe unsubscribed cleaned
tracking_consent

Only when tracking_consent was sent; failed = the recipient change was saved, the consent was not (send it again)

string
Allowed values: granted revoked unchanged failed

Example

{
"data": {
"status": "subscribed",
"previous_status": "subscribed",
"tracking_consent": "granted"
}
}

Tracking_consent sent without the tracking_consent:write scope

Resource not found

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

Example generated

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

Cannot re-subscribe (legal block, block_all, Robinson list, bounce, manual block, complaint, or GDPR-deleted)

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

Example generated

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