curl -X POST "https://server.smartlead.ai/api/v1/tags?api_key=YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Primary Senders", "color": "#4CAF50"}'
import requests
API_KEY = "YOUR_API_KEY"
response = requests.post(
"https://server.smartlead.ai/api/v1/tags",
params={"api_key": API_KEY},
json={
"name": "Primary Senders",
"color": "#4CAF50"
}
)
result = response.json()
print(result)
const API_KEY = 'YOUR_API_KEY';
const response = await fetch(
`https://server.smartlead.ai/api/v1/tags?api_key=${API_KEY}`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
name: 'Primary Senders',
color: '#4CAF50'
})
}
);
const result = await response.json();
console.log(result);
{
"ok": true,
"data": {
"id": 42,
"name": "Primary Senders",
"color": "#4CAF50"
}
}
{
"message": "Invalid API Key"
}
{
"error": "\"name\" is required"
}
Email Account Tags
Create Tag
Create a new email account tag with a name and optional color
POST
/
api
/
v1
/
tags
curl -X POST "https://server.smartlead.ai/api/v1/tags?api_key=YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Primary Senders", "color": "#4CAF50"}'
import requests
API_KEY = "YOUR_API_KEY"
response = requests.post(
"https://server.smartlead.ai/api/v1/tags",
params={"api_key": API_KEY},
json={
"name": "Primary Senders",
"color": "#4CAF50"
}
)
result = response.json()
print(result)
const API_KEY = 'YOUR_API_KEY';
const response = await fetch(
`https://server.smartlead.ai/api/v1/tags?api_key=${API_KEY}`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
name: 'Primary Senders',
color: '#4CAF50'
})
}
);
const result = await response.json();
console.log(result);
{
"ok": true,
"data": {
"id": 42,
"name": "Primary Senders",
"color": "#4CAF50"
}
}
{
"message": "Invalid API Key"
}
{
"error": "\"name\" is required"
}
Create tags to organize your email accounts into groups for easy filtering and management. Each tag can have a custom color for visual identification.
Overview
Creates a new tag that can be assigned to email accounts. Unlike the Update Tag endpoint, this does not require an existing tag ID — the system generates one automatically.Query Parameters
string
required
Your SmartLead API key
Request Body
string
required
Display name for the tag
string
Hex color code for the tag (e.g.,
#FF5733). Must be a valid 6-character hex color with # prefix. If not provided, a default color will be assigned.curl -X POST "https://server.smartlead.ai/api/v1/tags?api_key=YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Primary Senders", "color": "#4CAF50"}'
import requests
API_KEY = "YOUR_API_KEY"
response = requests.post(
"https://server.smartlead.ai/api/v1/tags",
params={"api_key": API_KEY},
json={
"name": "Primary Senders",
"color": "#4CAF50"
}
)
result = response.json()
print(result)
const API_KEY = 'YOUR_API_KEY';
const response = await fetch(
`https://server.smartlead.ai/api/v1/tags?api_key=${API_KEY}`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
name: 'Primary Senders',
color: '#4CAF50'
})
}
);
const result = await response.json();
console.log(result);
Response Codes
Success
Tag created successfully
Unauthorized
Invalid or missing API key
Validation Error
Request validation failed. Common issues:
- Missing
namefield - Invalid hex color format (must match
#RRGGBB)
Internal Server Error
Server error occurred
{
"ok": true,
"data": {
"id": 42,
"name": "Primary Senders",
"color": "#4CAF50"
}
}
{
"message": "Invalid API Key"
}
{
"error": "\"name\" is required"
}
Related Endpoints
- Update Tag — Update an existing tag’s name or color
- Get All Tags — List all email account tags
- Assign Tag — Assign a tag to an email account
- Remove Tag — Remove a tag from an email account
