Email verification API in Node.js with fetch
By the 1-email.com editorial team · Reviewed October 9, 2026 · Editorial policy
Build a server-side verification call with a timeout, safe key handling and explicit risk classification.
Download and run locally
Node.js 22+. No package installation is needed. Download every file below into the same directory, then run:
node check.mjs
Source files
verify.mjs Download
// Node.js 22+: server code. Only the public sandbox key is supplied by default.
export class VerificationError extends Error {
constructor(status, message, retryAfter = null) {
super(message); this.status = status; this.retryAfter = retryAfter;
}
}
export async function verifyEmail(email, {key = process.env.EEV_API_KEY || 'eev_sandbox_key', fetchFn = fetch} = {}) {
const url = new URL('https://api.easyemailverification.com/v1/verify');
url.searchParams.set('email', email);
let response;
try {
response = await fetchFn(url, {
headers: {'X-API-Key': key, Accept: 'application/json'},
signal: AbortSignal.timeout(30000)
});
} catch {
throw new VerificationError(503, 'No reliable result; review the request before retrying.');
}
if (!response.ok) {
const messages = {402: 'No credits: check your account before retrying.',
429: 'Rate limited: wait before another request; respect Retry-After.'};
throw new VerificationError(response.status, messages[response.status] || 'Verification request failed.', response.headers.get('Retry-After'));
}
let data;
try { data = await response.json(); } catch { throw new VerificationError(502, 'Invalid JSON response.'); }
if (!data || !['valid','invalid','unknown'].includes(data.result)) {
throw new VerificationError(502, 'Unexpected API response; do not classify the address.');
}
return data;
}
export function classify(data) {
if (data.result === 'invalid') return 'invalid';
if (data.result === 'unknown' || data.disposable || data.accept_all || data.safe_to_send !== true) return 'review';
return 'passed_checks';
}
check.mjs Download
import {verifyEmail, classify} from './verify.mjs';
try {
const data = await verifyEmail(process.argv[2] || 'valid@sandbox.easyemailverification.com');
console.log(JSON.stringify({decision: classify(data), result: data.result,
reason: data.reason, did_you_mean: data.did_you_mean}, null, 2));
} catch (error) {
console.error(`HTTP ${error.status || 503}: ${error.message}`);
process.exitCode = 1;
}
Test success, uncertainty and failures
Replace the default test address using the command-line argument (Python/Node) or the form field (signup). Use valid, invalid, unknown, catchall, disposable, quota and ratelimit at sandbox.easyemailverification.com. The special typo@gmial.com fixture gives a correction suggestion.
Expect unknown and risk flags to produce review rather than rejection. Quota should stop the request with 402; a rate limit returns 429. Network or JSON failures should never create a valid or invalid mailbox classification.
Before production
Set EEV_API_KEY in the server environment. Keep the endpoint fixed, set a timeout, limit request size and add abuse controls. For a real signup flow add origin/CSRF protection, your own rate limit and consent handling. Do not retry an uncertain request automatically or silently replace a typo.
Primary source: Easy API reference. Download the example instructions.
Ready for real addresses?
We run Easy Email Verification. Create a free account for a live key after testing your integration.
Get a free live key