LeadCop docs

Stop disposable, fake and mistyped email addresses at the form. Start with one script tag, or call the API from your own code.

Quick start

The fastest way to protect a website. You copy one line of code and paste it into your site.

  1. Create a free account. No credit card is needed, and your API key is created for you.
  2. Paste this snippet just before the closing </body> tag of your website:
HTML
<script
  src="https://leadcop.io/leadcop-email-validator.js"
  data-api-key="YOUR_API_KEY">
</script>

That's it. LeadCop finds every email field on your pages, including forms that load later, and checks addresses as people type. A disposable address gets a message and the form won't submit:

Temporary email addresses are not allowed.

What a visitor sees with the default theme.

Authentication

There are two ways to use LeadCop, and each uses a different kind of key. Pick the one that matches where your check runs.

Where the check runsHowKey
In the visitor's browserThe script tag or plugins. It calls /api/public/check-email for you.A domain-locked key in data-api-key. Safe to expose.
On your serverCall POST /api/check-email for full control over the response.Your primary key in the Authorization header. Keep it secret.

Bearer token

Send your primary API key from the dashboard in the Authorization header on every request.

HTTP header
Authorization: Bearer YOUR_API_KEY
Important: Primary keys are server-to-server only. Calling the API with a primary key from a browser returns 403. In the browser, use a domain-locked key (one per website, created in the dashboard), or simply the script.

Server-to-server header

When calling from your own backend, add the X-LeadCop-Source header so the request is treated as a trusted server-to-server call, which skips the browser-origin check.

HTTP headers
Authorization: Bearer YOUR_API_KEY
X-LeadCop-Source: server

Check an email

One endpoint checks an email and returns the full breakdown. Send the email in the request body.

POST https://leadcop.io/api/check-email

Example request

cURL
curl -X POST https://leadcop.io/api/check-email \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-LeadCop-Source: server" \
  -H "Content-Type: application/json" \
  -d '{"email": "[email protected]"}'

Response

A 200 OK with the verdict for the email:

JSON
{
  "isDisposable": true,
  "domain": "mailinator.com",
  "reputationScore": 40,
  "riskLevel": "Poor",
  "tags": ["disposable"],
  "reasons": ["Disposable email provider detected"],
  "isValidSyntax": true,
  "isRoleAccount": false,
  "isFreeEmail": false,
  "isInvalidTld": false,
  "didYouMean": null,
  "mxValid": true,
  "smtpValid": true,
  "requestsRemaining": 999
}

Response fields

FieldTypeMeaning
isDisposablebooleanTrue if the domain is a disposable or temporary provider (or blocked by your policy).
reputationScorenumber0–100 quality score. Higher is safer; it combines every signal below.
riskLevelstringReadable band: Excellent, Good, Medium, Poor or Critical.
didYouMeanstring | nullSuggested correction for a likely domain typo, e.g. "gmail.com" for "gmial.com".
isRoleAccountboolean | nullTrue for role addresses like info@ or admin@. Null if your plan lacks role detection.
isFreeEmailboolean | nullTrue for free providers (Gmail, Yahoo…). Null if your plan lacks free-provider detection.
isInvalidTldbooleanTrue if the top-level domain is not a valid, recognized TLD.
mxValidbooleanTrue if the domain has valid MX (mail exchange) records.
tagsstring[]Machine-readable labels, e.g. ["disposable", "role_account"].
reasonsstring[]Readable explanations for the score and any block.
requestsRemainingnumberRequests left in your current billing period, or of your one-time allowance on the free plan.
isAllowlistedbooleanTrue if the address or its domain is on your allowlist (for all keys or for the key in the request). Allowlisted emails return clean flags and should always be accepted. Paid plans.

Error codes

Errors come back with an HTTP status and a JSON body like { "error": "…" }.

StatusWhat it meansWhat to do
400 Bad RequestInvalid request payloadThe request body was missing the email field, was empty, or was not valid JSON. Returns { "error": "Invalid request payload" }.
401 UnauthorizedInvalid API keyThe Authorization header is missing, malformed, or the API key does not match any account.
403 ForbiddenKey used in the wrong contextEither a primary key was called from a browser (primary keys are server-to-server only), or a domain-locked key was used on a domain it isn't authorized for.
429 Too Many RequestsRate limit exceededEither your request quota is used up (upgrade your plan; paid plans refill each billing period, the free allowance is one-time), or you exceeded your per-minute burst limit (plan requests per second × 60). Slow down and retry.
500 Internal Server ErrorTransient server errorA temporary error on our side. Requests are safe to retry. The embedded script and plugins fail open, so form submissions are never blocked by an outage.

Shopify

Protect your storefront's newsletter signups, contact forms and customer registration.

Add the script to theme.liquid

  1. In your Shopify admin, open Online Store → Themes.
  2. Click … next to your active theme and choose Edit code.
  3. Open layout/theme.liquid.
  4. Paste the script immediately before the closing </body> tag:
