Suppression is Datamailer’s mechanism for permanently blocking email to a contact. When a suppression flag is set, the contact is removed from all future marketing sends and — for hard bounces and complaints — transactional sends too. Every suppression change that activates a flag is recorded as an immutableDocumentation 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.
EmailEvent, giving you a complete audit trail of why a contact stopped receiving email.
This page also covers the related PATCH /api/contacts/{contact_id}/validation endpoint, which stores external email hygiene decisions from validation providers.
PATCH /api/contacts//suppression
Sets or clears one or more global suppression flags on a contact. Only the fields you include are modified — omitted flags are left unchanged.Authentication
Requires a Bearer token for the client whose slug is passed in the request body.Path parameters
The internal Datamailer contact ID.
Request body
Pass
true to set global_unsubscribed_at to the current time, marking the contact as globally opted out of marketing. Pass false to clear the flag. Omit the field to leave it unchanged.Pass
true to set hard_bounced_at to the current time. Pass false to clear. Omit to leave unchanged.Pass
true to set complained_at to the current time. Pass false to clear. Omit to leave unchanged.Free-text reason stored in the
metadata of any EmailEvent records created by this call. Useful for recording the source (e.g. "ses-bounce", "user-request"). Defaults to an empty string.Slug of the audience used to scope the contact lookup and event creation.
Slug of the authenticated client. Must match the bearer token’s client.
Side effects
When a suppression flag transitions from unset to set, Datamailer appends anEmailEvent record for audit purposes:
| Flag set | Event type recorded |
|---|---|
global_unsubscribed | unsubscribe |
hard_bounced | bounce |
complained | complaint |
true. Clearing a flag does not create an event. Already-set flags that you pass true to again are not double-recorded.
Example
Response
PATCH /api/contacts//validation
Stores an external email validation result on the contact. Use this endpoint to record hygiene decisions from a third-party validation provider without going through the upsert flow.Path parameters
The internal Datamailer contact ID.
Request body
The validation result. One of:
unknown, valid, invalid_syntax, no_mx, disposable, risky, manually_invalid, externally_validated. Defaults to unknown when omitted.Free-text reason from the validation provider, stored as-is. Defaults to an empty string.
ISO-8601 timestamp of when validation was performed. Defaults to the current server time when the status or reason has changed, or preserves the existing timestamp when the values are identical. Pass
status: "unknown" to clear the timestamp.Slug of the audience used to scope the contact lookup.
Slug of the authenticated client.
Example
Response
Returns the same full contact payload shape as the suppression endpoint, withcan_send_marketing updated to reflect the new validation state. Statuses invalid_syntax, no_mx, disposable, risky, and manually_invalid all block marketing sends.
Suppression error codes
| Field | Error code | Meaning |
|---|---|---|
contact_id | not_found | No contact with that ID, or no client subscription in this audience. Returns HTTP 404. |
audience | required | audience was missing or blank. |
audience | not_found | No audience with that slug in the client’s organization. |
client | required | client was missing or blank. |
client | forbidden | client does not match the authenticated client. Returns HTTP 403. |
global_unsubscribed | must_be_boolean | Flag value is not a JSON boolean. |
hard_bounced | must_be_boolean | Flag value is not a JSON boolean. |
complained | must_be_boolean | Flag value is not a JSON boolean. |
reason | must_be_string | reason is not a string. |
status | invalid | Validation status is not a recognized EmailValidationStatus value. (Validation endpoint only.) |