Update a tag
Rename a tag or change its color. The change applies everywhere the tag is already used.
Endpoint
PUT https://api.p.2chat.io/open/tags/<tag-uuid>
<tag-uuid> is the UUID of the tag, e.g. TAGd37f22fa-fe01-4a90-b57d-7e83ccc6a05a. You get it from List Tags or Create Tag.
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. Send at least one of them.
| Field | Type | Required | Description |
|---|---|---|---|
name | string | No | New name, up to 100 characters. It can't match another tag of your account, ignoring case. |
color | string | No | Hex color in the #RRGGBB format, e.g. #378ADD. |
Invocation
- cURL
- Python
- JavaScript
- PHP
curl --location --request PUT 'https://api.p.2chat.io/open/tags/TAGd37f22fa-fe01-4a90-b57d-7e83ccc6a05a' \
--header 'Content-Type: application/json' \
--header 'X-User-API-Key: your_api_key_here' \
--data '{
"name": "Hot lead",
"color": "#378ADD"
}'
import requests
url = "https://api.p.2chat.io/open/tags/TAGd37f22fa-fe01-4a90-b57d-7e83ccc6a05a"
headers = {
"Content-Type": "application/json",
"X-User-API-Key": "your_api_key_here"
}
payload = {
"name": "Hot lead",
"color": "#378ADD"
}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
const axios = require('axios');
const response = await axios.put('https://api.p.2chat.io/open/tags/TAGd37f22fa-fe01-4a90-b57d-7e83ccc6a05a', {
name: 'Hot lead',
color: '#378ADD'
}, {
headers: {
'Content-Type': 'application/json',
'X-User-API-Key': 'your_api_key_here'
}
});
console.log(response.data);
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.p.2chat.io/open/tags/TAGd37f22fa-fe01-4a90-b57d-7e83ccc6a05a',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Hot lead',
'color' => '#378ADD'
]),
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'X-User-API-Key: your_api_key_here'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Response
Success (HTTP 200 OK)
{
"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
}
}
| Field | Description |
|---|---|
success | true when the request succeeded |
data | The updated tag. See the tag object. |
Error
{
"success": false,
"error": true,
"error_message": "A tag with that name already exists"
}
| HTTP status | When |
|---|---|
400 | Neither name nor color was sent, name is longer than 100 characters, or color is not a #RRGGBB hex color |
404 | No tag with that UUID in your account |
409 | Another tag of your account already has that name |