identify-fake-email
v0.1.5
Published
JS API client generated by OpenAPI Generator
Readme
identify-fake-email
A JavaScript SDK for the Email Validator API — ML-powered email validation that goes beyond blacklists.
Most validators rely on MX records, SMTP checks, or static blacklists. This API combines traditional checks with an XGBoost model that scores the risk of accepting an email based on patterns in the username and domain — catching auto-generated disposable emails that traditional methods miss.
Installation
npm install identify-fake-emailor
yarn add identify-fake-emailRequirements
- Node.js 16+
- A RapidAPI key (free tier available — 100 requests/month)
Quick Start
const { EmailValidator } = require("identify-fake-email");
const client = new EmailValidator("YOUR_RAPIDAPI_KEY");
async function main() {
const result = await client.validate("[email protected]");
console.log(`Valid: ${result.valid_email}`);
console.log(`Name risk: ${result.name_risk}`);
console.log(`Domain risk: ${result.domain_risk}`);
if (result.name_risk > 0.7 || result.domain_risk > 0.7 || !result.valid_email) {
console.log("Suspicious - reject or review");
} else {
console.log("Safe to accept");
}
}
main();ES Modules
import { EmailValidator } from "identify-fake-email";
const client = new EmailValidator("YOUR_RAPIDAPI_KEY");
const result = await client.validate("[email protected]");
console.log(result);Bulk Validation
Validate up to 30 emails per request.
const results = await client.validateBulk([
"[email protected]",
"[email protected]"
]);
for (const result of results) {
console.log(`${result.email}: name_risk=${result.name_risk}, domain_risk=${result.domain_risk}`);
}Low-Level Usage
If you need direct access to the API:
const axios = require("axios");
const RAPIDAPI_KEY = "YOUR_RAPIDAPI_KEY";
const RAPIDAPI_HOST =
"email-validator-syntax-mx-disposable-risk-detection.p.rapidapi.com";
async function validateEmail(email) {
const response = await axios.get(
`https://${RAPIDAPI_HOST}/validate`,
{
params: {
email
},
headers: {
"x-rapidapi-key": RAPIDAPI_KEY,
"x-rapidapi-host": RAPIDAPI_HOST
}
}
);
return response.data;
}
validateEmail("[email protected]")
.then(console.log)
.catch(console.error);Response Fields
| Field | Type | Description |
|---|---|---|
| email | string | The email address validated |
| valid_email_structure | boolean | Whether the email has valid syntax |
| is_role | boolean | Whether it's a role address (e.g. admin@, support@) |
| mx_records | boolean | Whether the domain has valid MX records |
| not_disposable | boolean | Whether the domain is on the disposable blacklist |
| new_domain | boolean | Whether the domain was recently created |
| name_risk | number (0–1) | ML risk score for the username — higher means riskier |
| domain_risk | number (0–1) | ML risk score for the domain — higher means riskier |
| valid_email | boolean | Overall validity based on traditional checks |
Risk Scores
name_risk and domain_risk are ML-generated scores between 0 and 1. The higher the score, the more likely the email is fake or disposable.
name_risk is the more reliable of the two — auto-generated usernames follow distinct patterns (random characters, high digit count, unusual consonant/vowel ratios) that the model picks up on. domain_risk is less reliable as auto-generated domains can look similar to legitimate ones.
We recommend using name_risk as your primary signal and combining it with other fields for the most accurate result. The threshold is up to you — 0.7 is a reasonable starting point but you can adjust it for your use case.
Notes
- SMTP validation is intentionally excluded — disposable emails have real mailboxes so SMTP returns valid, adding latency with no benefit
- Bulk validation supports up to 30 emails per request
- Built for both CommonJS and ES Module environments
Links
- RapidAPI Listing — subscribe and get your API key
- Interactive Swagger Docs — explore all endpoints and parameters
- OpenAPI Spec — source spec and SDK generation workflow
License
MIT
