Zum Inhalt springen

Unsubscribe a recipient

POST
/recipients/unsubscribe
Code sample: Shell / cURL
curl --request POST \
--url https://rocketem.fotone.io/api/v2/recipients/unsubscribe \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "audience": "aud_xxxxxxxxxxxx", "email": "hello@example.com", "reason": "gdpr-tool", "scope": "list" }'

Required scope: subscriptions:write

Adds the email to the suppression list with reason ‘unsubscribe’. With audience the opt-out is the row’s status in that audience table (doi_status = unsubscribed); the organisation’s suppression list is not touched, so the person still receives the newsletter. With scope=all the person is unsubscribed from everything: the suppression list gets reason unsubscribe_all, which blocks the newsletter and every audience (use it for a shop’s global opt-out). scope=all is accepted for any address, also one that is in no list yet, and ignores audience.

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
reason

Source/context for the unsubscribe (stored as ‘source’ in blacklist)

string

Example

gdpr-tool
scope

list (default) unsubscribes from the newsletter or the given audience only, all from everything. Since 2.2.0.

string
default: list
Allowed values: list all

Unsubscribed

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

Example

{
"data": {
"status": "unsubscribed"
}
}

Resource not found

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

Example generated

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

The unsubscribe could not be stored; nothing changed, send it again