HTML
<script
  src="https://leadcop.io/leadcop-email-validator.js"
  data-api-key="YOUR_API_KEY">
</script>
Tip: Replace YOUR_API_KEY with a domain-locked key for your store from the LeadCop dashboard.

WordPress

The native plugin protects default registration, comments, WooCommerce and popular form builders, checked on your server.

Install the plugin

  1. In your WordPress admin, go to Plugins → Add New.
  2. Search for LeadCop.
  3. Click Install Now, then Activate.
  4. Open the new LeadCop menu in your admin sidebar.
  5. Paste your API key and click Save Settings.

The plugin is on the official directory, so it installs in one click. View it on WordPress.org. For a manual install, download the .zip there, then use Plugins → Add New → Upload Plugin.

Forms it protects out of the box

  • WordPress registration
  • Comment forms
  • WooCommerce checkout
  • Contact Form 7
  • WPForms
  • Gravity Forms

Or use the script

Prefer no plugin? Paste the script before </body> in your theme's footer.php, or with a header and footer code plugin such as WPCode.

HTML
<script
  src="https://leadcop.io/leadcop-email-validator.js"
  data-api-key="YOUR_API_KEY">
</script>
Note: Country rules work through the script only, not the plugin. To block by country on WordPress, add the script as well (you can keep the plugin for server-side checks) and set your countries in the dashboard.

Wix

The method depends on whether your site is on a Wix Premium or a free plan.

Wix Premium: Custom Code

  1. In your Wix dashboard, open Settings.
  2. Under Advanced, click Custom Code.
  3. Click + Add Custom Code.
  4. Paste the LeadCop script.
  5. Set Place Code in to Body - end.
  6. Choose All Pages (or your contact page) and click Apply.

Wix free plan: HTML embed

The free plan has no Custom Code, so embed your form and the script together inside one HTML element:

HTML
<form action="YOUR_FORM_SUBMIT_URL" method="POST">
  <input type="email" name="email" required />
  <button type="submit">Join the list</button>
</form>

<script
  src="https://leadcop.io/leadcop-email-validator.js"
  data-api-key="YOUR_API_KEY">
</script>

Webflow

LeadCop checks native Webflow form submissions automatically once the script is on your site.

  1. Open your Webflow Project Settings.
  2. Go to the Custom Code tab.
  3. Paste the script into Footer Code.
  4. Click Save Changes and publish your site.
HTML
<script
  src="https://leadcop.io/leadcop-email-validator.js"
  data-api-key="YOUR_API_KEY">
</script>

Framer

Add the script to protect signup forms and lead capture on your Framer site.

  1. Open your project and click Project Settings (the gear icon).
  2. Choose General in the left sidebar.
  3. Scroll to Custom Code.
  4. Paste the script into End of <body>, then save and publish.
HTML
<script
  src="https://leadcop.io/leadcop-email-validator.js"
  data-api-key="YOUR_API_KEY">
</script>

Next.js and React

Use the leadcop-react package, or call the API yourself from client components or server code.

The leadcop-react package

Hooks, a script component and a server helper, with every dashboard rule applied (your allowlist and country rules included in the browser). leadcop-react on npm

Terminal
npm install leadcop-react
TSX
"use client";
import { LeadCopProvider, useEmailCheck } from "leadcop-react";

// Wrap your form: <LeadCopProvider apiKey={process.env.NEXT_PUBLIC_LEADCOP_KEY!}>
const { status, message, check } = useEmailCheck(email);
// On submit: const verdict = await check(); if (!verdict.allow) return;
TypeScript
// Server Action or API route (every rule except country)
import { verifyEmail } from "leadcop-react/server";
const r = await verifyEmail(email); // uses process.env.LEADCOP_API_KEY (your primary key)
if (!r.allow) return { error: r.reasons[0] };

Without the package: a React hook

Check as the user types, with a 500ms pause to limit requests:

TypeScript
import { useState, useEffect } from "react";

type Check = { allow: boolean; message: string | null; checking: boolean };

export function useEmailCheck(email: string): Check {
  const [result, setResult] = useState<Check>({ allow: true, message: null, checking: false });

  useEffect(() => {
    if (!email || !email.includes("@")) return;

    const delay = setTimeout(async () => {
      setResult(prev => ({ ...prev, checking: true }));
      try {
        // Use a domain-locked key here. Primary keys are server-to-server only
        // and return 403 from a browser. Create one under API Keys in the dashboard.
        const res = await fetch("https://leadcop.io/api/public/check-email", {
          method: "POST",
          headers: { "Content-Type": "application/json" },
          body: JSON.stringify({ email, apiKey: "YOUR_DOMAIN_LOCKED_KEY" }),
        });
        const data = await res.json();
        // `allow` already applies every dashboard rule for this key,
        // including your allowlist and country rules.
        setResult({ allow: data.allow !== false, message: data.message ?? null, checking: false });
      } catch {
        // Fail open: never block a real user because the check failed.
        setResult({ allow: true, message: null, checking: false });
      }
    }, 500);

    return () => clearTimeout(delay);
  }, [email]);

  return result;
}

