# Validate Mailjet Contacts

URL: https://email-validation.org/docs/guides/mailjet/
Updated: 2026-11-29

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

Check the addresses of a Mailjet contact list and write each contact's result into four contact properties, then send
your campaigns to a segment of the addresses that passed. A sync script you run on your own computer checks the list
as one bulk list and writes the results back. It never deletes, excludes or unsubscribes a contact, and it adds no
one to a list or takes anyone off one. Download it:
[email-validation-mailjet.zip](https://email-validation.org/downloads/mailjet/email-validation-mailjet.zip) holds `mailjet.mjs` (the sync script)
and the MIT licence.

## What you need

- **A computer** with Node 22.18 or later. Nothing to install: the script has no dependencies.
- 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).
- Your Mailjet API key and secret (Private API) key: in Mailjet, **Account settings** → **API Key Management (Primary and Subaccounts)**. Mailjet shows a
  secret key only once, when it is created or reset: use the one you saved, or reset it there (gear icon, **Reset
  Secret Key**), which stops every other use of the old one. They can do everything in your account, so keep them
  secret.
- To send to a segment: segmentation, which Mailjet's pricing lists from its Essential plan.

## Run the sync

```bash
cd email-validation-mailjet                         # the unzipped folder
export EV_API_KEY=…  MJ_APIKEY_PUBLIC=…  MJ_APIKEY_PRIVATE=…
node mailjet.mjs --lists                             # every contact list: id, contact count, name
node mailjet.mjs --list <list id> --dry-run          # what it would check; spends nothing, writes nothing
node mailjet.mjs --list <list id>                    # checks and writes the four properties
```

The first run creates the four contact properties (`node mailjet.mjs --setup` creates only the properties). Contacts
unsubscribed from the list or excluded from campaigns are left out unless you pass `--include-unsubscribed`. Contacts
that already have a result (other than `unknown`) are skipped; `--revalidate` checks them again. `--region eu` (or
`EV_REGION=eu`) checks and keeps the list in the EU, with the same key.

The sync does not ask before it spends: run it with `--dry-run` first to see how many contacts it would check. Each
distinct address uses one credit; `unknown` results, duplicates and malformed addresses are free.

## What it writes

| Contact property | Value |
|---|---|
| `ev_status` | `valid`, `invalid`, `catch_all`, `unknown` or `disposable` ([statuses](https://email-validation.org/docs/statuses/)) |
| `ev_reason` | why, for example `accepted`, `no_mailbox`, `spamtrap` |
| `ev_action` | `send`, `send_with_caution`, `remove` or `retry_later` |
| `ev_checked_at` | when the check ran, in UTC |

The properties are text properties. One that exists with another type stops the sync before anything is checked.
Trust `ev_action`, not `ev_status`: spam traps and complainers are `valid` with the action `remove`.

To mail only the addresses that passed, make a segment with the condition "ev_action equals send" (add "or ev_action
equals send_with_caution" to keep catch-all addresses) and pick it, with the list, for your campaigns: the segment
holds the addresses to keep. Contacts not checked yet hold no `ev_action` and are not in it, so run the sync before a
campaign. A segment "ev_action equals remove" lists the addresses to avoid, for you to exclude or delete in Mailjet;
never send a campaign to it.

## New contacts

Mailjet's event webhooks carry message events (sent, open, click, bounce, spam, blocked, unsub), with no event for a
contact added to a list, so there is no relay that checks each new contact as it arrives. Run the sync on a schedule
instead, for example daily with cron: each run checks only the contacts without a result. A scheduled run does not see
your shell's `export`s: give it all three keys, and `EV_REGION=eu` (or `--region eu`) if you check in the EU, on every
run, cron included.

## Try it free first

Make a test contact list in Mailjet and add one contact by hand with the address
`no_mailbox@sandbox.email-validation.org`. Test addresses cost nothing, and that domain receives no mail, so send it
nothing. Run `node mailjet.mjs --list <the test list's id>`: it should exit `0`, and the contact gets `ev_status`
`invalid` and `ev_action` `remove`. Then delete the test list and the contact.

## Run it again

Run the same command again after any stop (no credits, a closed laptop, an outage, the bulk list still running): it
resumes the same bulk list and never pays twice (within the 30 days a list is kept). 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, never an address or a key. When every contact is written, the file is removed and the next run checks only
contacts without a result (or with `unknown`).

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 contact ids, job ids and counts, never an address or a key.

## Stop it and end its access

To stop, remove the scheduled run (your crontab line). Deleting the unzipped folder does not end access: to end it,
reset the secret key in Mailjet: **Account settings** → **API Key Management (Primary and Subaccounts)**, the gear icon next to the key, **Reset Secret
Key** (a copy a cron job still holds stops working only then; anything else that uses that key needs the new secret).
Then delete our API key on the [API keys page](https://email-validation.org/app/api-keys/).

## More on Mailjet

- [Mailjet integration](https://email-validation.org/integrations/mailjet/)
