Black Friday25% off all plans and credit packsEnds inSee prices
BounceLayer

Email Verification API: How to Check Emails in Real Time at Signup (with Code)

Bad addresses get into your list through one door: the signup form. An email verification API checks each address the moment it's typed, so typos, fake and throwaway addresses never reach your database. Here's what a check returns, what to do with each result, and working code in cURL, Python and Node.js.

Published 9 min read
Share
Email verification API at signup: valid means accept, invalid means block and ask again, disposable means block, catch-all and unknown mean accept and check later

Quick answer

An email verification API checks one address in real time and tells you whether it can receive mail: valid, invalid, disposable, catch-all, unknown or risky. Call it from your server when someone submits a signup or checkout form, block invalid and disposable addresses with a clear message, suggest a fix for typos like gmial.com, and accept catch-all and unknown results so real people are never turned away. Put a timeout of a few seconds on the call and let the signup through if it fails, so a slow mail server never breaks your form.

What an email verification API does

An email verification API takes one email address and tells you whether mail sent to it will be delivered. It checks that the address is written correctly, that the domain exists and accepts mail, and whether the mailbox itself is there, without sending an email. The answer comes back in a second or two as a status your code can act on.

It is different from email syntax validation, which only checks the format (an @, a dot, no spaces). An address like jane@gmial.com passes every format check and still bounces. A verification API catches it because it looks at whether the domain and mailbox are real.

Why check emails at signup instead of later

Most bad addresses enter a list through forms: a typo on a phone keyboard, a throwaway address used to grab a discount, or a bot filling in random addresses. Once they are in your database, they cause bounces on your next campaign, fake accounts that skew your numbers, and welcome emails that never arrive.

Checking at the form fixes the problem at its source. The person is still on the page, so you can ask them to correct a typo while they can do it. Cleaning a list in bulk later is still worth doing for older data, but real-time checks stop the list from getting dirty again.

  • Fewer hard bounces, which protects how Gmail, Outlook and Yahoo treat all your email.
  • Fewer fake and duplicate accounts from throwaway addresses.
  • Welcome, password-reset and receipt emails that actually arrive.
  • Cleaner sign-up and conversion numbers, because they count real people.

Get a free API key with 300 checks a month and try your first call in under a minute.

Get a free API key

What each result means and what to do

Every check returns a status. The safe rule is simple: block only what is certainly bad, and accept anything uncertain. Turning away a real customer costs more than one questionable address.

Typos are the biggest win

When the API returns a suggestion (for example jane@gmail.com for jane@gmial.com), show it as 'Did you mean jane@gmail.com?' with one click to fix it. These are real people who want to sign up.

StatusWhat it meansWhat to do at signup
validThe mailbox exists and accepts mailAccept
invalidThe address will bounce: bad format, no such domain or no such mailboxBlock and ask the person to check it
disposableA temporary, throwaway inboxBlock and ask for a permanent address
catch_allThe domain accepts every address, so the mailbox can't be confirmedAccept; watch engagement
unknownThe mail server didn't give a clear answer in timeAccept; re-check later
do_not_mailLikely works but risky, e.g. a shared role inbox like info@Accept for accounts; consider excluding from marketing

Make your first call with cURL

Create a free account, copy your API key from the dashboard, and send one address. The key goes in the X-API-Key header. Each definitive result (valid, invalid, disposable, catch-all, do-not-mail) uses one credit; unknown results are free.

terminal
curl -X POST https://api.bouncelayer.com/api/v1/verify/single \
  -H "X-API-Key: $BOUNCELAYER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email": "jane@gmial.com"}'

Read the response

The fields you need for a signup decision are status, did_you_mean and explanation. The rest (MX records, flags for disposable, role-based and free-provider addresses) is there when you want more detail.

response.json
{
  "success": true,
  "credits_used": 1,
  "credit_balance": 299,
  "result": {
    "email": "jane@gmial.com",
    "status": "invalid",
    "is_valid": false,
    "is_disposable": false,
    "is_role_based": false,
    "is_catch_all": false,
    "is_free_provider": false,
    "did_you_mean": "jane@gmail.com",
    "explanation": "This domain doesn't accept email. It looks like a typo of gmail.com."
  }
}

Verify at signup in Python

Run the check on your server inside the signup handler. The timeout and the try/except are the important part: if the check can't finish quickly, the person still gets their account.

signup_check.py
import os
import requests

API_URL = "https://api.bouncelayer.com/api/v1/verify/single"
BLOCK = {"invalid", "disposable"}

