πŸ“š CleanMail API Documentation

Complete guide to integrating CleanMail's email verification API into your application.

πŸ” Authentication

All API requests require authentication using your API key via the X-API-Key header.

curl -X POST https://cleanmail.dev/api/verify \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key_here" \
  -d '{"email": "user@example.com"}'
πŸ’‘ Finding your API Key: Sign in to your dashboard at cleanmail.dev/app.html to view your API key.

βœ… Verify Email

Verify an email address to check if it's valid, deliverable, and not a spam trap or disposable.

POST /api/verify

Request Body

email required string - Email address to verify
webhookUrl string - Optional URL for async results

Example Request

{
  "email": "user@example.com",
  "webhookUrl": "https://yourapp.com/webhooks/cleanmail"
}

Example Response

{
  "email": "user@example.com",
  "valid": true,
  "reason": "deliverable",
  "risk": "low",
  "isDisposable": false,
  "isRoleAccount": false,
  "isFreeProvider": false,

  "isSpamTrap": false,
  "isGreylisted": false,
  "mxFound": true,
  "delivery": "deliverable",
  "requestId": "req_abc123"
}

Response Fields

valid boolean - Overall validity
reason string - Reason for validity status
risk string - "low", "medium", or "high"
isGreylisted boolean - Email was greylisted (timed out during verification)
mxFound boolean - MX record exists
delivery string - "deliverable", "undeliverable", or "risky"

πŸ”” Webhooks

Receive real-time notifications when email verifications complete.

Why Use Webhooks?

Webhooks enable asynchronous processing. Submit verification requests and receive results at your callback URL when processing completesβ€”perfect for high-volume applications.

How It Works

1. Submit verification with your webhook URL:
POST /api/verify
{
  "email": "user@example.com",
  "webhookUrl": "https://yourapp.com/webhooks/cleanmail"
}

2. Receive result at your webhook:
POST https://yourapp.com/webhooks/cleanmail
{
  "requestId": "req_abc123",
  "email": "user@example.com",
  "valid": true,
  "reason": "deliverable",
  ...
}

Webhook Payload

{
  "requestId": "req_abc123",
  "email": "user@example.com",
  "valid": true,
  "reason": "deliverable",
  "risk": "low",
  "isDisposable": false,
  "isRoleAccount": false,
  "isFreeProvider": false,

  "isSpamTrap": false,
  "isGreylisted": false,
  "mxFound": true,
  "delivery": "deliverable",
  "verifiedAt": "2026-04-20T12:00:00Z"
}
πŸ’‘ Best Practice: Respond to webhooks with 200 OK immediately, then process asynchronously to avoid timeouts.

πŸ“‹ Batch Verification

Process up to 5,000 email addresses at once with batch verification. Upload a CSV, monitor progress, and receive results via email.

Batch vs Single Verification

Use batch when you have a list of emails to verify. Single API calls are for real-time verification. Batch processing is more efficient for large lists and includes premium fields like DMARC, SPF, and domain age.

Upload Batch

POST /api/batch/upload

Upload a CSV file with email addresses. Maximum 5,000 emails per upload.

curl -X POST https://cleanmail.dev/api/batch/upload \
  -H "X-API-Key: your_api_key" \
  -F "file=@emails.csv"

CSV Format

Create a CSV with a single column of email addresses, one per line:

user@example.com
john.doe@company.com
sales@business.org

Check Batch Status

GET /api/batch/status/:jobId
curl https://cleanmail.dev/api/batch/status/your-job-id \
  -H "X-API-Key: your_api_key"

Response:

{
  "success": true,
  "jobId": "abc123",
  "status": "processing",
  "total": 500,
  "processed": 234,
  "valid": 45,
  "invalid": 189,
  "queued": 0
}

Get Batch History

GET /api/batch/history

Returns your recent batch jobs (last 20).

Download Results

GET /api/batch/download/:jobId
curl "https://cleanmail.dev/api/batch/download/abc123?key=your_api_key"

Cancel Batch Job

POST /api/batch/cancel/:jobId
curl -X POST https://cleanmail.dev/api/batch/cancel/abc123 \
  -H "X-API-Key: your_api_key"

Batch Results CSV

When complete, download the CSV with these columns:

ColumnDescription
emailThe email address
deliverabletrue/false - mailbox exists
reasonWhy valid or invalid
risk_levellow/medium/high
is_spamtrapSpam trap detected
is_disposableDisposable email domain
is_role_accountRole account (info@, support@)
is_free_providerGmail, Yahoo, Outlook, etc.
is_catchallCatch-all domain
has_dmarcDMARC record present
dmarc_policynone/quarantine/reject
has_spfSPF record present
spf_strictStrict SPF enforcement
domain_age_daysAge of domain in days
mx_recordMX server hostname
risk_score0-100 risk score
πŸ’‘ Tip: Use the Batch Upload Page for a visual interface to upload CSV files and monitor processing in real-time.

πŸ§ͺ Demo Endpoint

Try CleanMail without an API key! The demo endpoint is rate-limited but lets you test the service.

POST /api/demo/verify
curl -X POST https://cleanmail.dev/api/demo/verify \
  -H "Content-Type: application/json" \
  -d '{"email": "test@example.com"}'
⚠️ Limits: Demo endpoint is limited to 10 requests per minute. For production use, sign up for an API key.

❌ Error Codes

400 Bad Request - Missing or invalid email
401 Unauthorized - Invalid or missing API key
429 Rate Limited - Daily quota exceeded
500 Server Error - Try again later

πŸ“¦ Plans & Limits

Free
$0
  • 100 verifications/day
  • Email support
  • Basic API access
Starter
$9/mo
  • 500 verifications/day
  • Webhooks
  • Priority support
Pro
$39/mo
  • 2,000 verifications/day
  • Webhooks
  • API access
Business
$99/mo
  • 5,000 verifications/day
  • Webhooks
  • Dedicated support

View full pricing details β†’

πŸ’» Code Examples

JavaScript / Node.js

const response = await fetch('https://cleanmail.dev/api/verify', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'your_api_key'
  },
  body: JSON.stringify({
    email: 'user@example.com',
    webhookUrl: 'https://yourapp.com/webhooks/cleanmail'
  })
});

const result = await response.json();
console.log(result);
// { valid: true, reason: 'deliverable', ... }

Python

import requests

response = requests.post(
    'https://cleanmail.dev/api/verify',
    headers={'X-API-Key': 'your_api_key'},
    json={'email': 'user@example.com'}
)

result = response.json()
print(result)

cURL

curl -X POST https://cleanmail.dev/api/verify \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key" \
  -d '{"email": "user@example.com"}'

PHP

$ch = curl_init('https://cleanmail.dev/api/verify');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'X-API-Key: your_api_key'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
    'email' => 'user@example.com'
]));
$response = curl_exec($ch);
$result = json_decode($response, true);

πŸ“ž Need Help?

Contact us at CleanMail.service@gmail.com for technical support or sales inquiries.

Check our FAQ β†’