Skip to content

HassanMak29/email-validator-api

Repository files navigation

Email & Domain Intelligence API

Validate email addresses and enrich them with deliverability and reputation signals in one request.

Built on Cloudflare Workers with Hono. Public listing: https://rapidapi.com/HassanMak29/api/email-and-domain-intelligence

What It Does

  • RFC-style syntax validation
  • Live DNS MX lookup
  • SPF and DMARC presence checks
  • Disposable / temporary inbox detection
  • Role-account detection such as admin@ and support@
  • Free-provider detection with provider name
  • Typo / autocorrect suggestion such as gmal.com -> gmail.com
  • Quality score from 0.0 to 1.0
  • KV-backed caching for repeated lookups

Endpoints

Method Path Description
GET /validate?email=<address> Run the full validation pipeline
GET /health Public health check
GET / Browser tester UI for manual checks

Example Response

{
  "email": "user@gmail.com",
  "is_valid": true,
  "is_format_valid": true,
  "is_disposable": false,
  "is_role_account": false,
  "is_free_email": true,
  "provider_name": "Gmail",
  "is_mx_valid": true,
  "mx_records": [
    {
      "exchange": "gmail-smtp-in.l.google.com",
      "priority": 5
    }
  ],
  "has_spf": true,
  "has_dmarc": true,
  "quality_score": 0.92,
  "autocorrect_suggestion": null,
  "cached": false
}

RapidAPI Usage

For subscribers, the easiest way to use the API is through the RapidAPI playground and generated client snippets on the public listing.

Common request patterns:

  • Valid personal inbox: /validate?email=user@gmail.com
  • Business address: /validate?email=founder@stripe.com
  • Disposable detection: /validate?email=user@mailinator.com
  • Typo suggestion: /validate?email=user@gmal.com
  • Format failure: /validate?email=not-an-email

Direct Worker Testing

Direct requests to the deployed worker are protected so traffic cannot bypass RapidAPI billing. The only public routes are / and /health.

Live worker URL:

https://email-validator-api.hassanmakhloufi.workers.dev

If you want to test /validate against the worker directly as the owner, send the configured RAPIDAPI_PROXY_SECRET header:

curl "https://email-validator-api.hassanmakhloufi.workers.dev/validate?email=user%40gmail.com" \
  -H "X-RapidAPI-Proxy-Secret: YOUR_PROXY_SECRET" | jq

Health is public:

curl "https://email-validator-api.hassanmakhloufi.workers.dev/health" | jq

Local Development

npm install
npm run dev

Local wrangler dev works without auth when RAPIDAPI_PROXY_SECRET is unset or empty.

Testing

Unit and integration coverage:

  • npm test runs 335 tests across syntax, DNS, scoring, disposable detection, middleware, UI, and route flows.
  • npm run smoke runs live checks against the deployed worker.

Full live smoke run with owner auth:

export RAPIDAPI_PROXY_SECRET=YOUR_PROXY_SECRET
npm run smoke

Deployment Notes

# Set or rotate the production secret
npx wrangler secret put RAPIDAPI_PROXY_SECRET --name email-validator-api

# Deploy the worker
npm run deploy

KV binding required in wrangler.toml:

  • EMAIL_CACHE

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors