DEV Community

Ing. Pablo Cueto
Ing. Pablo Cueto

Posted on

How I Built a 4-Layer Email Validator API with FastAPI and Published it on RapidAPI

I just launched Email Validator API on RapidAPI — a professional email
verification service built with Python and FastAPI.

Most email validators only check syntax. Mine runs 4 layers of verification
and returns a confidence score for every email.

The 4 Layers

Layer 1 — Syntax Check
Validates format against RFC 5322 standards. Also detects common typos
and suggests corrections — for example user@gmial.comuser@gmail.com.

Layer 2 — DNS / MX Lookup
Confirms the domain exists and is configured to receive emails using
dnspython. Catches domains that look valid but can't receive mail.

Layer 3 — Disposable Domain Detection
Flags throwaway addresses from 3,000+ known providers like Mailinator,
Guerrilla Mail, YOPmail and TempMail. Essential for preventing fake signups.

Layer 4 — SMTP Verification
Performs a real SMTP handshake to confirm the mailbox exists — without
sending a single email. Available on Pro plans.

The Response

Every request returns a detailed JSON breakdown:

{
"email": "user@gmail.com",
"valid": true,
"score": 95,
"syntax_valid": true,
"mx_found": true,
"disposable": false,
"smtp_valid": true,
"suggestion": null,
"error": null
}

Score Interpretation

Score Meaning
0–29 Invalid syntax
30–54 Domain issues
55–74 Likely valid
75–94 Valid + not disposable
95–100 Fully verified via SMTP

Tech Stack

  • FastAPI — async endpoints, automatic Swagger docs
  • dnspython — async DNS/MX lookups
  • slowapi — rate limiting per plan tier
  • Render — deployment
  • RapidAPI — marketplace and monetization

Plans

Plan Requests/month Layers Price
BASIC 100 1–2 Free
PRO 5,000 1–3 $9/mo
MEGA 20,000 1–4 $19/mo
ULTRA 50,000 1–4 + bulk $29/mo

Try it

🔗 https://rapidapi.com/PabsCueto/api/email-validator-api32

Free plan available — no credit card required.

Happy to answer questions about the implementation!

Top comments (0)