Clean Email List
curl --request POST \
--url https://base.sanitizeemail.com/v1/api/cleanemail/ \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"file_id": 739,
"list_name": "Customer List - Cleaned",
"options": {
"validate_syntax": true,
"check_dmarc": true,
"validate_smtp": true,
"validate_mx": true
}
}
'import requests
url = "https://base.sanitizeemail.com/v1/api/cleanemail/"
payload = {
"file_id": 739,
"list_name": "Customer List - Cleaned",
"options": {
"validate_syntax": True,
"check_dmarc": True,
"validate_smtp": True,
"validate_mx": True
}
}
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({
file_id: 739,
list_name: 'Customer List - Cleaned',
options: {
validate_syntax: true,
check_dmarc: true,
validate_smtp: true,
validate_mx: true
}
})
};
fetch('https://base.sanitizeemail.com/v1/api/cleanemail/', 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/cleanemail/",
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([
'file_id' => 739,
'list_name' => 'Customer List - Cleaned',
'options' => [
'validate_syntax' => true,
'check_dmarc' => true,
'validate_smtp' => true,
'validate_mx' => true
]
]),
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/cleanemail/"
payload := strings.NewReader("{\n \"file_id\": 739,\n \"list_name\": \"Customer List - Cleaned\",\n \"options\": {\n \"validate_syntax\": true,\n \"check_dmarc\": true,\n \"validate_smtp\": true,\n \"validate_mx\": true\n }\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/cleanemail/")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"file_id\": 739,\n \"list_name\": \"Customer List - Cleaned\",\n \"options\": {\n \"validate_syntax\": true,\n \"check_dmarc\": true,\n \"validate_smtp\": true,\n \"validate_mx\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://base.sanitizeemail.com/v1/api/cleanemail/")
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 \"file_id\": 739,\n \"list_name\": \"Customer List - Cleaned\",\n \"options\": {\n \"validate_syntax\": true,\n \"check_dmarc\": true,\n \"validate_smtp\": true,\n \"validate_mx\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"job_id": "<string>",
"status": "queued",
"list_name": "<string>",
"file_id": 123,
"estimated_completion_time": "2023-11-07T05:31:56Z",
"options_applied": {
"validate_syntax": true,
"check_dmarc": true,
"validate_smtp": true,
"validate_mx": true
},
"total_emails": 123,
"credits_required": 123
}{
"error": 123,
"message": "<string>"
}{
"error": 123,
"message": "<string>"
}{
"error": 123,
"message": "<string>"
}{
"error": 123,
"message": "<string>"
}Validation endpoints
Clean Email List
Process and clean an uploaded email list file with comprehensive validation options
POST
/
v1
/
api
/
cleanemail
/
Clean Email List
curl --request POST \
--url https://base.sanitizeemail.com/v1/api/cleanemail/ \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"file_id": 739,
"list_name": "Customer List - Cleaned",
"options": {
"validate_syntax": true,
"check_dmarc": true,
"validate_smtp": true,
"validate_mx": true
}
}
'import requests
url = "https://base.sanitizeemail.com/v1/api/cleanemail/"
payload = {
"file_id": 739,
"list_name": "Customer List - Cleaned",
"options": {
"validate_syntax": True,
"check_dmarc": True,
"validate_smtp": True,
"validate_mx": True
}
}
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({
file_id: 739,
list_name: 'Customer List - Cleaned',
options: {
validate_syntax: true,
check_dmarc: true,
validate_smtp: true,
validate_mx: true
}
})
};
fetch('https://base.sanitizeemail.com/v1/api/cleanemail/', 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/cleanemail/",
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([
'file_id' => 739,
'list_name' => 'Customer List - Cleaned',
'options' => [
'validate_syntax' => true,
'check_dmarc' => true,
'validate_smtp' => true,
'validate_mx' => true
]
]),
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/cleanemail/"
payload := strings.NewReader("{\n \"file_id\": 739,\n \"list_name\": \"Customer List - Cleaned\",\n \"options\": {\n \"validate_syntax\": true,\n \"check_dmarc\": true,\n \"validate_smtp\": true,\n \"validate_mx\": true\n }\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/cleanemail/")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"file_id\": 739,\n \"list_name\": \"Customer List - Cleaned\",\n \"options\": {\n \"validate_syntax\": true,\n \"check_dmarc\": true,\n \"validate_smtp\": true,\n \"validate_mx\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://base.sanitizeemail.com/v1/api/cleanemail/")
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 \"file_id\": 739,\n \"list_name\": \"Customer List - Cleaned\",\n \"options\": {\n \"validate_syntax\": true,\n \"check_dmarc\": true,\n \"validate_smtp\": true,\n \"validate_mx\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"job_id": "<string>",
"status": "queued",
"list_name": "<string>",
"file_id": 123,
"estimated_completion_time": "2023-11-07T05:31:56Z",
"options_applied": {
"validate_syntax": true,
"check_dmarc": true,
"validate_smtp": true,
"validate_mx": true
},
"total_emails": 123,
"credits_required": 123
}{
"error": 123,
"message": "<string>"
}{
"error": 123,
"message": "<string>"
}{
"error": 123,
"message": "<string>"
}{
"error": 123,
"message": "<string>"
}This endpoint processes and cleans an uploaded email list file with comprehensive validation options. It requires a previously uploaded file from the File Upload endpoint.
How it Works
1
Upload File First
Use the File Upload endpoint to
upload your CSV or XLSX file and obtain the
file_id and file URL2
Configure Cleaning Options
Set your desired validation options (syntax, DMARC, SMTP, MX records)
3
Submit Cleaning Job
Send the cleaning request with the file reference and options
4
Monitor Progress
Use the returned
job_id to track the cleaning progressPrerequisites
File Upload Required: You must first upload a file using the
/v1/api/filesupload/ endpoint to obtain the required file_id and file
URL parameters.Validation Options
The cleaning process supports multiple validation levels:- validate_syntax: Checks email format and structure
- check_dmarc: Validates DMARC policy records
- validate_smtp: Performs SMTP server validation
- validate_mx: Checks MX record existence
Comprehensive Cleaning: Enable all validation options for the most
thorough email list cleaning, though this will consume more credits and take
longer to process.
Example Workflow
// 1. First upload a file
POST /v1/api/filesupload/
// Response includes: { "id": 739, "file": "https://s3.../file.csv" }
// 2. Then clean the uploaded file
POST /v1/api/cleanemail/
{
"file_id": 739,
"file": "https://s3.us-east-1.amazonaws.com/sanitizeemail/email_validation_files/Book_Sheet1_e5FL41X.csv",
"user": 100,
"list_name": "Customer List - Cleaned",
"options": {
"validate_syntax": true,
"check_dmarc": true,
"validate_smtp": true,
"validate_mx": true
}
}
Credits Consumption: The cleaning process consumes credits based on the
number of emails and validation options selected. More comprehensive
validation uses more credits.
Authorizations
API key for authentication
Body
application/json
Email list cleaning request payload
Response
Email cleaning job initiated successfully
Unique identifier for the cleaning job
Current status of the cleaning job
Available options:
queued, processing, completed, failed Name of the email list being cleaned
ID of the source file
Estimated completion time for the cleaning job
Validation options that will be applied
Show child attributes
Show child attributes
Total number of emails to be processed
Number of credits required for this cleaning job