Documentation Index
Fetch the complete documentation index at: https://mintlify.com/DataTalksClub/datamailer/llms.txt
Use this file to discover all available pages before exploring further.
POST /api/subscriptions/unsubscribe records an unsubscribe for an existing or new contact. The required scope field controls how broadly the unsubscribe applies — from a single client integration, across every client in an audience, or globally across all marketing email managed by Datamailer. The contact is upserted by normalized email if it does not exist yet, so this endpoint is safe to call even for addresses that have never subscribed.
Authentication
All requests must include a Bearer token issued for the target client.Request
Method and path:POST /api/subscriptions/unsubscribe
Content-Type: application/json
Body Parameters
The contact’s email address. Trimmed and validated; looked up by its
normalized (lowercased) form.
Slug of the audience the contact belongs to. Must exist within the
authenticated client’s organization.
Slug of the authenticated client. Must match the token’s client slug.
Cross-client writes return HTTP 403.
How broadly to apply the unsubscribe. One of:
client— marks the client-scoped subscription asunsubscribed.audience— marks every client subscription within the audience asunsubscribed.global— setsglobal_unsubscribed_aton the contact, blocking all marketing email managed by Datamailer.
Optional free-text reason for the unsubscribe. Stored in
unsubscribe_reason on the affected subscription(s). Defaults to an empty
string.Scope Behavior
client
Calls
unsubscribe_contact with the specific client argument. Only the
subscription record for this audience + client pair is updated.audience
Calls
unsubscribe_contact without a client argument. All client
subscriptions within the audience are set to unsubscribed, and an
audience-level subscription record is created if one does not exist.global
Sets
global_unsubscribed_at on the contact record. This flag is checked
before every marketing send and blocks delivery across all audiences and all
clients managed by this Datamailer instance.Response
HTTP200 OK on success. The response is the standard contact status payload plus a scope echo field.
Internal ID of the contact record.
Normalized email address.
true when the contact has a subscription visible to the authenticated client.Whether the contact or subscription is verified.
ISO 8601 timestamp, or
null.Current email validation state for the contact.
true when global_unsubscribed_at is set on the contact — this will be
true after a global scope unsubscribe.true when the contact has a hard bounce on record.true when the contact has filed a spam complaint.Whether marketing email can currently be sent to this contact from this client.
Whether transactional email can currently be sent to this contact.
Echo of the
scope value that was applied: client, audience, or global.