# Check Email Addresses With an API

*Originally published at [scrapingrabbit.com](https://scrapingrabbit.com/blog/email-verification-api-tutorial). I built ScrapingRabbit.*


Bad email addresses cost you twice: bounced mail hurts your sender reputation, and fake sign-ups pollute your numbers. A quick check at the point of sign-up catches the obvious ones. This guide shows how to check one address with a single GET request, and it is clear about what the check can and cannot prove.

## Check an address

Send one address per call. Every call needs an API key. New accounts get 100 free credits and a first key is created automatically on sign-up (it is shown once on the dashboard). Sign in at [scrapingrabbit.com/login](https://scrapingrabbit.com/login), then send the key in the `x-api-key` header (a Bearer token also works). The code below reads it from the `SCRAPINGRABBIT_API_KEY` environment variable, so no key is ever written into your code.

```bash
curl -H "x-api-key: $SCRAPINGRABBIT_API_KEY" "https://api.scrapingrabbit.com/v1/email/verify?email=hello@scrapingrabbit.com"
```

A successful call costs 1 credit, as the OpenAPI file lists it. In our three test calls the check took between 0.16 and 0.82 seconds.

A shortened real answer, read on 3 December 2026:

```json
{
  "success": true,
  "data": {
    "email": "hello@scrapingrabbit.com",
    "isValid": true,
    "validSyntax": true,
    "hasMxRecords": true,
    "isDisposable": false,
    "isRoleAccount": true,
    "isFreeProvider": false,
    "reachability": "unknown",
    "domain": "scrapingrabbit.com",
    "mxRecords": [
      "route1.mx.cloudflare.net.",
      "route3.mx.cloudflare.net.",
      "route2.mx.cloudflare.net."
    ]
  }
}
```

The address belongs to the team that wrote this guide. It is valid, it is a role account, and its mail is handled by the servers listed in `mxRecords`. The answer also has a few fields we left out: `normalizedEmail`, a Gravatar flag and some provider details.

Here is the answer for a domain that cannot receive mail, `jane.doe@gmial.com`, a common typo of a well-known provider:

```json
{
  "success": true,
  "data": {
    "email": "jane.doe@gmial.com",
    "isValid": false,
    "validSyntax": true,
    "hasMxRecords": false,
    "reachability": "unknown"
  }
}
```

The format is fine, but the domain has no mail servers, so `isValid` is false. The check did not suggest a corrected spelling in our test, so do not count on a typo hint.

## What the fields mean

| Field | Meaning |
| --- | --- |
| `isValid` | The overall verdict: the format is right and the domain can receive mail |
| `validSyntax` | Whether the address is written correctly |
| `hasMxRecords` | Whether the domain publishes mail servers |
| `mxRecords` | The mail servers, when there are any |
| `isDisposable` | Whether the domain is a throwaway inbox service |
| `isRoleAccount` | Whether it is a team address such as hello@ or info@ |
| `isFreeProvider` | Whether the domain is a free provider such as a webmail service |
| `reachability` | `unknown` when the mailbox itself was not checked |

## Read it in code

```javascript
async function checkEmail(email) {
  const url = `https://api.scrapingrabbit.com/v1/email/verify?email=${encodeURIComponent(email)}`;
  const res = await fetch(url, { headers: { "x-api-key": process.env.SCRAPINGRABBIT_API_KEY } });
  const body = await res.json();
  if (!body.success) return { ok: true, reason: "check unavailable" };

  const r = body.data;
  if (!r.validSyntax) return { ok: false, reason: "not a valid address" };
  if (r.isDisposable) return { ok: false, reason: "disposable inbox" };
  if (!r.isValid) return { ok: false, reason: "domain cannot receive mail" };
  return { ok: true, reason: r.isRoleAccount ? "role account" : "looks fine" };
}

console.log(await checkEmail("hello@scrapingrabbit.com"));
```

The code decides in a fixed order: bad format first, then disposable, then the overall verdict. It returns `ok: true` when the check itself fails, so an outage on our side never blocks a real person from signing up. Whether role accounts are allowed is up to you, so the code only labels them.

The same in Python:

```python
import os
import requests

res = requests.get(
    "https://api.scrapingrabbit.com/v1/email/verify",
    params={"email": "hello@scrapingrabbit.com"},
    headers={"x-api-key": os.environ["SCRAPINGRABBIT_API_KEY"]},
    timeout=30,
)
body = res.json()
if body["success"]:
    data = body["data"]
    print(data["isValid"], data["isDisposable"], data["isRoleAccount"])
```

## Things to plan for

- **It does not prove an inbox exists.** It checks the format and the domain's mail setup. `reachability` stayed `unknown` in our tests.
- **Catch-all domains accept everything.** A valid result there is not a guarantee.
- **For disposable domains, rely on `isDisposable` and `isValid`.** In our test of a well-known disposable service, the mail-server fields came back empty even though a lookup shows that domain does have mail servers. Do not use `hasMxRecords` alone to judge those.
- **Never block sign-up on a failed check.** If the call fails, let the person through and check again later.
- **One address per call.** Cache results for addresses you have already checked.
- **Rate limits and credits.** Each key is limited per minute: 10 requests on the free plan, 60 on Starter, 120 on Pro and 300 on Scale. Every successful call costs credits.
- **Always check `success`.** A failed request returns `success: false`, a `code` such as `RATE_LIMITED` or `INVALID_API_KEY`, and a `message`. Failed calls are not charged.

## Try it without code

The free email verifier works in the browser with no key and shows these fields for any address you type.
