curl -X POST "https://server.smartlead.ai/api/v1/campaigns/tags?api_key=YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"campaignIds": [101, 204],
"tagIds": [6, 9]
}'
import requests
API_KEY = "YOUR_API_KEY"
response = requests.post(
"https://server.smartlead.ai/api/v1/campaigns/tags",
params={"api_key": API_KEY},
json={
"campaignIds": [101, 204],
"tagIds": [6, 9]
}
)
result = response.json()
print(f"Added {result['added']} of {result['requested']} tag-campaign pairs")
const API_KEY = 'YOUR_API_KEY';
const response = await fetch(
`https://server.smartlead.ai/api/v1/campaigns/tags?api_key=${API_KEY}`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
campaignIds: [101, 204],
tagIds: [6, 9]
})
}
);
const result = await response.json();
console.log(`Added ${result.added} of ${result.requested} tag-campaign pairs`);
{
"ok": true,
"message": "Tags added to campaigns successfully!",
"campaign_ids": [101, 204],
"tag_ids": [6, 9],
"requested": 4,
"added": 3,
"already_present": 1
}
{
"ok": false,
"error": "Campaigns not found - one or more campaignIds are invalid.",
"not_found_campaign_ids": [204]
}
{
"ok": false,
"error": "Tags not found - one or more tagIds are invalid.",
"not_found_tag_ids": [9]
}
{
"message": "Invalid API Key"
}
Campaign Management
Add Tags to Campaigns
Attach one or more tags to one or more campaigns in a single request
POST
/
api
/
v1
/
campaigns
/
tags
curl -X POST "https://server.smartlead.ai/api/v1/campaigns/tags?api_key=YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"campaignIds": [101, 204],
"tagIds": [6, 9]
}'
import requests
API_KEY = "YOUR_API_KEY"
response = requests.post(
"https://server.smartlead.ai/api/v1/campaigns/tags",
params={"api_key": API_KEY},
json={
"campaignIds": [101, 204],
"tagIds": [6, 9]
}
)
result = response.json()
print(f"Added {result['added']} of {result['requested']} tag-campaign pairs")
const API_KEY = 'YOUR_API_KEY';
const response = await fetch(
`https://server.smartlead.ai/api/v1/campaigns/tags?api_key=${API_KEY}`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
campaignIds: [101, 204],
tagIds: [6, 9]
})
}
);
const result = await response.json();
console.log(`Added ${result.added} of ${result.requested} tag-campaign pairs`);
{
"ok": true,
"message": "Tags added to campaigns successfully!",
"campaign_ids": [101, 204],
"tag_ids": [6, 9],
"requested": 4,
"added": 3,
"already_present": 1
}
{
"ok": false,
"error": "Campaigns not found - one or more campaignIds are invalid.",
"not_found_campaign_ids": [204]
}
{
"ok": false,
"error": "Tags not found - one or more tagIds are invalid.",
"not_found_tag_ids": [9]
}
{
"message": "Invalid API Key"
}
Attaches every tag in
tagIds to every campaign in campaignIds (the full cartesian product). The operation is idempotent — pairs that are already tagged are silently skipped rather than causing an error.Query Parameters
string
required
Your SmartLead API key
Request Body
number[]
required
Campaign IDs to tag. 1–100 positive integers.
number[]
required
Tag IDs to attach. 1–100 positive integers.
All campaigns and tags must belong to the authenticated account (or the client scoped to the API key). Validation is all-or-nothing — if any
campaignIds or tagIds value doesn’t belong to the caller, the entire request is rejected and nothing is applied.curl -X POST "https://server.smartlead.ai/api/v1/campaigns/tags?api_key=YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"campaignIds": [101, 204],
"tagIds": [6, 9]
}'
import requests
API_KEY = "YOUR_API_KEY"
response = requests.post(
"https://server.smartlead.ai/api/v1/campaigns/tags",
params={"api_key": API_KEY},
json={
"campaignIds": [101, 204],
"tagIds": [6, 9]
}
)
result = response.json()
print(f"Added {result['added']} of {result['requested']} tag-campaign pairs")
const API_KEY = 'YOUR_API_KEY';
const response = await fetch(
`https://server.smartlead.ai/api/v1/campaigns/tags?api_key=${API_KEY}`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
campaignIds: [101, 204],
tagIds: [6, 9]
})
}
);
const result = await response.json();
console.log(`Added ${result.added} of ${result.requested} tag-campaign pairs`);
Response Fields
boolean
true on successstring
"Tags added to campaigns successfully!"number[]
Deduplicated list of campaign IDs the request was applied to
number[]
Deduplicated list of tag IDs the request was applied to
number
Total number of campaign/tag pairs requested (
campaign_ids.length × tag_ids.length)number
Number of pairs newly created
number
Number of pairs that were already tagged and skipped
Response Codes
Success
Tags processed successfully (see
added / already_present for the outcome)Bad Request
Invalid request parameters or malformed request body
Unauthorized
Invalid or missing API key
Not Found
One or more
campaignIds or tagIds don’t exist or don’t belong to the authenticated accountValidation Error
Request validation failed. Check parameter types and constraints (array length 1–100, positive integers).
Internal Server Error
Server error occurred
{
"ok": true,
"message": "Tags added to campaigns successfully!",
"campaign_ids": [101, 204],
"tag_ids": [6, 9],
"requested": 4,
"added": 3,
"already_present": 1
}
{
"ok": false,
"error": "Campaigns not found - one or more campaignIds are invalid.",
"not_found_campaign_ids": [204]
}
{
"ok": false,
"error": "Tags not found - one or more tagIds are invalid.",
"not_found_tag_ids": [9]
}
{
"message": "Invalid API Key"
}
