curl "https://server.smartlead.ai/api/v1/campaigns/{campaign_id}/blank-variables?api_key=YOUR_KEY&limit=100&offset=0"
import requests
API_KEY = "YOUR_API_KEY"
campaign_id = 123
offset = 0
while offset is not None:
page = requests.get(
f"https://server.smartlead.ai/api/v1/campaigns/{campaign_id}/blank-variables",
params={"api_key": API_KEY, "limit": 500, "offset": offset},
).json()
for lead in page["data"]:
print(lead["email"], [b["variable"] for b in lead["blank_variables"]])
offset = page["next_offset"]
const API_KEY = 'YOUR_API_KEY';
const response = await fetch(
`https://server.smartlead.ai/api/v1/campaigns/${campaign_id}/blank-variables?api_key=${API_KEY}&limit=100`
);
const result = await response.json();
console.log(result.leads_with_blank_variables, result.data);
{
"campaign_id": 123,
"lead_statuses_checked": ["STARTED", "INPROGRESS"],
"total_leads": 250,
"offset": 0,
"limit": 100,
"leads_checked": 100,
"leads_with_blank_variables": 1,
"has_more": true,
"next_offset": 100,
"variables": [
{
"variable": "first_name",
"used_in": [
{ "seq_number": 1, "seq_id": 501, "variant_id": null, "variant_label": null, "field": "subject", "inside_block": false, "context_block": false },
{ "seq_number": 2, "seq_id": 502, "variant_id": null, "variant_label": null, "field": "subject", "reused_from_seq_number": 1, "inside_block": false, "context_block": false }
]
},
{
"variable": "Job Title",
"used_in": [
{ "seq_number": 1, "seq_id": 501, "variant_id": null, "variant_label": null, "field": "email_body", "inside_block": false, "context_block": false }
]
}
],
"variables_truncated": false,
"texts_not_checked": [],
"data": [
{
"lead_id": 9001,
"campaign_lead_map_id": 7001,
"email": "lead@example.com",
"status": "STARTED",
"blank_variables": [
{ "variable": "first_name", "reason": "empty", "seq_numbers": [1, 2], "only_inside_block": false },
{ "variable": "Job Title", "reason": "missing", "seq_numbers": [1], "only_inside_block": false }
]
}
]
}
{
"statusCode": 400,
"error": "Bad Request",
"message": "\"limit\" must be less than or equal to 500",
"validation": { "source": "query", "keys": ["limit"] }
}
{ "error": "Campaign not found - Invalid campaign_id." }
Campaign Management
Check Blank Merge Variables
Before launch, list per lead the merge variables in the campaign’s email steps that would be sent as an empty string.
GET
/
api
/
v1
/
campaigns
/
{campaign_id}
/
blank-variables
curl "https://server.smartlead.ai/api/v1/campaigns/{campaign_id}/blank-variables?api_key=YOUR_KEY&limit=100&offset=0"
import requests
API_KEY = "YOUR_API_KEY"
campaign_id = 123
offset = 0
while offset is not None:
page = requests.get(
f"https://server.smartlead.ai/api/v1/campaigns/{campaign_id}/blank-variables",
params={"api_key": API_KEY, "limit": 500, "offset": offset},
).json()
for lead in page["data"]:
print(lead["email"], [b["variable"] for b in lead["blank_variables"]])
offset = page["next_offset"]
const API_KEY = 'YOUR_API_KEY';
const response = await fetch(
`https://server.smartlead.ai/api/v1/campaigns/${campaign_id}/blank-variables?api_key=${API_KEY}&limit=100`
);
const result = await response.json();
console.log(result.leads_with_blank_variables, result.data);
{
"campaign_id": 123,
"lead_statuses_checked": ["STARTED", "INPROGRESS"],
"total_leads": 250,
"offset": 0,
"limit": 100,
"leads_checked": 100,
"leads_with_blank_variables": 1,
"has_more": true,
"next_offset": 100,
"variables": [
{
"variable": "first_name",
"used_in": [
{ "seq_number": 1, "seq_id": 501, "variant_id": null, "variant_label": null, "field": "subject", "inside_block": false, "context_block": false },
{ "seq_number": 2, "seq_id": 502, "variant_id": null, "variant_label": null, "field": "subject", "reused_from_seq_number": 1, "inside_block": false, "context_block": false }
]
},
{
"variable": "Job Title",
"used_in": [
{ "seq_number": 1, "seq_id": 501, "variant_id": null, "variant_label": null, "field": "email_body", "inside_block": false, "context_block": false }
]
}
],
"variables_truncated": false,
"texts_not_checked": [],
"data": [
{
"lead_id": 9001,
"campaign_lead_map_id": 7001,
"email": "lead@example.com",
"status": "STARTED",
"blank_variables": [
{ "variable": "first_name", "reason": "empty", "seq_numbers": [1, 2], "only_inside_block": false },
{ "variable": "Job Title", "reason": "missing", "seq_numbers": [1], "only_inside_block": false }
]
}
]
}
{
"statusCode": 400,
"error": "Bad Request",
"message": "\"limit\" must be less than or equal to 500",
"validation": { "source": "query", "keys": ["limit"] }
}
{ "error": "Campaign not found - Invalid campaign_id." }
Read-only. Nothing is sent, queued or changed. Use it before starting a campaign, or after adding leads, to catch emails like “Hi ,” or “Quick question for ”.
Overview
When an email goes out, every merge variable such as{{first_name}}, {{company_name}} or a custom field such as {{Job Title}} is replaced with the lead’s value. If the lead has no such field, or the value is empty, the email is still sent and the variable becomes an empty string. This endpoint finds those cases before they are sent.
What is checked
- Leads that will still be emailed: status
STARTEDorINPROGRESS. - For each lead, only the email steps it has not been sent yet.
- The subject and body of each step, or of every live A/B variant of the step.
- A follow-up with an empty subject is sent as a reply to the earlier step’s subject, so that subject’s variables are checked for the follow-up too (shown with
reused_from_seq_number). - A lead’s saved per-step edit is sent as saved, so that step is skipped for that lead.
missing: the lead has no field with that exact name. Names are case- and space-sensitive:{{ first_name }}(with spaces) is never filled.empty: the field exists but is empty,null, an empty list, or only spaces.- A custom field with the same name as a lead field (for example
first_name) is used instead of the lead field. {{sl_day_of_week}},{{sl_time_of_day}}and{{sl_time_of_day_cap}}are always filled.{{sl_last_touch}}is empty on a lead’s first email.
- Variables inside spintax (
{Hi|Hello} {{first_name}}) are checked even if a lead’s spintax choice would not use them. only_inside_block: truemeans every use sits inside an{{#if}}-style block, so the email may not print it.- Variables used only inside
{{#each}}or{{#with}}read from that block’s object, not the lead. They are listed invariableswithcontext_block: trueand are not checked per lead. %sender-name%-style sender variables and mailbox signatures are not checked.- Rate limit: 30 requests per 60 seconds per account, across all campaigns, on top of the account-wide limit (see Rate Limits).
Path Parameters
Query Parameters
curl "https://server.smartlead.ai/api/v1/campaigns/{campaign_id}/blank-variables?api_key=YOUR_KEY&limit=100&offset=0"
import requests
API_KEY = "YOUR_API_KEY"
campaign_id = 123
offset = 0
while offset is not None:
page = requests.get(
f"https://server.smartlead.ai/api/v1/campaigns/{campaign_id}/blank-variables",
params={"api_key": API_KEY, "limit": 500, "offset": offset},
).json()
for lead in page["data"]:
print(lead["email"], [b["variable"] for b in lead["blank_variables"]])
offset = page["next_offset"]
const API_KEY = 'YOUR_API_KEY';
const response = await fetch(
`https://server.smartlead.ai/api/v1/campaigns/${campaign_id}/blank-variables?api_key=${API_KEY}&limit=100`
);
const result = await response.json();
console.log(result.leads_with_blank_variables, result.data);
{
"campaign_id": 123,
"lead_statuses_checked": ["STARTED", "INPROGRESS"],
"total_leads": 250,
"offset": 0,
"limit": 100,
"leads_checked": 100,
"leads_with_blank_variables": 1,
"has_more": true,
"next_offset": 100,
"variables": [
{
"variable": "first_name",
"used_in": [
{ "seq_number": 1, "seq_id": 501, "variant_id": null, "variant_label": null, "field": "subject", "inside_block": false, "context_block": false },
{ "seq_number": 2, "seq_id": 502, "variant_id": null, "variant_label": null, "field": "subject", "reused_from_seq_number": 1, "inside_block": false, "context_block": false }
]
},
{
"variable": "Job Title",
"used_in": [
{ "seq_number": 1, "seq_id": 501, "variant_id": null, "variant_label": null, "field": "email_body", "inside_block": false, "context_block": false }
]
}
],
"variables_truncated": false,
"texts_not_checked": [],
"data": [
{
"lead_id": 9001,
"campaign_lead_map_id": 7001,
"email": "lead@example.com",
"status": "STARTED",
"blank_variables": [
{ "variable": "first_name", "reason": "empty", "seq_numbers": [1, 2], "only_inside_block": false },
{ "variable": "Job Title", "reason": "missing", "seq_numbers": [1], "only_inside_block": false }
]
}
]
}
{
"statusCode": 400,
"error": "Bad Request",
"message": "\"limit\" must be less than or equal to 500",
"validation": { "source": "query", "keys": ["limit"] }
}
{ "error": "Campaign not found - Invalid campaign_id." }
Response Fields
Only the leads on this page that have at least one blank variable.
blank_variables[].seq_numbers are the steps where it would be sent blank.true when the campaign is too large to check in full (more than 500 different variables, 5,000 variable uses or 5,000 step texts); only the first ones are checked.Subjects or bodies too large to check (over 2,000,000 characters, or past 4,000,000 characters for the whole campaign).
Related
- MCP tool:
check_campaign_blank_variables(same input and output). - Get Campaign Sequences
- Get Campaign Leads
