Email Validation
curl --request POST \
--url https://api.enrichley.io/api/v1/validate-single-email \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"email": "jane.doe@example.com"
}
'import requests
url = "https://api.enrichley.io/api/v1/validate-single-email"
payload = { "email": "jane.doe@example.com" }
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({email: 'jane.doe@example.com'})
};
fetch('https://api.enrichley.io/api/v1/validate-single-email', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.enrichley.io/api/v1/validate-single-email",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => 'jane.doe@example.com'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.enrichley.io/api/v1/validate-single-email"
payload := strings.NewReader("{\n \"email\": \"jane.doe@example.com\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.enrichley.io/api/v1/validate-single-email")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"jane.doe@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.enrichley.io/api/v1/validate-single-email")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"jane.doe@example.com\"\n}"
response = http.request(request)
puts response.read_body{
"email": "jane.doe@example.com",
"valid": true,
"result": "catch_all_validated",
"mx_domain": "example.com",
"email_type": "business",
"mx_provider": "google",
"credits_consumed": true,
"mx_secure_email_gateway": false
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Email Validation
Email Validation
Validate a single email address with the Enrichley API.
POST
/
validate-single-email
Email Validation
curl --request POST \
--url https://api.enrichley.io/api/v1/validate-single-email \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"email": "jane.doe@example.com"
}
'import requests
url = "https://api.enrichley.io/api/v1/validate-single-email"
payload = { "email": "jane.doe@example.com" }
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({email: 'jane.doe@example.com'})
};
fetch('https://api.enrichley.io/api/v1/validate-single-email', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.enrichley.io/api/v1/validate-single-email",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => 'jane.doe@example.com'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.enrichley.io/api/v1/validate-single-email"
payload := strings.NewReader("{\n \"email\": \"jane.doe@example.com\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.enrichley.io/api/v1/validate-single-email")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"jane.doe@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.enrichley.io/api/v1/validate-single-email")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"jane.doe@example.com\"\n}"
response = http.request(request)
puts response.read_body{
"email": "jane.doe@example.com",
"valid": true,
"result": "catch_all_validated",
"mx_domain": "example.com",
"email_type": "business",
"mx_provider": "google",
"credits_consumed": true,
"mx_secure_email_gateway": false
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Validates one email address and returns the result in the response. There is no job or polling.
A
- Method:
POST - Path:
/validate-single-email - Auth:
X-Api-Keyheader - Cost: 1 credit per completed validation. See What you are charged for.
Request
{ "email": "jane.doe@example.com" }
Response
Every successful request (HTTP200) returns the same eight fields:
{
"email": "jane.doe@example.com",
"valid": true,
"result": "catch_all_validated",
"mx_domain": "example.com",
"mx_provider": "google",
"mx_secure_email_gateway": false,
"email_type": "business",
"credits_consumed": true
}
| Field | Meaning |
|---|---|
email | The address you sent, lowercased. |
valid | true only when result is ok or catch_all_validated. Only send to these. |
result | The outcome. See the table below. |
mx_domain | The domain that receives mail for the address. Can be null. |
mx_provider | The mail provider, such as google or microsoft. Can be null. |
mx_secure_email_gateway | true when mail passes through a secure email gateway first. |
email_type | business, personal or unknown. |
credits_consumed | Whether this request used a credit. See below. |
Result values
result | Meaning | valid | Charged? |
|---|---|---|---|
ok | The mailbox accepts mail. | true | Yes |
catch_all_validated | The domain accepts every address, and we confirmed this mailbox exists. | true | Yes |
catch_all | The domain accepts every address, and we couldn’t confirm this mailbox. | false | Yes |
invalid | The address won’t accept mail. | false | Yes |
unknown | The check finished, but the mail server gave no clear answer. | false | Yes |
timeout | The check didn’t finish in time. | false | No |
error | Something failed on our side. It says nothing about the address. | false | No |
error_invalid_syntax | The value isn’t an email address (no @). | false | No |
What you are charged for
- A completed validation costs 1 credit, whatever the result:
ok,catch_all_validated,catch_all,invalidorunknown. timeoutanderrorare free. The credit is returned before the response is sent, andcredits_consumedisfalse.- Input without an
@is free. It returnserror_invalid_syntaxand still counts toward your rate limit. - Rejected requests are free. A request rejected with a
4xxor500error (see Errors) never runs a validation or uses a credit. - Each request is charged on its own. Sending the same address again runs and charges a new validation. Retrying a free
timeoutorerrorcosts nothing until a retry completes. credits_consumedreports what happened to this request. If it’strueon atimeoutorerror, we couldn’t confirm the refund. Contact support with theX-Request-Id.
Client timeout
Set your HTTP client timeout to at least 90 seconds; most answers return much faster. If your client gives up before we answer, a completed validation is still charged and you never see its result.Response headers
| Header | When | Meaning |
|---|---|---|
X-Request-Id | Every response from the validation service | Quote it to support to identify the request. |
X-Credits-Remaining | Every 200 | Your balance after this request, including any refund. |
X-RateLimit-Limit | When the key was checked | Requests allowed in the current window. Read your limit from this header. |
X-RateLimit-Remaining | When the key was checked | Requests left in the current window. |
X-RateLimit-Reset | When the key was checked | When the window resets, as a Unix timestamp in milliseconds. |
Retry-After | 429 responses | Seconds to wait before retrying. |
Errors
Errors return a JSON body of the form{"error": "<message>"}.
| Status | error message | What to do |
|---|---|---|
401 | Unauthorized - Missing API key | Send the X-Api-Key header. |
401 | API key unauthorized | Check the key value. |
401 | API key expired | Get your current key from your profile. |
403 | API key forbidden or not found | Check the key value. It may have been regenerated. |
403 | API key disabled | Contact support. |
403 | Insufficient permissions | Contact support. |
429 | API key rate limited | You are sending too fast. Wait Retry-After seconds, then retry. |
429 | API key usage exceeded | You are out of credits. Retrying keeps failing until you add credits. |
500 | Internal Server Error - API Key verification failed | Temporary. Retry with backoff. |
400 | Invalid API key response | Rare. Retry, and contact support with the X-Request-Id if it repeats. |
502 or 504 comes from our gateway, not the validation service, so it has no X-Request-Id. Retry it. If you think you were charged, contact support with the time of the request.Response
Validation result. Every 200 returns all eight fields.
The outcome.
Possible values:
ok— the mailbox accepts mail. Valid. Charged.catch_all_validated— the domain accepts every address, and we confirmed this mailbox exists. Valid. Charged.catch_all— the domain accepts every address, and we couldn't confirm this mailbox. Not valid. Charged.invalid— the address won't accept mail. Not valid. Charged.unknown— the check finished, but the mail server gave no clear answer. Not valid. Charged.timeout— the check didn't finish in time. Not valid. Free.error— something failed on our side; it says nothing about the address. Not valid. Free.error_invalid_syntax— the value isn't an email address (no@). Not valid. Free.
Available options:
ok, catch_all_validated, catch_all, invalid, unknown, timeout, error, error_invalid_syntax 