Your dashboard rules in custom code

  • Rules follow the key. Both endpoints apply the dashboard settings for the API key you send (enabled checks, block or warn, your messages). The public endpoint returns a final allow and shouldBlock with your message.
  • Every signal is there. The checks object (checks.role, checks.disposable, checks.freeProvider and more) lets you ignore allow and write your own logic.
  • Allowlist. Allowlisted emails always return allow: true, and the public endpoint adds allowlisted: true. On /api/check-email they return clean flags plus isAllowlisted: true.
  • Country rules need a browser-side check. LeadCop only knows the visitor's country when their browser calls us. Server-side calls come from your server's location, so country rules never apply to them. See Country rules.

Country rules

Block sign-ups from the countries you choose, or accept only the countries you serve. Available on all paid plans; turn it on per API key under API Keys → Widget settings → Countries.

When country rules apply

Country rules use the visitor's location, so the check has to happen in their browser. That works in any stack.

How your site checks emailsCountry rules
The LeadCop script on the page (any stack)Applied
A browser-side fetch to /api/public/check-emailApplied
Your server calls /api/check-email (PHP, a Next.js API route or Server Action, Node, Python)Not applied: we see your server's location
The WordPress pluginNot applied: add the script as well

Add the script

The script finds email fields on its own, including forms your framework renders later, and stops the form before your own submit handler runs.

Next.js (App Router), in app/layout.tsx

TSX
import Script from "next/script";

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        {children}
        <Script
          src="https://leadcop.io/leadcop-email-validator.js"
          data-api-key="YOUR_DOMAIN_LOCKED_KEY"
          strategy="afterInteractive"
        />
      </body>
    </html>
  );
}

React (Vite or Create React App), in index.html before </body>

HTML
<script
  src="https://leadcop.io/leadcop-email-validator.js"
  data-api-key="YOUR_DOMAIN_LOCKED_KEY">
</script>

PHP or Laravel Blade, in your shared layout or footer

PHP
<!-- resources/views/layouts/app.blade.php, footer.php, etc. -->
<script
  src="https://leadcop.io/leadcop-email-validator.js"
  data-api-key="<?= htmlspecialchars(getenv('LEADCOP_PUBLIC_KEY')) ?>">
</script>

Or check from your own UI

Call the public endpoint from the browser and use its verdict. When a country rule matches, reason is "country" and message is the text you set in the dashboard.

TypeScript
// Runs in the browser (a client component), so LeadCop sees the visitor's country.
const res = await fetch("https://leadcop.io/api/public/check-email", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ apiKey: "YOUR_DOMAIN_LOCKED_KEY", email }),
});
const r = await res.json();

if (r.allow === false) {
  showError(r.message); // e.g. "Sign-ups from your region are not accepted."
}
// r.reason  → "country", "disposable", "role_account", ...
// r.country → visitor country, e.g. "US" (null if unknown)

Good to know

  • Use a domain-locked key in browser code. The key is visible in the page; the domain lock stops other sites from using it.
  • Unknown countries are let through. If the country can't be determined, a country rule never blocks the visitor.
  • VPN users appear in the VPN's country.
  • Browser checks can be skipped by bots that post straight to your server. If you also check on your backend, every rule applies there except country rules, which are on our roadmap for server-side calls.
  • Your allowlist wins. An allowlisted email or domain passes even from a blocked country.

Frequently asked questions

How does the real-time email check work?
LeadCop runs several checks in under 100ms: the syntax, the TLD, role-based accounts (like sales@ or admin@), and the domain against our database of more than 200,000 known temporary and disposable email providers.
What happens if the LeadCop API is down?
Every LeadCop script and plugin fails open. If our API is unreachable, the check is skipped and the form submission goes through, so your signups are never blocked by an outage.
How do I always let a trusted domain or address through?
Use the Allowlist (Dashboard → Allowlist, paid plans). Add a domain like partner.com or a single address like [email protected] and choose which API key it applies to, or all keys. Allowlisted emails pass every rule, including your blocklist, on both the website script and the WordPress plugin.
Can I block sign-ups from certain countries?
Yes, on paid plans: Dashboard → API Keys → Widget settings → Countries. Block the countries you choose, or allow only the countries you serve. Country rules work with the LeadCop website script only. They are not applied to the WordPress plugin or to direct API calls, because those requests come from the website's server rather than the visitor. Visitors using a VPN appear in the VPN's country, and visitors whose country can't be determined are let through.
What does the free email warning do?
When it's on, the script shows a warning (but does not block) if someone enters a Gmail, Yahoo, Hotmail or other free-provider address. Useful for B2B products that want a work email without turning anyone away.

Ready to stop fake signups?

Setup takes about two minutes, and the free plan needs no card. Stuck on an install? Email us and we'll help.