curl -X POST "https://server.smartlead.ai/api/v1/leads/456/unsubscribe?api_key=YOUR_KEY"
import requests
API_KEY = "YOUR_API_KEY"
lead_id = 456
response = requests.post(
f"https://server.smartlead.ai/api/v1/leads/{lead_id}/unsubscribe",
params={"api_key": API_KEY}
)
result = response.json()
if result.get('ok'):
print(f"Lead {lead_id} unsubscribed globally")
const API_KEY = 'YOUR_API_KEY';
const leadId = 456;
const response = await fetch(
`https://server.smartlead.ai/api/v1/leads/${leadId}/unsubscribe?api_key=${API_KEY}`,
{ method: 'POST' }
);
const result = await response.json();
if (result.ok) {
console.log(`Lead ${leadId} unsubscribed globally`);
}
{
"ok": true
}
{
"ok": false
}
{
"message": "Invalid API Key"
}
{
"error": "Lead not found - Invalid lead_id."
}
Lead Management
Unsubscribe Lead Globally
Globally unsubscribe a lead from all current and future campaigns
POST
/
api
/
v1
/
leads
/
{lead_id}
/
unsubscribe
curl -X POST "https://server.smartlead.ai/api/v1/leads/456/unsubscribe?api_key=YOUR_KEY"
import requests
API_KEY = "YOUR_API_KEY"
lead_id = 456
response = requests.post(
f"https://server.smartlead.ai/api/v1/leads/{lead_id}/unsubscribe",
params={"api_key": API_KEY}
)
result = response.json()
if result.get('ok'):
print(f"Lead {lead_id} unsubscribed globally")
const API_KEY = 'YOUR_API_KEY';
const leadId = 456;
const response = await fetch(
`https://server.smartlead.ai/api/v1/leads/${leadId}/unsubscribe?api_key=${API_KEY}`,
{ method: 'POST' }
);
const result = await response.json();
if (result.ok) {
console.log(`Lead ${leadId} unsubscribed globally`);
}
{
"ok": true
}
{
"ok": false
}
{
"message": "Invalid API Key"
}
{
"error": "Lead not found - Invalid lead_id."
}
This action unsubscribes the lead globally across all campaigns in your account. The lead will not receive any future emails from any campaign. This action cannot be undone via API.
Path Parameters
number
required
The lead ID to unsubscribe globally
Query Parameters
string
required
Your SmartLead API key
curl -X POST "https://server.smartlead.ai/api/v1/leads/456/unsubscribe?api_key=YOUR_KEY"
import requests
API_KEY = "YOUR_API_KEY"
lead_id = 456
response = requests.post(
f"https://server.smartlead.ai/api/v1/leads/{lead_id}/unsubscribe",
params={"api_key": API_KEY}
)
result = response.json()
if result.get('ok'):
print(f"Lead {lead_id} unsubscribed globally")
const API_KEY = 'YOUR_API_KEY';
const leadId = 456;
const response = await fetch(
`https://server.smartlead.ai/api/v1/leads/${leadId}/unsubscribe?api_key=${API_KEY}`,
{ method: 'POST' }
);
const result = await response.json();
if (result.ok) {
console.log(`Lead ${leadId} unsubscribed globally`);
}
Response Codes
Success
Lead unsubscribed successfully
Unauthorized
Invalid or missing API key
Not Found
Lead not found or you don’t have access to it
Internal Server Error
Server error occurred
{
"ok": true
}
{
"ok": false
}
{
"message": "Invalid API Key"
}
{
"error": "Lead not found - Invalid lead_id."
}
Behavior Notes
When a lead is globally unsubscribed:
- The
is_unsubscribedflag is set totrueon the lead record - The lead will not receive emails from any campaign
- The lead remains in all campaigns but will not be contacted
- This action affects all current and future campaigns
To unsubscribe a lead from a specific campaign only (not globally), use the campaign-specific unsubscribe endpoint:
POST /api/v1/campaigns/{campaign_id}/leads/{lead_id}/unsubscribe