Validate Email Addresses
curl --request POST \
--url https://base.sanitizeemail.com/v1/api/email-validation/ \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"emails": [
"test@example.com",
"user@domain.com"
],
"file_id": 740,
"options": {
"validate_smtp": false,
"validate_syntax": true,
"check_dmarc": false,
"validate_mx": false
},
"file_tag": "validate"
}
'import requests
url = "https://base.sanitizeemail.com/v1/api/email-validation/"
payload = {
"emails": ["test@example.com", "user@domain.com"],
"file_id": 740,
"options": {
"validate_smtp": False,
"validate_syntax": True,
"check_dmarc": False,
"validate_mx": False
},
"file_tag": "validate"
}
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({
emails: ['test@example.com', 'user@domain.com'],
file_id: 740,
options: {
validate_smtp: false,
validate_syntax: true,
check_dmarc: false,
validate_mx: false
},
file_tag: 'validate'
})
};
fetch('https://base.sanitizeemail.com/v1/api/email-validation/', 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://base.sanitizeemail.com/v1/api/email-validation/",
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([
'emails' => [
'test@example.com',
'user@domain.com'
],
'file_id' => 740,
'options' => [
'validate_smtp' => false,
'validate_syntax' => true,
'check_dmarc' => false,
'validate_mx' => false
],
'file_tag' => 'validate'
]),
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://base.sanitizeemail.com/v1/api/email-validation/"
payload := strings.NewReader("{\n \"emails\": [\n \"test@example.com\",\n \"user@domain.com\"\n ],\n \"file_id\": 740,\n \"options\": {\n \"validate_smtp\": false,\n \"validate_syntax\": true,\n \"check_dmarc\": false,\n \"validate_mx\": false\n },\n \"file_tag\": \"validate\"\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://base.sanitizeemail.com/v1/api/email-validation/")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"emails\": [\n \"test@example.com\",\n \"user@domain.com\"\n ],\n \"file_id\": 740,\n \"options\": {\n \"validate_smtp\": false,\n \"validate_syntax\": true,\n \"check_dmarc\": false,\n \"validate_mx\": false\n },\n \"file_tag\": \"validate\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://base.sanitizeemail.com/v1/api/email-validation/")
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 \"emails\": [\n \"test@example.com\",\n \"user@domain.com\"\n ],\n \"file_id\": 740,\n \"options\": {\n \"validate_smtp\": false,\n \"validate_syntax\": true,\n \"check_dmarc\": false,\n \"validate_mx\": false\n },\n \"file_tag\": \"validate\"\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"email": "<string>",
"status": "valid",
"reason": {
"format": {
"status": "pass",
"reason": "<string>"
},
"dns": {
"status": "pass",
"reason": "<string>"
},
"mx": {
"status": "pass",
"reason": "<string>"
},
"smtp": {
"status": "pass",
"reason": "<string>"
},
"dmarc": {
"status": "pass",
"reason": "<string>"
}
},
"normalized_email": "<string>",
"is_disposable": true,
"is_role_account": true,
"mx_records": [
"<string>"
]
}
],
"stats": {
"total": 123,
"valid": 123,
"invalid": 123,
"disposable": 123,
"role_accounts": 123
},
"file_id": "<string>",
"credits_used": 123,
"remaining_processing": 123,
"batch_size": 123
}{
"error": 123,
"message": "<string>"
}{
"error": 123,
"message": "<string>"
}{
"error": "Invalid or inactive API key"
}{
"error": 123,
"message": "<string>"
}Validation endpoints
Validate Emails
Validate one or more email addresses for syntax, domain, deliverability, and SMTP checks
POST
/
v1
/
api
/
email-validation
/
Validate Email Addresses
curl --request POST \
--url https://base.sanitizeemail.com/v1/api/email-validation/ \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"emails": [
"test@example.com",
"user@domain.com"
],
"file_id": 740,
"options": {
"validate_smtp": false,
"validate_syntax": true,
"check_dmarc": false,
"validate_mx": false
},
"file_tag": "validate"
}
'import requests
url = "https://base.sanitizeemail.com/v1/api/email-validation/"
payload = {
"emails": ["test@example.com", "user@domain.com"],
"file_id": 740,
"options": {
"validate_smtp": False,
"validate_syntax": True,
"check_dmarc": False,
"validate_mx": False
},
"file_tag": "validate"
}
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({
emails: ['test@example.com', 'user@domain.com'],
file_id: 740,
options: {
validate_smtp: false,
validate_syntax: true,
check_dmarc: false,
validate_mx: false
},
file_tag: 'validate'
})
};
fetch('https://base.sanitizeemail.com/v1/api/email-validation/', 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://base.sanitizeemail.com/v1/api/email-validation/",
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([
'emails' => [
'test@example.com',
'user@domain.com'
],
'file_id' => 740,
'options' => [
'validate_smtp' => false,
'validate_syntax' => true,
'check_dmarc' => false,
'validate_mx' => false
],
'file_tag' => 'validate'
]),
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://base.sanitizeemail.com/v1/api/email-validation/"
payload := strings.NewReader("{\n \"emails\": [\n \"test@example.com\",\n \"user@domain.com\"\n ],\n \"file_id\": 740,\n \"options\": {\n \"validate_smtp\": false,\n \"validate_syntax\": true,\n \"check_dmarc\": false,\n \"validate_mx\": false\n },\n \"file_tag\": \"validate\"\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://base.sanitizeemail.com/v1/api/email-validation/")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"emails\": [\n \"test@example.com\",\n \"user@domain.com\"\n ],\n \"file_id\": 740,\n \"options\": {\n \"validate_smtp\": false,\n \"validate_syntax\": true,\n \"check_dmarc\": false,\n \"validate_mx\": false\n },\n \"file_tag\": \"validate\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://base.sanitizeemail.com/v1/api/email-validation/")
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 \"emails\": [\n \"test@example.com\",\n \"user@domain.com\"\n ],\n \"file_id\": 740,\n \"options\": {\n \"validate_smtp\": false,\n \"validate_syntax\": true,\n \"check_dmarc\": false,\n \"validate_mx\": false\n },\n \"file_tag\": \"validate\"\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"email": "<string>",
"status": "valid",
"reason": {
"format": {
"status": "pass",
"reason": "<string>"
},
"dns": {
"status": "pass",
"reason": "<string>"
},
"mx": {
"status": "pass",
"reason": "<string>"
},
"smtp": {
"status": "pass",
"reason": "<string>"
},
"dmarc": {
"status": "pass",
"reason": "<string>"
}
},
"normalized_email": "<string>",
"is_disposable": true,
"is_role_account": true,
"mx_records": [
"<string>"
]
}
],
"stats": {
"total": 123,
"valid": 123,
"invalid": 123,
"disposable": 123,
"role_accounts": 123
},
"file_id": "<string>",
"credits_used": 123,
"remaining_processing": 123,
"batch_size": 123
}{
"error": 123,
"message": "<string>"
}{
"error": 123,
"message": "<string>"
}{
"error": "Invalid or inactive API key"
}{
"error": 123,
"message": "<string>"
}This endpoint validates email addresses using two different methods: direct email validation or file-based validation. You can either provide individual email addresses or reference a previously uploaded file.
Validation Methods
- Direct Email Validation
- File-Based Validation
Validate individual email addresses by providing them directly in the request.
{
"emails": ["test@example.com", "user@domain.com"],
"options": {
"validate_smtp": true,
"validate_syntax": true,
"check_dmarc": true,
"validate_mx": true
}
}
Validate emails from a previously uploaded file using the file ID.
{
"file_id": 740,
"file_tag": "validate",
"options": {
"validate_smtp": true,
"validate_syntax": true,
"check_dmarc": true,
"validate_mx": true
}
}
How it Works
1
Choose Validation Method
Decide whether to validate individual emails directly or use a file-based
approach
2
For File-Based: Upload File First (Optional)
If using file-based validation, first upload your CSV or XLSX file using the
File Upload endpoint to obtain the
file_id3
Configure Validation Options
Set your desired validation options (syntax, DMARC, SMTP, MX records)
4
Submit Validation Request
Send either
emails array OR file_id (not both)5
Receive Results
Get validation results for the submitted emails
Request Parameters
Either/Or Requirement: You must provide either
emails OR file_id, but
not both in the same request.Direct Email Validation
- emails: Array of email addresses to validate
- options: Validation options object
File-Based Validation
- file_id: ID from a previously uploaded file
- file_tag: Tag for categorizing the validation type
- options: Validation options object
Validation Options
Configure which validation checks to perform:- validate_syntax: Checks email format and structure (default: true)
- validate_smtp: Performs SMTP server validation (default: false)
- check_dmarc: Validates DMARC policy records (default: false)
- validate_mx: Checks MX record existence (default: false)
Example Workflows
Direct Email Validation
POST /v1/api/email-validation/
{
"emails": ["john@example.com", "sarah@company.com"],
"options": {
"validate_syntax": true,
"validate_smtp": true,
"check_dmarc": false,
"validate_mx": true
}
}
File-Based Validation
// 1. First upload a file (if not already done)
POST /v1/api/filesupload/
// Response includes: { "id": 740, "file": "https://s3.../file.csv" }
// 2. Then validate the uploaded file
POST /v1/api/email-validation/
{
"file_id": 740,
"file_tag": "validate",
"options": {
"validate_smtp": true,
"validate_syntax": true,
"check_dmarc": true,
"validate_mx": true
}
}
Credits Consumption: Validation consumes credits based on the number of
emails and validation options selected. More comprehensive validation uses
more credits.
Bulk Processing: For validating large lists of emails, use the file-based
approach with the File Upload endpoint for better performance and easier
management.
Authorizations
API key for authentication
Body
application/json
Email validation request payload
Array of email addresses to validate (required for direct validation)
Example:
["test@example.com", "user@domain.com"]
ID of the uploaded file (obtained from file upload response) - required for file-based validation
Example:
740
Validation options
Show child attributes
Show child attributes
Tag for categorizing the file processing type (required when using file_id)
Available options:
clean, validate, analyze Example:
"validate"