Skip to content

Tags

Tag contacts for organization, filtering, and automation triggers.

GET
/tags

List all tags with contact counts.

Query Parameters

NameTypeRequiredDescription
searchstringOptionalSearch tags by name.
limitintegerOptionalNumber of tags to return (default: 100, max: 1000).
offsetintegerOptionalNumber of tags to skip for pagination (default: 0).
curl "https://api.topmail.so/api/v1/tags?search=vip&limit=20" \
-H "Authorization: Bearer tm_live_abc123"
GET
/tags/:id

Retrieve a single tag by ID.

curl https://api.topmail.so/api/v1/tags/TAG_ID \
-H "Authorization: Bearer tm_live_abc123"
POST
/tags

Create a new tag.

Request Body

NameTypeRequiredDescription
namestringRequiredTag name (max 50 characters).
colorstringOptionalHex color code (default: #6366f1).
descriptionstringOptionalTag description (max 200 characters).
curl -X POST https://api.topmail.so/api/v1/tags \
-H "Authorization: Bearer tm_live_abc123" \
-H "Content-Type: application/json" \
-d '{
"name": "Beta Tester",
"color": "#10b981",
"description": "Users in the beta program"
}'

Color Format

Colors must be valid hex codes (e.g. #6366f1). If omitted, the default indigo color #6366f1 is used.

PATCH
/tags/:id

Update a tag. Only provided fields are modified.

Request Body

NameTypeRequiredDescription
namestringOptionalUpdated tag name.
colorstringOptionalUpdated hex color code.
descriptionstring | nullOptionalUpdated description. Set to null to clear.
curl -X PATCH https://api.topmail.so/api/v1/tags/TAG_ID \
-H "Authorization: Bearer tm_live_abc123" \
-H "Content-Type: application/json" \
-d '{"name": "Early Adopter", "color": "#f59e0b"}'
DELETE
/tags/:id

Permanently delete a tag. All tag assignments are removed from contacts.

curl -X DELETE https://api.topmail.so/api/v1/tags/TAG_ID \
-H "Authorization: Bearer tm_live_abc123"

Tag Assignments

Manage which contacts are assigned to a tag.

GET
/tags/:id/contacts

List contacts assigned to a tag.

Query Parameters

NameTypeRequiredDescription
limitintegerOptionalNumber of contacts to return (default: 100, max: 1000).
offsetintegerOptionalNumber of contacts to skip for pagination (default: 0).
curl "https://api.topmail.so/api/v1/tags/TAG_ID/contacts?limit=50" \
-H "Authorization: Bearer tm_live_abc123"
POST
/tags/:id/contacts

Assign a tag to one or more contacts.

Request Body

NameTypeRequiredDescription
contact_idsstring[]RequiredArray of contact UUIDs to tag (min: 1, max: 500).
curl -X POST https://api.topmail.so/api/v1/tags/TAG_ID/contacts \
-H "Authorization: Bearer tm_live_abc123" \
-H "Content-Type: application/json" \
-d '{
"contact_ids": [
"c1a2b3c4-d5e6-7890-abcd-ef1234567890",
"c2b3c4d5-e6f7-8901-bcde-f12345678901"
]
}'
DELETE
/tags/:id/contacts

Remove a tag from one or more contacts.

Request Body

NameTypeRequiredDescription
contact_idsstring[]RequiredArray of contact UUIDs to untag (min: 1, max: 500).
curl -X DELETE https://api.topmail.so/api/v1/tags/TAG_ID/contacts \
-H "Authorization: Bearer tm_live_abc123" \
-H "Content-Type: application/json" \
-d '{
"contact_ids": ["c1a2b3c4-d5e6-7890-abcd-ef1234567890"]
}'
Developer Docs - TopMail