EmailFilter

API reference

GET / lists every endpoint and GET /help/<path> describes one, for example /help/filter-email.

Method and path Description
POST /filter-email Check an address. Body: {"email": "..."}.
POST /feedback/spam Report the domain of an address as spam. Body: {"email": "..."}.
POST /whitelist?domain=example.com Add a domain to the whitelist.
DELETE /whitelist?domain=example.com Remove a domain from the whitelist.
POST /blacklist?domain=example.com Add a domain to the blacklist.
DELETE /blacklist?domain=example.com Remove a domain from the blacklist.
GET /lists All lists.
GET /lists/{name} One list: whitelist, blacklist, disposable or spam_keywords.
DELETE /lists/{name} Empty a list.
GET /scores The weights in effect.
POST /scores Change weights.
POST /scores/default Restore the built-in weights.
GET /reputation/{domain} Checks, spam reports and current penalty of a domain.
DELETE /reputation/{domain} Forget a domain's checks and reports, for example after false reports.
GET /healthz Health check with the running version. Needs no API key.

A domain on the blacklist cannot be added to the whitelist, and the other way round, until it is removed. Errors are JSON with a detail message.

Checking an address

curl -X POST http://localhost:8000/filter-email \
  -H "Content-Type: application/json" \
  -d '{"email": "john@example.com"}'
{
  "email": "john@example.com",
  "domain": "example.com",
  "disposable": false,
  "blacklisted": false,
  "whitelisted": false,
  "mx_exists": true,
  "mx_records": ["mx1.example.com", "mx2.example.com"],
  "gibberish": false,
  "smtp_valid": true,
  "catch_all": false,
  "new_domain": false,
  "domain_age_in_days": 10950,
  "spam_keywords": false,
  "reputation_penalty": 0,
  "score": 90,
  "verdict": "accepted"
}
Field Meaning
email, domain The address with the domain in lowercase ASCII form (punycode for internationalized domains).
disposable The domain or a parent domain is on the disposable list.
blacklisted, whitelisted The domain or a parent domain is on your blacklist or whitelist.
mx_exists, mx_records The domain has mail servers, listed by priority. mx_records is null when there are none.
gibberish The local part has five or more consonants in a row.
smtp_valid A mail server confirmed the mailbox exists. false when it does not, when the server could not be asked, or when the server is a catch-all.
catch_all The mail server accepts any address, so it cannot confirm this one.
new_domain, domain_age_in_days Days since the domain was registered, and whether that is under EMAILFILTER_NEW_DOMAIN_DAYS. null and false when the date is unknown.
spam_keywords The local part contains a word from lists/spam_keywords.txt.
reputation_penalty Points taken off for spam reports about the domain.
score, verdict The score from 0 to 100, and accepted when it is at least EMAILFILTER_ACCEPT_SCORE (60).

An address that is not valid syntax gets HTTP 422 with a detail message.

Edit this page on GitHub

Keep fake addresses out before they sign up.

Free and open source. No sign-up, no API key, no address leaves your server.

10test@mailinator.comrejectedDisposable email domain 30xkcdqwrt@nonexistent.examplerejectedNo mail servers 90john.smith@gmail.comacceptedMailbox exists, established domain