Integrations · CRM

Validate your Close contacts

Check the email addresses of your Close contacts and write each result into four contact custom fields, so your Smart Views and sequences can leave out the addresses you should not mail. A script you run on your own computer reads every contact, checks the addresses as one bulk list and writes the results back. It never deletes, merges or changes a contact's address. Download it: email-validation-close.zip holds close.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 Validate addresses, and the permission Bulk lists (off by default: turn it on when you create the key) for more than 50 contacts.
  • A Close API key: Close → Settings → Developer → API Keys (your role needs the permission to manage its own API keys). The key acts as your Close user, so that user needs to see and edit all leads, and, for the first run, the Manage organization permission: the first run creates the four custom fields (an admin can create them instead, as below).

Try it free first

Every checked address uses one credit, so try it on a Close account that holds only test contacts, never on your real ones. Give one test contact the address no_mailbox@sandbox.email-validation.org (sandbox checks are free; that domain receives no mail, so send it nothing), then:

cd email-validation-close                     # the unzipped folder
export CLOSE_API_KEY=… EV_API_KEY=…
node close.mjs --dry-run                      # creates nothing, checks nothing, writes nothing: only counts
node close.mjs                                # creates the four fields if missing, checks and writes

The contact's ev_status field says invalid and ev_reason says no_mailbox. Run it once more: it reports nothing to check, because every result was written. Then delete the test contact.

Run it

node close.mjs --dry-run      # how many contacts would be checked; free
node close.mjs                # checks and writes

Up to 50 addresses are checked one by one; more go out as one bulk list. A contact is checked by its first address, and one whose address already has a result is skipped (an unknown result is checked again), so a daily run checks only new and changed addresses. If a run stops, run the same command again from the same folder: it resumes the same bulk list and never pays twice (within the 30 days a list is kept). The state file (.ev-close-<organization id>.json) lives in that folder. It prints ids and counts, never an address or a key.

Options:

  • --region eu: checked in the EU, lists and results kept there, with the same key.
  • --revalidate: check again addresses that already have a result.
  • --rate N: Close requests a second (default 3, at most 10). Close limits each key and each organization; the script waits what Close asks, up to a minute per wait; if Close still refuses, it stops and the same command resumes.
  • --state FILE: a state file of your own choosing.

Exit codes: 0 done; 1 a write failed or the run stopped (run it again: nothing is paid twice); 2 wrong options; 75 the bulk list was still being checked when the script stopped waiting (run it again later to collect it).

What it writes

Four contact custom fields of type Text, created by the first run when they are missing (an admin can create them in Close first, with exactly these names):

FieldHolds
ev_statusvalid, invalid, catch_all, unknown or disposable
ev_reasonthe reason, for example no_mailbox or accepted
ev_checked_atwhen it was checked
ev_address_hasha hash of the address the result belongs to, so a changed address is checked again

Spam traps and complainers are valid with a warning reason: see what each status means. Each result is written by contact id, and only while the contact still holds the address that was checked; the write sends only these four fields, so the contact's other fields and its addresses stay as they are. A result that could not be written is kept in a file next to the state file and written by the next run without a new check.

A Smart View on ev_status is invalid or disposable finds the contacts to leave out of your sequences.

End the access

Delete the Close API key in Close (Settings → Developer → API Keys) and our key on the API keys page. The four fields stay on your contacts until you delete them in Close.

More on Close

Updated · Maintained by: Email Validation LLC

Need help? Contact support, or ask the help chat. Something wrong or missing on this page? Tell us