Tag contacts
Adds tags to up to 100 contacts and removes tags from them; removing a tag never deletes the contact. System tags cannot be set or removed. Needs an Idempotency-Key header; returns one result per distinct contact ID, and one failed contact does not stop the others.
POST /v1/contacts/tags
| Permission | contacts:write (all permissions) |
| Risk | Write (no outside effect) |
| Idempotency-Key | Required (how it works) |
| Safe to repeat | Safe to repeat with the same Idempotency-Key: the first answer comes back and nothing is done twice. |
| Rate limit class | bulk (120 requests per minute per key) |
| Confirmation | None |
| MCP tool | tag_contacts |
| Since version | 2026-10-25 |
#What it does
- Changes data in your account. It does not send messages to contacts.
- Removes data. Only allowed for the few removals that keys may do (remove a tag, unsubscribe a webhook endpoint).
- May start automations of the account, and an automation may send messages. The call itself sends nothing.
- Safe to repeat with the same Idempotency-Key.
#Request
Header
| Name | Required | Description |
|---|---|---|
Authorization | yes | Bearer <key> |
Idempotency-Key | yes | A unique value for this operation, for example a UUID (1 to 255 visible ASCII characters). |
Body (JSON)
| Name | Type | Required | Description |
|---|---|---|---|
contact_ids | array of string | yes | The contacts to change (1 to 100). up to 100 items |
add_tags | array of string | no | Tags to add. Case does not matter; stored in lower case. up to 20 items |
remove_tags | array of string | no | Tags to remove. A tag must not be in both add_tags and remove_tags. up to 20 items |
#Examples
curl -X POST "https://api.smartchat.marketing/v1/contacts/tags" \
-H "Authorization: Bearer $SMARTCHAT_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"contact_ids": [
"con_0f8c1a2e4b7d4c3e9a5b6d7e8f901234"
],
"add_tags": [
"vip"
],
"remove_tags": [
"lead"
]
}'import os
import uuid
import requests
response = requests.post(
"https://api.smartchat.marketing/v1/contacts/tags",
headers={
"Authorization": "Bearer " + os.environ["SMARTCHAT_API_KEY"],
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"contact_ids": [
"con_0f8c1a2e4b7d4c3e9a5b6d7e8f901234",
],
"add_tags": [
"vip",
],
"remove_tags": [
"lead",
],
},
)
response.raise_for_status()
print(response.json())const response = await fetch("https://api.smartchat.marketing/v1/contacts/tags", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SMARTCHAT_API_KEY}`,
"Idempotency-Key": crypto.randomUUID(),
"Content-Type": "application/json",
},
body: JSON.stringify({
"contact_ids": [
"con_0f8c1a2e4b7d4c3e9a5b6d7e8f901234"
],
"add_tags": [
"vip"
],
"remove_tags": [
"lead"
]
}),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());Response (200):
{
"object": "contact_tags_update",
"updated": 1,
"unchanged": 0,
"not_found": 0,
"failed": 0,
"results": [
{
"contact_id": "con_0f8c1a2e4b7d4c3e9a5b6d7e8f901234",
"status": "updated",
"tags": [
"vip"
],
"error_code": null
}
]
}#Response
Status 200. Every response has the headers Request-Id, SmartChat-Version and X-RateLimit-*.
| Name | Type | Description |
|---|---|---|
object | string | Always "contact_tags_update". always contact_tags_update |
updated | integer | Contacts whose tags changed. 0 to 100 |
unchanged | integer | Contacts that already had the requested state. 0 to 100 |
not_found | integer | IDs that belong to no contact of this account. 0 to 100 |
failed | integer | Contacts that could not be changed, for example because they would exceed 30 tags. See error_code in results. 0 to 100 |
results | array of object | One entry per distinct contact ID, in the order of first appearance. A repeated ID is handled once. up to 100 items |
results[].contact_id | string | Contact ID. up to 36 characters |
results[].status | string | updated, unchanged, not_found or failed. Earlier contacts of the same call stay changed. one of: updated, unchanged, not_found, failed |
results[].tags | array of string | Tags of the contact after the change. Empty if not found. Untrusted text. up to 100 items; untrusted text |
results[].error_code | string or null | Error code (see the error list) when status is failed, otherwise null. up to 60 characters |
#Errors
| Code | Status | When |
|---|---|---|
bad_request | 400 | The request could not be read. |
idempotency_key_invalid | 400 | The 'Idempotency-Key' header must be 1 to 255 visible ASCII characters. |
idempotency_key_required | 400 | This call needs an 'Idempotency-Key' header. |
missing_parameter | 400 | A required field is missing. |
unknown_parameter | 400 | A field is not known. |
api_key_expired | 401 | This API key has expired. |
api_key_invalid | 401 | This API key is not valid. |
api_key_revoked | 401 | This API key was revoked. |
authentication_required | 401 | No API key was sent. Send 'Authorization: Bearer <key>'. |
account_blocked | 403 | This account is blocked. |
insufficient_scope | 403 | This key lacks a required permission. |
ip_not_allowed | 403 | This IP address is not allowed for this key. |
idempotency_in_progress | 409 | A request with this idempotency key is still running. |
idempotency_key_reused | 422 | This idempotency key was already used with a different request. |
validation_failed | 422 | A field is not valid. |
rate_limited | 429 | Too many requests. Wait and try again. |
internal_error | 500 | Something went wrong on our side. |
service_unavailable | 503 | The service is temporarily unavailable. |
All errors use one format.