Skip to main content

Add a tag to a conversation

Put an existing tag on a conversation. Your team sees it in the live chat right away. If the conversation already has the tag, nothing changes.

To create the tag and put it on the conversation in a single call, send a session_key to Create Tag.

Endpoint​

POST https://api.p.2chat.io/open/tags/<tag-uuid>/sessions

<tag-uuid> is the UUID of the tag, e.g. TAGd37f22fa-fe01-4a90-b57d-7e83ccc6a05a.

Authentication​

Include your API key in the X-User-API-Key header. Learn more about authentication.

Parameters​

These parameters should be sent as JSON payload in the request body.

FieldTypeRequiredDescription
session_keystringYesThe conversation to put the tag on. See where to get it.

Invocation​

curl --location --request POST 'https://api.p.2chat.io/open/tags/TAGd37f22fa-fe01-4a90-b57d-7e83ccc6a05a/sessions' \
--header 'Content-Type: application/json' \
--header 'X-User-API-Key: your_api_key_here' \
--data '{
"session_key": "WA-WAN8fd3442f-e111-4fed-9323-1824fd7546c9-14085550176"
}'

Response​

Success​

HTTP 201 Created when the tag was added, 200 OK when the conversation already had it. The body is the same in both cases.

{
"success": true,
"data": {
"uuid": "TAGd37f22fa-fe01-4a90-b57d-7e83ccc6a05a",
"name": "Hot lead",
"color": "#378ADD",
"exclude_from_campaigns": false,
"created_at": "2026-10-28T17:55:04Z",
"updated_at": "2026-10-28T18:02:11Z",
"created_by_user_id": 4809
}
}
FieldDescription
successtrue when the request succeeded
dataThe tag. See the tag object.

Error​

{
"success": false,
"error": true,
"error_message": "Payload is invalid. Make sure all required fields are present and with valid values: session_key does not belong to this account"
}
HTTP statusWhen
400session_key is not a conversation of your account
404No tag with that UUID in your account
422session_key is missing