# Download CSV file
curl "https://server.smartlead.ai/api/v1/campaigns/123/leads-export?api_key=YOUR_KEY" \
-o campaign_123_leads.csv
import requests
API_KEY = "YOUR_API_KEY"
campaign_id = 123
response = requests.get(
f"https://server.smartlead.ai/api/v1/campaigns/{campaign_id}/leads-export",
params={"api_key": API_KEY}
)
# Save CSV file
if response.status_code == 200:
with open(f'campaign_{campaign_id}_leads.csv', 'wb') as f:
f.write(response.content)
print(f"Exported {campaign_id} leads to CSV")
else:
print(f"Error: {response.status_code}")
const API_KEY = 'YOUR_API_KEY';
const campaignId = 123;
const response = await fetch(
`https://server.smartlead.ai/api/v1/campaigns/${campaignId}/leads-export?api_key=${API_KEY}`
);
if (response.ok) {
const blob = await response.blob();
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `campaign_${campaignId}_leads.csv`;
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
console.log('CSV downloaded');
} else {
console.error('Export failed:', response.status);
}
id,campaign_lead_map_id,status,category,is_interested,created_at,first_name,last_name,email,phone_number,company_name,website,location,custom_fields,linkedin_profile,company_url,is_unsubscribed,unsubscribed_client_id_map,last_email_sequence_sent,open_count,click_count,reply_count
2995276770,2433664091,INPROGRESS,Interested,true,2025-11-25T12:54:54.000Z,John,Doe,john@example.com,+1234567890,Acme Corp,https://acme.com,San Francisco,"{""job_title"":""CEO""}",https://linkedin.com/in/johndoe,https://acme.com,false,,2,3,1,1
{
"message": "Invalid API Key"
}
{
"error": "Campaign not found - Invalid campaign_id."
}
Lead Management
Export Campaign Leads
Export all leads from a campaign as a CSV file with complete engagement metrics
GET
/
api
/
v1
/
campaigns
/
{campaign_id}
/
leads-export
# Download CSV file
curl "https://server.smartlead.ai/api/v1/campaigns/123/leads-export?api_key=YOUR_KEY" \
-o campaign_123_leads.csv
import requests
API_KEY = "YOUR_API_KEY"
campaign_id = 123
response = requests.get(
f"https://server.smartlead.ai/api/v1/campaigns/{campaign_id}/leads-export",
params={"api_key": API_KEY}
)
# Save CSV file
if response.status_code == 200:
with open(f'campaign_{campaign_id}_leads.csv', 'wb') as f:
f.write(response.content)
print(f"Exported {campaign_id} leads to CSV")
else:
print(f"Error: {response.status_code}")
const API_KEY = 'YOUR_API_KEY';
const campaignId = 123;
const response = await fetch(
`https://server.smartlead.ai/api/v1/campaigns/${campaignId}/leads-export?api_key=${API_KEY}`
);
if (response.ok) {
const blob = await response.blob();
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `campaign_${campaignId}_leads.csv`;
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
console.log('CSV downloaded');
} else {
console.error('Export failed:', response.status);
}
id,campaign_lead_map_id,status,category,is_interested,created_at,first_name,last_name,email,phone_number,company_name,website,location,custom_fields,linkedin_profile,company_url,is_unsubscribed,unsubscribed_client_id_map,last_email_sequence_sent,open_count,click_count,reply_count
2995276770,2433664091,INPROGRESS,Interested,true,2025-11-25T12:54:54.000Z,John,Doe,john@example.com,+1234567890,Acme Corp,https://acme.com,San Francisco,"{""job_title"":""CEO""}",https://linkedin.com/in/johndoe,https://acme.com,false,,2,3,1,1
{
"message": "Invalid API Key"
}
{
"error": "Campaign not found - Invalid campaign_id."
}
Returns a CSV file containing all leads in the campaign with their contact information, status, category, and engagement metrics (opens, clicks, replies). The file is named
sl_campaign_{campaign_id}_leads.csv.Path Parameters
number
required
The campaign ID to export leads from
Query Parameters
string
required
Your SmartLead API key
# Download CSV file
curl "https://server.smartlead.ai/api/v1/campaigns/123/leads-export?api_key=YOUR_KEY" \
-o campaign_123_leads.csv
import requests
API_KEY = "YOUR_API_KEY"
campaign_id = 123
response = requests.get(
f"https://server.smartlead.ai/api/v1/campaigns/{campaign_id}/leads-export",
params={"api_key": API_KEY}
)
# Save CSV file
if response.status_code == 200:
with open(f'campaign_{campaign_id}_leads.csv', 'wb') as f:
f.write(response.content)
print(f"Exported {campaign_id} leads to CSV")
else:
print(f"Error: {response.status_code}")
const API_KEY = 'YOUR_API_KEY';
const campaignId = 123;
const response = await fetch(
`https://server.smartlead.ai/api/v1/campaigns/${campaignId}/leads-export?api_key=${API_KEY}`
);
if (response.ok) {
const blob = await response.blob();
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `campaign_${campaignId}_leads.csv`;
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
console.log('CSV downloaded');
} else {
console.error('Export failed:', response.status);
}
CSV File Columns
The exported CSV file contains the following columns:Lead Information
Lead Information
id- Lead IDcampaign_lead_map_id- Campaign-lead mapping IDfirst_name- Lead’s first namelast_name- Lead’s last nameemail- Lead’s email addressphone_number- Lead’s phone numbercompany_name- Company namewebsite- Company websitelocation- Lead’s locationlinkedin_profile- LinkedIn profile URLcompany_url- Company URLcustom_fields- Custom fields as JSON object
Status & Category
Status & Category
status- Lead status (STARTED, INPROGRESS, COMPLETED, PAUSED, STOPPED)category- Category nameis_interested- Boolean indicating positive sentiment categorycreated_at- When lead was added to campaign
Engagement Metrics
Engagement Metrics
last_email_sequence_sent- Last sequence number sentopen_count- Total number of opensclick_count- Total number of clicksreply_count- Total number of replies
Unsubscribe Status
Unsubscribe Status
is_unsubscribed- Whether lead is globally unsubscribedunsubscribed_client_id_map- Client-specific unsubscribe data
Response Codes
Success
CSV file generated and returned successfully
Unauthorized
Invalid or missing API key
Not Found
Campaign not found or you don’t have access to it
Internal Server Error
Server error occurred
id,campaign_lead_map_id,status,category,is_interested,created_at,first_name,last_name,email,phone_number,company_name,website,location,custom_fields,linkedin_profile,company_url,is_unsubscribed,unsubscribed_client_id_map,last_email_sequence_sent,open_count,click_count,reply_count
2995276770,2433664091,INPROGRESS,Interested,true,2025-11-25T12:54:54.000Z,John,Doe,john@example.com,+1234567890,Acme Corp,https://acme.com,San Francisco,"{""job_title"":""CEO""}",https://linkedin.com/in/johndoe,https://acme.com,false,,2,3,1,1
{
"message": "Invalid API Key"
}
{
"error": "Campaign not found - Invalid campaign_id."
}
Response Headers
The response includes the following headers:
Content-Type: text/csvContent-Disposition: attachment; filename=sl_campaign_{campaign_id}_leads.csv
Usage Notes
This endpoint is ideal for:
- Backing up campaign leads
- Importing leads into CRM systems
- Analyzing engagement metrics in spreadsheet tools
- Generating reports for stakeholders
Large campaigns may take longer to export. The export includes all leads regardless of status.
Related Endpoints
- Get Campaign Leads - Paginated API access to leads
- Get Lead by Email - Get individual lead details
- Get All Leads Activities - Activity timeline for all leads
