Overview
Update (replace) all tags for a specific contact. This endpoint completely replaces the contactโs current tags with a new set of tag IDs. Use this when you want to set the exact tag list for a contact. Tags help you organize, filter, and segment contacts based on characteristics, behaviors, or any custom criteria relevant to your business.Use Cases
- Contact Categorization: Organize contacts by customer type, status, or segment
- Workflow Automation: Update tags based on customer actions or events
- Data Sync: Sync tags from external CRM systems
- Bulk Updates: Programmatically update contact tags in batch operations
- Customer Journey: Tag contacts as they progress through your funnel
- Segmentation: Create dynamic segments based on tag combinations
Authentication
This endpoint requires authentication using an API key. Include your API key in the request header:Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
aiContactId | string (UUID) | Yes | Unique identifier of the contact |
Request Body
Field | Type | Required | Description |
---|---|---|---|
tagsIds | number[] | Yes | Array of tag IDs to assign to the contact |
Response Structure
Field | Type | Description |
---|---|---|
status | string | Status of the operation (always โsuccessโ) |
aiContactTagsLength | number | Total number of tags assigned to the contact |
Example Request
Example Response
Common Use Cases
1. Replace All Contact Tags
2. Remove All Tags from Contact
3. Update Tags Based on Customer Behavior
4. Sync Tags from External CRM
5. Bulk Tag Update for Multiple Contacts
6. Add Tag Without Removing Existing Ones
Important Behavior
โ ๏ธ Replaces All Tags
This endpoint replaces the contactโs tags completely. If a contact has tags[1, 2, 3]
and you send tagsIds: [4, 5]
, the contact will end up with only [4, 5]
.
Before: Contact has tags [1, 2, 3]
Request: { "tagsIds": [4, 5] }
After: Contact has tags [4, 5]
Adding vs Replacing
- To add a tag: First get existing tags, append new ID, then update
- To remove a tag: Get existing tags, filter out the unwanted ID, then update
- To replace all: Simply send the new list (this endpoint)
Tag ID Requirements
- All tag IDs must exist in your organization
- All tag IDs must belong to your account
- Invalid tag IDs will cause the request to fail with a 400 error
- Tag IDs are numeric integers, not UUIDs
Error Responses
Status Code | Description |
---|---|
400 | Bad Request - Invalid tag IDs or tags donโt exist |
401 | Unauthorized - Invalid or missing API key |
404 | Not Found - Contact not found |
500 | Internal Server Error - Something went wrong |
Getting Tag IDs
To get available tag IDs for your organization, use the Get All Tags endpoint:- Call
GET /api/public/tags
to get all available tags - Find the tag IDs you need (by name or other criteria)
- Use those IDs with this endpoint to update contact tags
Best Practices
1. Validate Tag IDs Before Updating
2. Handle Errors Gracefully
3. Remove Duplicates
Related Endpoints
- GET /api/public/tags - Get all available tags and their IDs
- POST /api/public/channels///tags - Create and assign tags using phone/username
- GET /api/public/contact//info - Get contact info including current tags
Tag Types
Tags can be of two types:- CONTACT Tags: Associated with the contact permanently
- TICKET Tags: Only assigned when a contact has an active ticket
Notes
- Atomic Operation: The tag update is atomic - either all tags are updated or none
- No Partial Updates: You cannot update tags one at a time with this endpoint
- Immediate Effect: Changes take effect immediately
- Activity Logged: Tag changes are logged in the contactโs activity history
Headers
API key required to authorize the request
Path Parameters
ID of the AI contact
Body
application/json
Response
Tags updated successfully.