curl -X DELETE "https://server.smartlead.ai/api/v1/leads/categories/789?api_key=YOUR_KEY"
import requests
API_KEY = "YOUR_API_KEY"
category_id = 789
response = requests.delete(
f"https://server.smartlead.ai/api/v1/leads/categories/{category_id}",
params={"api_key": API_KEY}
)
result = response.json()
if result.get('ok'):
print(f"Category {category_id} deleted")
elif response.status_code == 409:
print("Category is still assigned to leads - unassign it first")
const API_KEY = 'YOUR_API_KEY';
const categoryId = 789;
const response = await fetch(
`https://server.smartlead.ai/api/v1/leads/categories/${categoryId}?api_key=${API_KEY}`,
{ method: 'DELETE' }
);
const result = await response.json();
if (result.ok) {
console.log(`Category ${categoryId} deleted`);
} else if (response.status === 409) {
console.log('Category is still assigned to leads - unassign it first');
}
{
"ok": true,
"message": "Lead category deleted successfully"
}
{
"ok": false,
"message": "This category is assigned to some of the leads. Please unassign the category from those leads first and then delete it."
}
{
"ok": false,
"message": "Default categories cannot be modified or deleted"
}
{
"ok": false,
"message": "Lead category not found"
}
Lead Categories
Delete Lead Category
Delete a custom lead category that is not assigned to any lead
DELETE
/
api
/
v1
/
leads
/
categories
/
{category_id}
curl -X DELETE "https://server.smartlead.ai/api/v1/leads/categories/789?api_key=YOUR_KEY"
import requests
API_KEY = "YOUR_API_KEY"
category_id = 789
response = requests.delete(
f"https://server.smartlead.ai/api/v1/leads/categories/{category_id}",
params={"api_key": API_KEY}
)
result = response.json()
if result.get('ok'):
print(f"Category {category_id} deleted")
elif response.status_code == 409:
print("Category is still assigned to leads - unassign it first")
const API_KEY = 'YOUR_API_KEY';
const categoryId = 789;
const response = await fetch(
`https://server.smartlead.ai/api/v1/leads/categories/${categoryId}?api_key=${API_KEY}`,
{ method: 'DELETE' }
);
const result = await response.json();
if (result.ok) {
console.log(`Category ${categoryId} deleted`);
} else if (response.status === 409) {
console.log('Category is still assigned to leads - unassign it first');
}
{
"ok": true,
"message": "Lead category deleted successfully"
}
{
"ok": false,
"message": "This category is assigned to some of the leads. Please unassign the category from those leads first and then delete it."
}
{
"ok": false,
"message": "Default categories cannot be modified or deleted"
}
{
"ok": false,
"message": "Lead category not found"
}
A category can only be deleted when no lead in any campaign is assigned to it. If it is still in use, the request returns
409 and nothing is deleted. Global (system) categories can never be deleted.Path Parameters
number
required
The ID of the custom category to delete
Query Parameters
string
required
Your SmartLead API key
curl -X DELETE "https://server.smartlead.ai/api/v1/leads/categories/789?api_key=YOUR_KEY"
import requests
API_KEY = "YOUR_API_KEY"
category_id = 789
response = requests.delete(
f"https://server.smartlead.ai/api/v1/leads/categories/{category_id}",
params={"api_key": API_KEY}
)
result = response.json()
if result.get('ok'):
print(f"Category {category_id} deleted")
elif response.status_code == 409:
print("Category is still assigned to leads - unassign it first")
const API_KEY = 'YOUR_API_KEY';
const categoryId = 789;
const response = await fetch(
`https://server.smartlead.ai/api/v1/leads/categories/${categoryId}?api_key=${API_KEY}`,
{ method: 'DELETE' }
);
const result = await response.json();
if (result.ok) {
console.log(`Category ${categoryId} deleted`);
} else if (response.status === 409) {
console.log('Category is still assigned to leads - unassign it first');
}
Response Codes
Success
Category deleted successfully
Unauthorized
Invalid or missing API key, or the key belongs to a client account
Forbidden
The category is a global (system) category and cannot be deleted
Not Found
No custom category with this ID exists in your account
Conflict
The category is assigned to one or more leads
Internal Server Error
Server error occurred
{
"ok": true,
"message": "Lead category deleted successfully"
}
{
"ok": false,
"message": "This category is assigned to some of the leads. Please unassign the category from those leads first and then delete it."
}
{
"ok": false,
"message": "Default categories cannot be modified or deleted"
}
{
"ok": false,
"message": "Lead category not found"
}
Usage Notes
To free a category for deletion, set
category_id to null on each lead that uses it with Update Lead Category in Campaign. This only removes the category from the lead; the category itself stays until you delete it.Deleting a category also removes any webhook triggers and CRM category mappings configured for it.
Related Endpoints
- Get Lead Categories - Find category IDs
- Create Lead Category - Add a custom category
- Update Lead Category - Rename or recolour a custom category
