Skip to content
ValidatedMails.com

Validate signup emails on your server

Add verification to signup without exposing API keys, blocking users on inconclusive results, or confusing verification with ownership.

Keep the private key behind your application

Use browser validation for immediate typo feedback, then send the submitted address to your own backend. Your backend calls ValidatedMails using an environment variable. Do not place a private key in frontend bundles, public URLs, analytics events, or client-visible errors. Rate-limit your signup route and enforce your own abuse controls.

Check the HTTP response before the status

The following Node.js server-side helper makes one verification request. It returns review on a timeout or unexpected outcome rather than silently rejecting the user. It does not automatically repeat paid work. Connect it to your own framework, authentication rules, and logging policy.

async function checkSignupEmail(email) {
  try {
    const response = await fetch("https://api.validatedmails.com/validate", {
      method: "POST",
      headers: {
        Authorization: `Bearer ${process.env.VALIDATEDMAILS_API_KEY}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ email }),
      signal: AbortSignal.timeout(120000),
    });
    if (!response.ok) return "review";
    const result = await response.json();
    if (result.status === "invalid") return "correct_address";
    if (result.status === "valid") return "continue";
    return "review"; // risky, unknown, or unexpected response
  } catch {
    return "review"; // no automatic paid retry
  }
}

Give users a way forward

For invalid, explain that the address could not be verified and allow correction. For risky or unknown, apply a review or confirmation policy suited to your application. Do not leave the form spinning for the entire verification budget without feedback. A client timeout means the operation may already have completed; avoid automatic repeats on every keystroke or submit click.