Email validation · Integrations · JavaScript

Integration guide

Email validation in JavaScript.

Validate any email address from JavaScript or Node.js with one API call. Working code, the real JSON response shape, error handling, and where to put the call so your key stays private.

In this guide

Endpoint1 POST
Median responseSub-1s
Free tier100 / month
Standard plan$49.99 / 50,000

How do I validate an email with JavaScript?

No SDK to install. Native fetch is available in Node 18 and up and in every current browser runtime.

Node.js, in your request handler

async function validateEmail(email) { const res = await fetch( "https://api.trueguard.io/v2/email/validation", { method: "POST", headers: { "X-API-KEY": process.env.TRUEGUARD_KEY, "Content-Type": "application/json" }, body: JSON.stringify({ email }) } ); if (!res.ok) throw new Error(`Trueguard ${res.status}`); return res.json(); } const result = await validateEmail("founder@yourcompany.com"); if (result.deliverability.status === "invalid") { // reject the submission }

One header, one body field

Set X-API-KEY to your key and POST a JSON body with a single email field. HTTPS only. The response carries the seven signals plus one deliverability status.

Response fields you will branch on

deliverability.status

safe, risky, invalid or unknown. This is the field to branch on.

syntax.isValid

RFC 5322 format check. Deterministic, so a false here is always a typo or a malformed address.

quality.isDisposable

True for throwaway providers. Usually a hard block at signup.

deliverability.isCatchall

True when the domain accepts any address. The status is then risky, unless a second check confirmed or ruled out the mailbox.

quality.isRole

info@, support@, sales@. Route these differently rather than rejecting them.

Run it once before you write any code.

The same endpoint the snippet above calls. 10 free checks a day, no key needed.

Or try

Where should the call live in a JavaScript app?

Your API key is a secret. Where you put this call decides whether it stays one.

Browser (client-side)

Never call the endpoint from the browser. Anything in front-end JavaScript ships your API key to every visitor, and the quota is then spendable by anyone who opens devtools. If you need a check from the client, proxy it through your own route.

Server-side (recommended)

Call it from your Node handler, Next.js route handler, Express middleware or serverless function. The key stays in an environment variable, and you control the decision on the response before the account or lead is written.

What the endpoint returns

{ "email": "founder@yourcompany.com", "syntax": { "isValid": true }, "deliverability": { "status": "safe", "isSmtpValid": true, "isMxValid": true, "isCatchall": false, "isDeliverable": true, "mxRecords": ["mx1.yourcompany.com"] }, "domain": { "name": "yourcompany.com", "isLive": true, "isRisky": false }, "quality": { "isDisposable": false, "isFree": false, "isRole": false, "isSubaddress": false } }

How do I handle errors and rate limits in JavaScript?

try { const result = await validateEmail(email); handle(result); } catch (err) { if (err.status === 429) { // quota or rate limit: allow with a flag, // do not block a real signup return allowWithFlag(email); } if (err.status === 401) { logger.error("Trueguard key rejected"); } // network timeouts land here too return allowWithFlag(email); }

Status

What to do

200

Validation ran. Read deliverability.status and branch.

400

Malformed request body. Check you are sending JSON with an email field.

401

Missing or rejected API key. Log it loudly: every request is failing.

429

Rate limit or monthly quota reached. Allow the user through with a flag and alert yourself; do not block real signups on your own quota.

5xx

Retry once with a short backoff, then fall back to allowing with a flag.

Which JavaScript frameworks does this work with?

It is one HTTPS request, so anything that can make one works. These are the stacks people ask about.

Node.jsNext.js route handlersExpressNestJSFastifyRemixSvelteKitCloudflare WorkersAWS Lambda

Next.js signup route

Call validateEmail in the route handler that creates the user. Return a field error on invalid, and stop throwaway domains before the account row is written.

Express middleware

Run the check in middleware on your register and lead routes, attach the result to req, and let each handler decide what to allow.

Node list cleaner

Stream a CSV, validate each row with a small concurrency limit, and write safe, risky and invalid rows to three files. Retry on 429.

Edge check in a Worker

Put the call in a Cloudflare Worker in front of your form endpoint, with the key stored as a secret, so junk addresses never reach your origin.

What it costs once you ship.

Three tiers. The free plan needs no card and runs the production endpoint.

Free

$0 forever

100 validations / month

Overage: n/a

Get started free

Standard

Popular

$49.99 / month

50,000 validations / month

Overage: $0.001 per validation

Get your API key

Custom

Contact us

500,000+ validations / month

Overage: Negotiated

Talk to us

Frequently asked questions

The full field reference lives in the API documentation.

Do I need an SDK?

No. There is no official JavaScript SDK and you do not need one: the endpoint is a single POST with one header and one body field. Native fetch covers it in Node 18+, and axios works identically if that is what your project already uses.

Can I call this from React or the browser?

Not directly. Your API key would be exposed to every visitor. Add a route in your own backend that takes the address, calls Trueguard server-side, and returns only the verdict your UI needs.

Does it work in Cloudflare Workers and Lambda?

Yes. Both provide fetch and both can hold the key as an environment secret. The call has no Node-specific dependencies.

What timeout should I set?

Median response is under a second, but a slow destination mail server can push it higher. Set a timeout around 3 to 5 seconds and decide what happens on timeout: usually allow with a flag rather than block a real user.

How do I test without spending quota?

The free tier covers 100 validations a month on the production endpoint, which is enough for integration work. Use the known example addresses in your test fixtures and assert on the status field rather than the whole body.

Validate emails from JavaScript in minutes.

100 validations a month, free, no card. Working code above, production endpoint, same response shape on every plan.

Get your free API key

No credit card required.

trueguard-logo© 2026 Trueguardinfo@trueguard.io