# Clean Smartlead Leads Before You Send

URL: https://email-validation.org/docs/guides/smartlead/
Updated: 2026-11-27

> Documentation index: https://email-validation.org/llms.txt

Check the leads of a Smartlead campaign before you send, and write each lead's status into its custom fields, so
your campaigns can leave out the leads you should not mail. The script reads the leads, checks them as one bulk list,
tells you what it will cost and asks before it spends anything. It never deletes a lead, never removes one from a
campaign, and never changes any other field. Download it: [smartlead.mjs](https://email-validation.org/downloads/smartlead/smartlead.mjs), one file.

## What you need

- **A computer with Node 22.18 or later.** The script has no browser-only option. Nothing to install: it has no
  dependencies. With only a browser, export the leads from Smartlead as a CSV file and upload it as a
  [bulk list](https://email-validation.org/docs/bulk/) on our site instead; you then act on the results file yourself.
- An API key of ours from the [API keys page](https://email-validation.org/app/api-keys/) with the permission **Bulk lists** (off by default:
  turn it on when you create the key). With **Read balance and usage** too, the script shows your balance before it
  asks.
- A Smartlead admin API key: in Smartlead, your avatar → **Settings** → **API Key Management** → **Admin API Keys**,
  then copy an active key, or select **+ Create Admin Key** and name it. Smartlead offers API access on its Pro plan
  and higher (on lower plans API Key Management is hidden), to the account owner or a team member with admin
  access. Give the script a key of its own, and keep it like a password.

## Run it

```bash
export EV_API_KEY=…  SMARTLEAD_API_KEY=…
node smartlead.mjs --lists                     # your campaigns and lead lists, with their ids and lead counts
node smartlead.mjs --campaign <id> --dry-run   # what it would check and the most it would cost; spends nothing
node smartlead.mjs --campaign <id>             # asks, then checks and writes the statuses back
node smartlead.mjs --campaign <id> --yes       # without asking (for a scheduled run)
```

Before it spends, the script shows the leads it will check, the distinct addresses, the most credits it will use
(one per distinct address; `unknown` results, duplicates and malformed addresses are free) and your balance, and asks
you to confirm. With `--yes` it goes on without asking; without a terminal and without `--yes` it stops before
spending.

It checks the leads that have an address and no status yet (or `unknown`), and skips unsubscribed and blocked
leads. `--revalidate`
also checks leads that already have a status; `--all-leads` also checks unsubscribed and blocked ones. `--region eu`
checks and keeps the list in the EU.

Lead lists: Smartlead's API cannot read the leads of a lead list, so the script cleans campaigns. Add a list's leads
to a campaign in Smartlead first, then clean the campaign.

## What it writes

| Lead custom field | Value |
|---|---|
| `email_validation_status` | `valid`, `invalid`, `catch_all`, `unknown` or `disposable` ([statuses](https://email-validation.org/docs/statuses/)) |
| `email_validation_action` | `send`, `send_with_caution`, `remove` or `retry_later` |
| `email_validation_checked_at` | when the results were written, in UTC |

Leave out the leads whose `email_validation_action` is `remove`: that includes spam traps and complainers, which are
`valid` with the action `remove`. A new check replaces the old values. Every other field of the lead keeps its value:
Smartlead merges the custom fields sent with the lead's others, and the script reads each lead again right before
it writes and sends its address back exactly as Smartlead holds it. After its first write it checks that lead
once more: if Smartlead changed anything else, it stops there and says so. A lead whose address changed since the check is not written; the next run checks its new
address.

`--pause-remove` (off unless you add it) also pauses, in this campaign, the leads whose action is `remove` and that
are still being sent to (checked right before each pause). A paused lead stays in the campaign and can be resumed in
Smartlead, except on its last step.

## How long it takes

Smartlead limits how many requests its API takes a minute: by its API help article, a client key has 60 a minute by
default, and all the admin keys of an account share 200 a minute; it gives no hourly figure. By default the script
stays under the lower one, at 50 a minute and 800 an hour: writing takes about one request per lead, so 10,000 leads
take about 14 hours. With an admin key that nothing else on your account uses heavily, add
`--rate 100 --per-hour 2400` (about 5 hours for 10,000 leads). The check itself is not slowed by this.

## Run it again

Run the same command again after any stop (no credits, a closed laptop, the bulk list still running): it resumes the
same bulk list and never pays twice (within the 30 days a list is kept). Leads already written are skipped. When every lead is written, the next run
checks only leads without a status or with `unknown`, such as new ones, so you can run it on a schedule with `--yes`. Run it from the same folder each time (or pass the same `--state FILE`): the file it keeps there holds
the bulk list it is working on.

Exit codes: `0` done, `1` a write failed or the run stopped (run it again), `2` wrong arguments, `75` the bulk list
was still running when the script stopped waiting (run it again later).

The script prints counts, ids and the names of your campaigns and lead lists, never an address or a key.

## More on Smartlead

- [Smartlead integration](https://email-validation.org/integrations/smartlead/)
