Email Validation API Tutorial
The Apixies Email Inspector API checks an email address for format, MX records, disposable providers, and role-based addresses in a single call. You send an email, you get back a structured JSON result. No regex guessing, no DNS library setup.
What You Get Back
| Field | What it tells you |
|---|---|
format_valid |
Whether the email follows RFC format rules |
domain_resolvable |
Whether the domain has DNS records (A or MX) |
mx_records_found |
Whether the domain has mail servers configured |
mailbox_exists |
Best-effort check if the mailbox accepts mail |
is_disposable |
Whether the domain is a known throwaway service |
is_role_based |
Whether the local part is generic (info@, admin@, support@) |
suggestion |
Typo correction if the domain looks like a known provider |
Quick Example
curl -H "X-API-Key: YOUR_API_KEY" \
"https://apixies.io/api/v1/inspect-email?email=hello@gmail.com"
Response:
{
"status": "success",
"http_code": 200,
"code": "SUCCESS",
"message": "Email inspection successful",
"data": {
"email": "hello@gmail.com",
"format_valid": true,
"domain_resolvable": true,
"mx_records_found": true,
"mailbox_exists": true,
"is_disposable": false,
"is_role_based": false,
"suggestion": null
}
}
Everything checks out. The email has valid format, Gmail's MX records exist, it's not disposable, and it's not a role-based address.
Authentication
Pass your API key in the X-API-Key header. Anonymous requests work at 20/day, and a free account gives you 75/day.
Step-by-Step: Validate an Email
Step 1: Basic Validation
The simplest call takes just an email parameter:
curl -H "X-API-Key: YOUR_API_KEY" \
"https://apixies.io/api/v1/inspect-email?email=hello@gmail.com"
Check format_valid first. If that's false, nothing else matters.
Step 2: Catch Disposable Emails
Disposable email services like Mailinator and Guerrilla Mail are popular for avoiding spam. They're also popular for avoiding your sign-up flow. Check with a throwaway domain:
curl -H "X-API-Key: YOUR_API_KEY" \
"https://apixies.io/api/v1/inspect-email?email=test@mailinator.com"
You'll see "is_disposable": true. Use this to block throwaway addresses at registration.
Step 3: Detect Typos
If someone types hello@gmial.com, the API suggests the correction:
curl -H "X-API-Key: YOUR_API_KEY" \
"https://apixies.io/api/v1/inspect-email?email=hello@gmial.com"
The suggestion field will contain hello@gmail.com. Show it to the user: "Did you mean hello@gmail.com?"
Code Examples
JavaScript
const response = await fetch(
"https://apixies.io/api/v1/inspect-email?email=hello@gmail.com",
{ headers: { "X-API-Key": "YOUR_API_KEY" } }
);
const { data } = await response.json();
if (!data.format_valid) {
console.warn("Invalid email format");
} else if (data.is_disposable) {
console.warn("Disposable email detected");
} else if (data.suggestion) {
console.warn(`Did you mean ${data.suggestion}?`);
}
Python
import requests
response = requests.get("https://apixies.io/api/v1/inspect-email",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"email": "hello@gmail.com"},
)
data = response.json()["data"]
print(f"Valid: {data['format_valid']}, Disposable: {data['is_disposable']}")
PHP
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://apixies.io/api/v1/inspect-email?email=hello@gmail.com");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"X-API-Key: YOUR_API_KEY",
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true)["data"];
if ($data["is_disposable"]) {
echo "Disposable email detected\n";
}
Common Use Cases
- Registration forms: Block disposable emails and show typo suggestions on your sign-up page. Reduces fake accounts significantly.
- Contact forms: Quick format check before accepting submissions. Saves you from processing garbage.
- Email list cleaning: Validate a list of addresses before sending campaigns. See the list cleaning guide for a complete walkthrough.
- Lead qualification: Role-based addresses (info@, sales@) often have lower engagement. Flag them separately.
Next Steps
- Email List Cleaning with API -- validate entire lists programmatically
- Email Validator tool -- try it in the browser
- Email Inspector docs -- full API reference
- Email Auth Validator -- check SPF, DKIM, and DMARC records
- All guides