Zum Inhalt springen

Send DOI email

POST
/recipients/doi
Code sample: Shell / cURL
curl --request POST \
--url https://rocketem.fotone.io/api/v2/recipients/doi \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "audience": "aud_xxxxxxxxxxxx", "email": "hello@example.com", "language": "example", "first_name": "example", "last_name": "example", "salutation": "example", "company": "example", "tracking_consent": true, "tracking_consent_text_version": "example" }'

Required scope: recipients:write

Start the Double Opt-In process for an email. Creates the recipient with doi_status: pending if new, resends the DOI email if already pending, and sends an “already subscribed” mail (preference-center link, no DOI) if the address is confirmed or not_required. An address that unsubscribed earlier (reason unsubscribe, shop_unsubscribe, legacy_unsubscribe or complaint) gets a fresh DOI mail; only the click lifts the block. Every call is recorded in the organisation’s consent log (channel api_doi, the token label as actor; no IP, the caller is a server).

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
language

Language for DOI email (default: org default)

string
<= 5 characters
first_name
string
<= 100 characters
last_name
string
<= 100 characters
salutation
string
<= 20 characters
company
string
<= 255 characters
tracking_consent

Tracking consent (opens/clicks) from your own signup form. Needs the scope tracking_consent:write (without it the call answers 403). Only used while the organisation requires consent; it takes effect when the DOI link is clicked, and the DOI email names it. Omitted or false clears a tick of an earlier request.

boolean
tracking_consent_text_version

Identifier of the consent wording shown in your form (stored as api:<value>; without it the proof records that your own form’s wording was used).

string
<= 28 characters

DOI process started

Media typeapplication/json
object
data
object
email_hash
string
doi_status

The status after the call: pending after a DOI mail, the real status of an address that is already subscribed (confirmed, not_required), the unchanged status or null with skipped_rate_limit

string
nullable
outcome

doi_sent = new or re-signup after an opt-out, doi_resent = was pending, already_subscribed = “already subscribed” mail instead of a DOI, skipped_rate_limit = fourth mail to this address within 24 h, nothing sent

string
Allowed values: doi_sent doi_resent already_subscribed skipped_rate_limit
previous_status

The doi_status before the call, new for an unknown address, none for a row without status

string
nullable

Example

{
"data": {
"outcome": "doi_sent"
}
}

signup_closed: the Custom Audience named by audience has its signup closed (since 2.3.0; the newsletter takes API signups regardless). forbidden: tracking_consent sent without the tracking_consent:write scope

Email is suppressed (legal, block_all, robinson, manual, bounce, without reason) or GDPR-deleted

Validation failed

Media typeapplication/json
object
error
object
code
string
message
string
status
integer
details
object
key
additional properties
Array<string>

Example

{
"error": {
"code": "validation_error",
"message": "The given data was invalid.",
"status": 422
}
}