JavaScript SDK · Feature

Email Validation in Node.js

Check whether an email address is real, deliverable, and safe to accept — before it ever enters your database. The ip-api-io client exposes three levels: a fast syntax/MX/disposable check, full SMTP verification, and a batch endpoint for cleaning whole lists.

Trusted by thousands of businesses
Fast JSON API responses
Real-time validation
Simple integration, SDKs & examples
What it does

Stop fake and undeliverable signups at the door

Invalid, disposable, and undeliverable addresses inflate bounce rates, distort metrics, and let fraud through. Validating at the point of capture keeps your list clean and your sender reputation healthy. The SDK lets you match the depth of the check to the moment — a fast inline check on the form, full SMTP verification before billing, or a batch run to clean an existing list.

Prerequisites

1

Fast check with emailInfo

A lightweight check (no SMTP probe): validates syntax, confirms the domain has MX records, and flags disposable providers. Use it inline on sign-up forms.

import { IpApiClient } from "ip-api-io";

const client = new IpApiClient({ apiKey: process.env.IP_API_IO_KEY });

const info = await client.emailInfo("user@example.com");

console.log(info.syntax.is_valid);    // true
console.log(info.is_disposable);      // false
console.log(info.has_mx_records);     // true
console.log(info.mx_records[0]?.hostname);
2

Full SMTP verification with validateEmail

Connects to the mail server to confirm the mailbox is deliverable, and adds role-account, free-provider, catch-all, and Gravatar signals.

const result = await client.validateEmail("user@example.com");

console.log(result.reachable);          // "yes" | "no" | "unknown"
console.log(result.smtp?.deliverable);  // true
console.log(result.smtp?.catch_all);    // false
console.log(result.disposable);         // false
console.log(result.role_account);       // false  (e.g. info@, support@)
console.log(result.free);               // false  (e.g. gmail.com)
console.log(result.suggestion);         // typo fix, e.g. "user@gmail.com"
3

Clean a list with validateEmailBatch

Advanced-validate up to 100 addresses in one request — the building block for email list cleaning. Throws RangeError if the array is empty or longer than 100.

const batch = await client.validateEmailBatch([
  "user@example.com",
  "fake@mailinator.com",
  "info@example.org",
]);

console.log(batch.totalProcessed);          // 3
console.log(batch.successfulValidations);   // 3

for (const [email, result] of Object.entries(batch.results)) {
  console.log(email, result.reachable, result.disposable);
}
Reference

Response reference

EmailInfo (from emailInfo)

FieldTypeDescription
emailstringThe address checked
is_disposablebooleanThrowaway / temporary provider
has_mx_recordsbooleanDomain can receive mail
mx_recordsarrayEach: priority, hostname, ttl
syntaxobjectis_valid, domain, username, error_reasons

AdvancedEmailValidation (from validateEmail)

FieldTypeDescription
reachablestring"yes", "no" or "unknown"
smtpobject | nullhost_exists, deliverable, full_inbox, catch_all, disabled
gravatarobject | nullhas_gravatar, gravatar_url
suggestionstring?Suggested correction for a likely typo
disposablebooleanThrowaway provider
role_accountbooleanRole address (info@, sales@, …)
freebooleanFree webmail provider
has_mx_recordsbooleanDomain can receive mail
FAQ

Frequently asked questions

How do I validate an email address in Node.js?

For a fast check, call await client.emailInfo(email) — it validates syntax, confirms MX records, and flags disposable providers without an SMTP probe. For full deliverability, use client.validateEmail(email), which connects to the mail server.

What is the difference between emailInfo and validateEmail?

emailInfo is a lightweight syntax + MX + disposable check, ideal inline on sign-up forms. validateEmail performs full SMTP verification (host_exists, deliverable, catch_all) plus role-account, free-provider and Gravatar signals.

How do I verify a whole list of emails?

Use client.validateEmailBatch(emails) with up to 100 addresses per request. It returns a results map plus totalProcessed, successfulValidations and failedValidations. The SDK throws a RangeError if the array is empty or longer than 100.

Can the SDK detect disposable or role-based emails?

Yes. Both methods return is_disposable for throwaway providers, and validateEmail also returns role_account (info@, support@) and free (gmail.com and similar), plus a suggestion field that corrects likely typos.

Start building with the ip-api.io JavaScript SDK

Install ip-api-io, drop in your free API key, and ship in minutes — one typed client for geolocation, fraud detection, and email validation.

Need support?

Explore how IP-API.io can enhance your security, provide robust bot protection, and improve IP geolocation accuracy for your applications.

Contact Support

Found a bug in the SDK?

The ip-api-io package is open source. Open an issue or pull request on GitHub and we'll take a look.

Open on GitHub