curl -X POST "https://server.smartlead.ai/api/v1/campaigns/123/leads/filter?api_key=YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"searchText": "john", "limit": 25}'
import requests
def search_campaign_leads(campaign_id, text):
leads, cursor = [], None
while True:
body = {"searchText": text, "limit": 100}
if cursor:
body["lastSeenLeadId"] = cursor
data = requests.post(
f"https://server.smartlead.ai/api/v1/campaigns/{campaign_id}/leads/filter",
params={"api_key": "YOUR_API_KEY"},
json=body
).json()
leads.extend(data["leads"])
if len(data["leads"]) < 100:
return leads
cursor = data["lastSeenEclmId"]
print(search_campaign_leads(123, "john"))
{
"leads": [
{
"id": 987654,
"current_seq_num": 1,
"status": "INPROGRESS",
"email_account_id": 321,
"spintax_modulo_index": 0,
"email_lead": {
"id": 55501,
"email": "john.doe@acme.com",
"first_name": "John",
"last_name": "Doe",
"company_name": "Acme",
"phone_number": null,
"company_url": "acme.com",
"website": "https://acme.com",
"linkedin_profile": null,
"location": null,
"custom_fields": {},
"esp_domain_type": 1
},
"email_account": {
"username": "sender@yourdomain.com"
}
}
],
"lastSeenEclmId": 987654,
"count": 1
}
{
"message": "Error fetching campaign leads with multi-select filters"
}
Campaign Leads
Search Campaign Leads
Search and filter a campaign’s leads by name/email text, status, category, sequence and more
POST
/
api
/
v1
/
campaigns
/
{campaignId}
/
leads
/
filter
curl -X POST "https://server.smartlead.ai/api/v1/campaigns/123/leads/filter?api_key=YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"searchText": "john", "limit": 25}'
import requests
def search_campaign_leads(campaign_id, text):
leads, cursor = [], None
while True:
body = {"searchText": text, "limit": 100}
if cursor:
body["lastSeenLeadId"] = cursor
data = requests.post(
f"https://server.smartlead.ai/api/v1/campaigns/{campaign_id}/leads/filter",
params={"api_key": "YOUR_API_KEY"},
json=body
).json()
leads.extend(data["leads"])
if len(data["leads"]) < 100:
return leads
cursor = data["lastSeenEclmId"]
print(search_campaign_leads(123, "john"))
{
"leads": [
{
"id": 987654,
"current_seq_num": 1,
"status": "INPROGRESS",
"email_account_id": 321,
"spintax_modulo_index": 0,
"email_lead": {
"id": 55501,
"email": "john.doe@acme.com",
"first_name": "John",
"last_name": "Doe",
"company_name": "Acme",
"phone_number": null,
"company_url": "acme.com",
"website": "https://acme.com",
"linkedin_profile": null,
"location": null,
"custom_fields": {},
"esp_domain_type": 1
},
"email_account": {
"username": "sender@yourdomain.com"
}
}
],
"lastSeenEclmId": 987654,
"count": 1
}
{
"message": "Error fetching campaign leads with multi-select filters"
}
Requires your own API key. Client API keys get
401.Results are ordered by lead map ID (ascending) and paginated with a cursor. To fetch the next page, send the lastSeenEclmId from the previous response as lastSeenLeadId.Path Parameters
number
required
Campaign ID
Query Parameters
string
required
Your SmartLead API key
Request Body
All fields are optional.string
Text search on the lead’s email, first name and last name. The text is split on spaces, and every word must match (case-insensitive, partial match) at least one of those fields. For example,
"Doe John" matches first name John and last name Doe.number
default:"25"
Number of leads to return (minimum: 1, maximum: 100)
number
Cursor: the
lastSeenEclmId from the previous pagestring
ISO date. Second half of the cursor, used with
lastSeenLeadId when fieldSet is active_table and statusFilter is replied (those results are sorted by latest reply time)string[]
Lead statuses. Valid values:
STARTED, INPROGRESS, COMPLETED, STOPPED, PAUSED, BLOCKEDstring[]
Email statuses. Valid values:
is_opened, is_clicked, is_bounced, is_replied, is_unsubscribed, is_accepted, not_replied, is_sender_bounced, got_replynumber[]
Lead category IDs. Include
-1 to also match leads with no category.boolean
Only leads with no lead category
number[]
Email account IDs the leads are assigned to
number[]
ESP domain types (integers 0–2)
number[]
Segment types (integers 0–10)
number[]
Sequence step numbers (1–999)
number[]
Sequence IDs
number[]
Sequence variant IDs
string
MANUAL or AUTOstring
Status tab, matching the keys returned by
GET /campaigns/{campaign_id}/lead-status-summary: all, active, replied, failed, scheduled, manual_followups, completed, pausedstring
default:"drafted_table"
Fields returned per lead:
drafted_table (compact) or active_table (full, including category, stats and mappingExists)string[]
Email addresses (max 320 characters each)
boolean
Filter leads for manual completion
number[]
Manual sequence IDs, used with
filterLeadsForManualCompletionboolean
Include sender-bounced leads
curl -X POST "https://server.smartlead.ai/api/v1/campaigns/123/leads/filter?api_key=YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"searchText": "john", "limit": 25}'
import requests
def search_campaign_leads(campaign_id, text):
leads, cursor = [], None
while True:
body = {"searchText": text, "limit": 100}
if cursor:
body["lastSeenLeadId"] = cursor
data = requests.post(
f"https://server.smartlead.ai/api/v1/campaigns/{campaign_id}/leads/filter",
params={"api_key": "YOUR_API_KEY"},
json=body
).json()
leads.extend(data["leads"])
if len(data["leads"]) < 100:
return leads
cursor = data["lastSeenEclmId"]
print(search_campaign_leads(123, "john"))
Response
array
Matching leads. With
fieldSet: "drafted_table" each item has id (lead map ID), current_seq_num, status, email_account_id, spintax_modulo_index, email_lead (id, email, first_name, last_name, company_name, phone_number, company_url, website, linkedin_profile, location, custom_fields, esp_domain_type) and email_account (username, or null).With fieldSet: "active_table" each item also has next_timestamp_to_reach, last_sent_time, latest_reply_time, email_campaign_seq_id, lead_category_id, lead_category (id, name, or null), latest_email_stats, latest_reply_stats, matched_status_stats. email_lead also includes seg_type, and email_account also includes mappingExists: the list of { id } mappings of that email account to this campaign (empty when the account is no longer attached to the campaign).number
Lead map ID of the last lead in
leads. Pass it as lastSeenLeadId for the next page.string
latest_reply_time of the last lead (only set with active_table)number
Total number of leads matching the filters
{
"leads": [
{
"id": 987654,
"current_seq_num": 1,
"status": "INPROGRESS",
"email_account_id": 321,
"spintax_modulo_index": 0,
"email_lead": {
"id": 55501,
"email": "john.doe@acme.com",
"first_name": "John",
"last_name": "Doe",
"company_name": "Acme",
"phone_number": null,
"company_url": "acme.com",
"website": "https://acme.com",
"linkedin_profile": null,
"location": null,
"custom_fields": {},
"esp_domain_type": 1
},
"email_account": {
"username": "sender@yourdomain.com"
}
}
],
"lastSeenEclmId": 987654,
"count": 1
}
{
"message": "Error fetching campaign leads with multi-select filters"
}