def check_signup_email(email: str) -> dict:
    """Return {"ok": bool, "message": str | None, "suggestion": str | None}."""
    try:
        r = requests.post(
            API_URL,
            json={"email": email},
            headers={"X-API-Key": os.environ["BOUNCELAYER_API_KEY"]},
            timeout=5,
        )
        r.raise_for_status()
        result = r.json()["result"]
    except (requests.RequestException, KeyError, ValueError):
        # Fail open: never lose a signup because the check was slow.
        return {"ok": True, "message": None, "suggestion": None}

    if result["status"] in BLOCK:
        return {
            "ok": False,
            "message": "Please use an email address you can receive mail at.",
            "suggestion": result.get("did_you_mean"),
        }
    return {"ok": True, "message": None, "suggestion": result.get("did_you_mean")}

Verify at signup in Node.js

The same logic in Node.js 18+ with the built-in fetch. AbortSignal.timeout keeps the request from hanging your form.

checkSignupEmail.js
const API_URL = "https://api.bouncelayer.com/api/v1/verify/single";
const BLOCK = new Set(["invalid", "disposable"]);

export async function checkSignupEmail(email) {
  try {
    const res = await fetch(API_URL, {
      method: "POST",
      headers: {
        "X-API-Key": process.env.BOUNCELAYER_API_KEY,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ email }),
      signal: AbortSignal.timeout(5000),
    });
    if (!res.ok) return { ok: true }; // fail open
    const { result } = await res.json();
    if (BLOCK.has(result.status)) {
      return {
        ok: false,
        message: "Please use an email address you can receive mail at.",
        suggestion: result.did_you_mean ?? null,
      };
    }
    return { ok: true, suggestion: result.did_you_mean ?? null };
  } catch {
    return { ok: true }; // timeout or network error: let the signup through
  }
}

Best practices for production

A few rules keep real-time verification helpful instead of annoying:

  • Keep the API key on your server. A key in browser JavaScript can be copied and used by anyone. For a no-backend site, use a signup widget with a public, domain-locked key instead.
  • Set a timeout of 3 to 5 seconds and fail open. A small number of mail servers answer slowly on purpose.
  • Check on submit, not on every keystroke. Checking half-typed addresses wastes credits and slows the form.
  • Don't re-check the same address on every login. Verify at signup and when someone changes their email.
  • Write the error message for people: 'Please check your email address' works better than 'SMTP 550'.
  • Handle a 402 (out of credits) and 429 (rate limit) the same way as a timeout: let the signup through and log it.
  • Verify older contacts in bulk before you email them, since real-time checks only protect new signups.

How to choose an email verification API

Compare providers on the things that change your results and your bill, not only on the headline price per check:

What to checkWhy it matters
Do unknown results cost credits?Unknowns are common on some providers' servers; paying for them raises your real cost per useful answer
Speed of a single checkAnything over a few seconds is noticeable on a signup form
Typo suggestionsRecovers real signups instead of only blocking them
Disposable-domain coverageNew throwaway domains appear every day
Credits that don't expireMonthly-expiring credits punish seasonal senders
Free tier and docsYou should be able to test with your own data before paying

Common questions

What is an email verification API?

It is a web service that checks whether an email address can receive mail and returns a status such as valid, invalid, disposable, catch-all or unknown. You call it from your own code, usually when someone signs up or enters an email in a form.

Is email validation the same as email verification?

No. Validation usually means checking the format of the address. Verification also checks that the domain accepts mail and that the mailbox exists, so it catches typos like gmial.com and closed mailboxes that look perfectly formatted.

Should I block catch-all and unknown emails at signup?

No. Catch-all and unknown mean the address couldn't be confirmed either way, and many belong to real people at companies. Accept them, and block only invalid and disposable addresses.

How fast is a real-time email verification check?

Most checks finish in one to two seconds. A few mail servers are slow on purpose, so set a timeout of 3 to 5 seconds and let the signup through if it runs out.

Can I call an email verification API from the browser?

Don't send your secret API key from browser code, because anyone can copy it. Call the API from your server, or use a signup widget that has a public key locked to your domain.

Is there a free email verification API?

Yes. BounceLayer gives free accounts 300 checks every month, no credit card needed, and unknown results never use a credit.

About the author

The people who build BounceLayer, an email verification service. We write plain-English guides on email deliverability, list cleaning and bounce rates, based on what we see helping senders every day.

Published November 30, 2026

Check your email list for free

Find bad addresses before you send. Get 300 free checks every month, with no card needed.