Integrations · Sales outreach
Validate your Apollo contacts
Check the saved contacts of an Apollo list or sequence before you send, and write each contact's status into four contact custom fields, so your sequences and filters can leave out the contacts you should not mail. The script reads the contacts your team already saved, checks them as one bulk list, tells you what it will cost and asks before it spends anything. It never deletes a contact, never removes one from a list or sequence, never changes its stage or any other field, and never spends Apollo credits. Download it: email-validation-apollo.zip holds apollo.mjs (the 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 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.
- An Apollo API key (you need to be an Apollo admin, or have a permission profile that allows creating API keys). In Apollo: Settings > Integrations, click Connect beside Apollo API, then API Keys > Create new key (Create API Keys). Select these endpoints (or set it as a master key):
api/v1/contacts/search,api/v1/labels/index,api/v1/emailer_campaigns/search,api/v1/fields/index,api/v1/fields/createandapi/v1/contacts/bulk_update. Pick an integration type, create the key and copy it. Apollo's docs example of a refusedapi/v1/fields/createcall mentions a master key: if Apollo refuses to create the fields for a key with selected endpoints, use a master key. None of these endpoints spends Apollo credits. Apollo documents its contact search and sequence search as available on paid plans only: on a free Apollo plan the script may be refused, and then stops before it spends anything.
Try it free first
Make a test list in Apollo holding one test contact whose email is no_mailbox@sandbox.email-validation.org. Then:
cd email-validation-apollo # the unzipped folder
export EV_API_KEY=… APOLLO_API_KEY=…
node apollo.mjs --lists # your lists (with their contact counts) and sequences, with their ids
node apollo.mjs --list <the test list's id>The test contact gets email_validation_status invalid and email_validation_action remove. Sandbox checks are free, and that domain receives no mail, so send it nothing. Do this on the test list only: on a real list, a run checks every contact without a status, and that is paid.
Run it
node apollo.mjs --list <id> --dry-run # what it would check and the most it would cost; spends nothing
node apollo.mjs --list <id> # asks, then checks and writes the statuses back
node apollo.mjs --sequence <id> --yes # a sequence, without asking (for a scheduled run)Before it spends, the script shows the contacts it will check, the distinct addresses, the most credits it will use (one per distinct address; unknown results, duplicates and malformed addresses are free), your balance and the custom fields it will create in Apollo, 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 contacts that have an address and no status for that address yet (or the status unknown). --revalidate also checks contacts that already have a status. --region eu checks and keeps the list in the EU. --rate N sets how many requests a minute it sends to each Apollo endpoint (40 by default, at most 200: Apollo's limits are for your whole team).
A sequence has no filter in Apollo's API, so the script reads every saved contact of your team to find its contacts. Apollo's search shows at most 50,000 contacts: a list of 50,000 or more, or a sequence in a team of 50,000 saved contacts or more, is refused before anything is spent.
What it writes
| Contact custom field | Value |
|---|---|
email_validation_status | valid, invalid, catch_all, unknown or disposable (statuses) |
email_validation_action | send, send_with_caution, remove or retry_later |
email_validation_checked_at | when the results were written, in UTC |
email_validation_address_hash | which address the result is for (a hash of it, never the address) |
Leave out the contacts 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 contact keeps its value: the script writes one contact first and reads it back, and writes the rest only when nothing else of that contact changed. A contact whose address changed since the check, or that left the list or sequence, is not written. A result counts only for the address it was written for: when a contact's address is replaced later, the next run checks the new address.
Run it again
If a run stops for any reason (your email-validation.org credits ran out, a closed laptop, Apollo's daily limit, the bulk list still running), run the same command again from the same folder: it picks up the same bulk list and never pays twice (within the 30 days a list is kept). Contacts already written are skipped. After that, each run checks only contacts never checked, whose address changed, or last checked as unknown, so you can run it on a schedule with --yes.
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 list's or sequence's name, never an address or a key.