# Email Validator API - Syntax, MX and Domain Checks (`stas_k/email-validator-api`) Actor

You should not pay for a guess: most email checkers cannot prove a mailbox exists, because SMTP is closed. This one reports format, domain and MX, and charges only for an address it actually checked against DNS.

- **URL**: https://apify.com/stas_k/email-validator-api.md
- **Developed by:** [Stas K](https://apify.com/stas_k) (community)
- **Categories:** Automation, Developer tools, Lead generation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.50 / 1,000 emails

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Email Validator API: format, domain and MX, with no guess about the mailbox

Send a list of addresses, get one row per address: is the format valid, does the domain
exist, does it publish a mail server, is it a disposable or a role address, is it on a
free provider, and is there a popular domain it looks like a typo of.

DNS is asked through a public DNS-over-HTTPS resolver, so the actor needs no API key, no
system resolver and no open UDP port, and it works inside a container.

### What this actor does not do, and why

It does **not** connect to the mail server and does **not** tell you whether a particular
mailbox exists. Port 25 is closed both on our side and inside the Apify container, so any
actor that claims a mailbox verdict is either paying for a third party service or
guessing. We chose to say what we can prove:

- `acceptsMail: true` means the domain publishes an MX record (or, with no MX, an A
  record), so mail to that domain has somewhere to go.
- `acceptsMail` never means "this mailbox is alive". That claim is not made anywhere in
  this actor, and a check that cannot be made comes back as a reason, not as a verdict.

### Input

- `emails` (required): a list of addresses. Surrounding spaces, angle brackets and a
  trailing dot or comma are trimmed, which is what a spreadsheet export adds.
- `checkDns` (default `true`): ask the resolver for MX. Turn it off to get the format
  verdict only: those rows come back as `SYNTAX_ONLY` and nothing is charged, because
  nothing was asked. Such a row keeps what was really computed about the address itself
  (`normalised`, `localPart`, `domain`, `domainAscii`, `syntaxValid`, `isDisposable`,
  `isRole`, `isFreeProvider`, `suggestion`), and it carries **no DNS verdict fields at
  all**: `domainExists`, `hasMx`, `mxHosts` and `acceptsMail` are null.
- `maxEmails` (default 50, maximum 200): how many addresses one run checks.

### Output

One row per address: `email`, `normalised`, `localPart`, `domain`, `domainAscii`,
`syntaxValid`, `domainExists`, `hasMx`, `mxHosts`, `acceptsMail`, `isDisposable`,
`isRole`, `isFreeProvider`, `suggestion`, plus `note`, which is null on today's verdicts
and stays in the row shape so a row never changes shape between versions.

There is deliberately no `valid` field. It could only repeat `acceptsMail`, and buyers
read `valid: true` as "this mailbox exists", which nothing here can prove. `acceptsMail`
is the whole verdict and it is named for exactly what it means.

`domainAscii` is the punycode form that DNS actually uses, so a Cyrillic or accented
domain is reported both as you sent it and as the resolver sees it. `suggestion` is a
popular domain one or two edits away, which catches the `gmial.com` kind of typo.

### Price

You pay for one address that got a verdict from DNS (`email-checked`). The lowest
spending limit you can set per run is $0.05.

Verdicts that are paid, because they answer the question: `OK` (the domain accepts
mail), `NO_SUCH_DOMAIN` (the domain is not in DNS), `NO_MAIL_SERVER` (the domain exists
but publishes no MX and no A or AAAA record).

Free, with a status and a reason instead of a verdict: an address with a broken format
(no lookup was made, so there is nothing to pay for), a repeated address, an address
past `maxEmails`, an address the run had no time for, a resolver we could not reach,
a zone that answered SERVFAIL for the MX query (a temporary failure: the sending side
retries, so there is no verdict to sell), and anything after the spending cap or after
a failed charge.

A row that is not a verdict carries no `mxHosts` and no `acceptsMail`, so a free row can
never be read as a verdict.

### What the DNS answer actually said

- A domain whose MX record is `0 .` publishes a **null MX** (RFC 7505): it refuses all
  mail on purpose. That is a paid verdict, `NO_MAIL_SERVER`, and we do not fall back to
  the A record to pretend otherwise.
- A domain with no MX but with an address record still accepts mail through the implicit
  MX (RFC 5321 5.1), and the address record may be an **AAAA** as well as an A. A domain
  that only publishes IPv6 is not reported as having no mail server.
- A zone that answers **SERVFAIL** for the MX query is a **temporary** failure, not an
  empty MX list, and the two are not the same thing: RFC 5321 5.1 asks the sending side
  to queue and retry, and the implicit MX applies only to an empty list. So the row comes
  back free as `NOT_CHECKED_DNS_ERROR`, with the failing record type in `reason`.
  `gmial.com` is the live example: MX answers SERVFAIL while its A record is alive. An
  earlier build turned that into `acceptsMail: true`, which was wrong: nothing was
  decided, so nothing is sold.
- Addresses are deduplicated by their **parsed identity**, not by the line they arrived
  on, so `a@münchen.de` and `A@xn--mnchen-3ya.de` are one address and are charged once.
- The local part is checked against ASCII rules only. An internationalised local part
  (EAI, a name written in Cyrillic or Chinese) comes back as `INVALID_SYNTAX`: SMTPUTF8
  is not supported here, and the row says so instead of pretending the address is bad.

### Status codes

`OK`, `INVALID_SYNTAX`, `SYNTAX_ONLY`, `NO_SUCH_DOMAIN`, `NO_MAIL_SERVER`,
`NOT_CHECKED_DNS_ERROR`, `DUPLICATE`, `NOT_CHECKED_LIMIT`, `NOT_CHECKED_TIME`,
`NOT_CHECKED_CAP`, `NOT_CHECKED_BILLING`, `NOT_CHECKED_ERROR`.

### Stop reasons

`dataset-write-error`, `billing-price-unknown`, `spending-cap`, `charge-error`,
`deadline`, `unexpected-error`.

A line the run never reached is named for the real cause: a spending cap gives
`NOT_CHECKED_CAP`, any other stop gives `NOT_CHECKED_ERROR` with the reason spelled out.

### Run summary

Written to the run store under `RUN_SUMMARY`, and a copy per run to the
`email-validator-summary` store under `RUN_SUMMARY-<runId>`. `counterMismatch` is `false`
only when every input line ended up in exactly one status.

The dataset counter is the only instrument that tells "the rows landed but the charge
failed" from "the write was refused", so it is read three times before and after a paid
write. If it still cannot be read, the summary says that **delivery and the charge are
both unknown**, counts those lines in `emailsUnverified` and `chargeUncertain`, and asks
you to check the dataset before re-running. It never claims that nothing was delivered or
that nothing was charged, because that claim is what makes a buyer pay twice.

The counter of addresses whose domain accepts mail is `emailsAcceptMail`, named for the
verdict rather than for the mailbox. An unexpected error still ends with a written
summary: the rows already written stay, the rest is named, and the run reports
`unexpected-error` instead of dying without a word.

### Notes on the lists inside

The disposable and free provider lists are short and hand checked, and they are in
`src/checks.py` where you can read them. A domain that is missing from them is a gap in
a list, not a wrong answer about the address, and the row still reports the DNS verdict.

# Actor input Schema

## `emails` (type: `array`):

The addresses to check. One row per address comes back, with a verdict or with the reason it could not be checked.

## `checkDns` (type: `boolean`):

Ask a public resolver for the MX record of each domain. Turn it off to get only the format verdict, which costs nothing.

## `maxEmails` (type: `integer`):

How many addresses one run checks. The rest come back as free status rows with the reason maxEmails.

## Actor input object example

```json
{
  "emails": [
    "someone@gmail.com",
    "info@ukr.net",
    "bad@@example.com",
    "test@mailinator.com"
  ],
  "checkDns": true,
  "maxEmails": 50
}
```

# Actor output Schema

## `dataset` (type: `string`):

A checked address carries email, normalised, localPart, domain, domainAscii, syntaxValid, domainExists, hasMx, mxHosts, acceptsMail, isDisposable, isRole, isFreeProvider, suggestion, status and a reserved note field (null on today's verdicts). A zone that answers SERVFAIL for the MX query is a temporary DNS failure, so that row is NOT_CHECKED_DNS_ERROR and free, never a verdict. There is no valid field: it would only repeat acceptsMail, which is the verdict itself. Rows with status INVALID_SYNTAX, SYNTAX_ONLY, DUPLICATE, NOT_CHECKED\_\* carry a reason and none of the DNS verdict fields (domainExists, hasMx, mxHosts, acceptsMail stay null), so a free row can never be read as a verdict. A SYNTAX_ONLY row is the one exception that keeps the local fields it really computed (normalised, localPart, domain, domainAscii, syntaxValid, isDisposable, isRole, isFreeProvider, suggestion), because checkDns was switched off rather than the format left unchecked. acceptsMail means the domain publishes a mail server, NOT that the mailbox exists: SMTP is never probed.

## `summary` (type: `string`):

Counters: emailsRequested, emailsAttempted, emailsChecked, emailsAcceptMail (the count of domains that accept mail), emailsInvalidSyntax, emailsNoDomain, emailsNoMailServer, emailsDnsError, emailsDuplicate, emailsLimited, emailsCutByBudget, emailsDelivered, emailsCapped, emailsSyntaxOnly, emailsUnverified, rowsWritten, byStatus, chargedEvents, deliveredUncharged, chargeUncertain, writeErrors, summaryWriteErrors, billingActive, priceEvent, priceNote, checkDns, maxEmails, counterMismatch, stopReason, datasetNote, startedAt, finishedAt. Status codes: OK, INVALID_SYNTAX, SYNTAX_ONLY, NO_SUCH_DOMAIN, NO_MAIL_SERVER, NOT_CHECKED_DNS_ERROR, DUPLICATE, NOT_CHECKED_LIMIT, NOT_CHECKED_TIME, NOT_CHECKED_CAP, NOT_CHECKED_BILLING. Stop reasons: dataset-write-error, billing-price-unknown, spending-cap, charge-error, deadline, unexpected-error. When the dataset counter cannot be read after a failed charge, datasetNote says that delivery and the charge are both unknown and those lines are counted in emailsUnverified and chargeUncertain: the summary never claims that nothing was delivered or nothing was charged.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "emails": [
        "someone@gmail.com",
        "info@ukr.net",
        "bad@@example.com",
        "test@mailinator.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("stas_k/email-validator-api").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "emails": [
        "someone@gmail.com",
        "info@ukr.net",
        "bad@@example.com",
        "test@mailinator.com",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("stas_k/email-validator-api").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "emails": [
    "someone@gmail.com",
    "info@ukr.net",
    "bad@@example.com",
    "test@mailinator.com"
  ]
}' |
apify call stas_k/email-validator-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,stas_k/email-validator-api"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/BlfMf7oY1O0dUmCK3/builds/S6ttfH3rjc4zTfX6s/openapi.json
