Tags in Datamailer are audience-scoped labels that let you segment contacts for campaign targeting. Three endpoints cover different tagging workflows: a bulk replace for sync operations, and single-tag add and remove for toggle-style interactions. All three require the contact to have an existing client-scoped subscription record within the specified audience.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.
Endpoints overview
PUT …/tags
Replace the full set of audience tags in one call.
POST …/tags/{tag_slug}
Add a single tag without affecting others.
DELETE …/tags/{tag_slug}
Remove a single tag without affecting others.
Authentication
All three endpoints require a Bearer token for the client whose slug is passed in the request body.PUT /api/contacts//tags
Replaces the entire set of audience-scoped tags on the contact. Tags present in the existing set but absent fromtags are removed. Tags in tags that do not yet exist for the audience are created automatically.
Path parameters
The internal Datamailer contact ID returned by prior upsert or status calls.
Request body
Complete list of tag name strings that the contact should have after this call. Pass
[] to clear all audience tags.Slug of the audience whose tags are being replaced. Scopes the operation to this audience’s tag namespace.
Slug of the authenticated client. Must match the bearer token’s client.
Example
POST /api/contacts//tags/
Adds a single tag to the contact. The tag slug is derived fromtag_slug in the URL path using Django’s slugify function. If no tag with that slug exists for the audience it is created automatically. Existing tags on the contact are not affected.
Path parameters
The internal Datamailer contact ID.
The slug of the tag to add. Must be a non-empty slugifiable string.
Request body
Slug of the audience that owns the tag namespace.
Slug of the authenticated client.
Example
DELETE /api/contacts//tags/
Removes a single tag from the contact within the specified audience. If the contact does not have the tag the call succeeds silently. Other tags are not affected.Path parameters
The internal Datamailer contact ID.
The slug of the tag to remove.
Request body
Slug of the audience that owns the tag namespace.
Slug of the authenticated client.
Example
Response
All three endpoints return HTTP200 with the full contact status payload plus the updated tags array.
tags array contains tag slugs sorted alphabetically. Tag slugs are the slugify-normalized form of the tag name passed during creation.
Error codes
| Field | Error code | Meaning |
|---|---|---|
contact_id | not_found | No contact with that ID exists, or the contact has no client subscription in this audience. Returns HTTP 404. |
audience | required | audience was missing or blank. |
audience | not_found | No audience with that slug exists in the client’s organization. |
client | required | client was missing or blank. |
client | forbidden | client does not match the authenticated client’s slug. Returns HTTP 403. |
tags | must_be_list | tags was not a JSON array (PUT only). |
tags | must_be_non_empty_strings | One or more tag entries are not non-empty strings (PUT only). |
tag | required | tag_slug path parameter was missing or blank (POST/DELETE only). |
tag | invalid | tag_slug path parameter could not be slugified to a non-empty string (POST/DELETE only). |