> ## Documentation Index
> Fetch the complete documentation index at: https://api.smartlead.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 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.

> [!NOTE]
>
> 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 `STARTED` or `INPROGRESS`.
* 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.

**When a variable counts as blank**

* `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.

**Things to know**

* Variables inside spintax (`{Hi|Hello} {{first_name}}`) are checked even if a lead's spintax choice would not use them.
* `only_inside_block: true` means 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 in `variables` with `context_block: true` and 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](https://api.smartlead.ai/guides/rate-limits.md#endpoint-specific-rate-limits)).

## Path Parameters

**campaign\_id** `number` *required*

The campaign ID

## Query Parameters

**api\_key** `string` *required*

Your SmartLead API key

**limit** `number` (default: 100)

Leads checked per page, 1 to 500

**offset** `number` (default: 0)

Leads to skip. Use `next_offset` from the previous page while `has_more` is `true`.

```bash cURL theme={null}
curl "https://server.smartlead.ai/api/v1/campaigns/{campaign_id}/blank-variables?api_key=YOUR_KEY&limit=100&offset=0"
```

```python Python theme={null}
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"]
```

```javascript JavaScript theme={null}
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);
```

```json 200 theme={null}
{
  "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 }
      ]
    }
  ]
}
```

```json 400 theme={null}
{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "\"limit\" must be less than or equal to 500",
  "validation": { "source": "query", "keys": ["limit"] }
}
```

```json 404 theme={null}
{ "error": "Campaign not found - Invalid campaign_id." }
```

## Response Fields

**data** `array`

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.

**variables** `array`

Every merge variable found in the campaign's email steps and where it is used.

**total\_leads** `number`

Leads in status `STARTED` or `INPROGRESS`. Page with `offset`/`next_offset` until `has_more` is `false`.

**variables\_truncated** `boolean`

`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.

**texts\_not\_checked** `array`

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](https://api.smartlead.ai/api-reference/campaigns/get-sequences.md)
* [Get Campaign Leads](https://api.smartlead.ai/api-reference/campaigns/get-leads.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.