Overview
The /verify endpoint validates an email address format and checks if the domain can receive emails. Use this to clean your lists or validate user input before sending.
Endpoint
POST /v1/verify
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
email | string | Yes | The email address to verify |
Example Request
curl -X POST https://api.mailsh.it/v1/verify \
-H "Authorization: Bearer your_api_key" \
-H "Content-Type: application/json" \
-d '{
"email": "alice@example.com"
}'
Response
Success (200)
{
"email": "alice@example.com",
"verification": {
"valid": true,
"format": true,
"domain": true,
"mxRecords": true,
"disposable": false,
"role": false
}
}
Verification Fields
| Field | Type | Description |
|---|---|---|
valid | boolean | Overall validity (true if all checks pass) |
format | boolean | Email format is valid |
domain | boolean | Domain exists |
mxRecords | boolean | Domain has MX records |
disposable | boolean | Whether the domain is a known disposable email provider |
role | boolean | Whether it’s a role-based address (e.g., info@, support@) |
Invalid Format (400)
{
"error": "Invalid email format"
}
Missing Email (400)
{
"error": "email is required"
}
Verification Checks
Format Check
Validates that the email matches a valid email pattern:
- Contains exactly one
@symbol - Has a valid local part (before @)
- Has a valid domain part (after @)
Domain Check
Verifies the domain exists and is reachable.
MX Records Check
Confirms the domain has mail exchange (MX) records configured, indicating it can receive email.
Disposable Check
Detects temporary/disposable email services like:
- Mailinator
- Guerrilla Mail
- 10 Minute Mail
- And many others
Role-Based Check
Identifies role-based addresses that typically shouldn’t receive marketing emails:
info@support@admin@webmaster@
Code Examples
JavaScript
async function verifyEmail(email: string) {
const response = await fetch('https://api.mailsh.it/v1/verify', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.MAILSHIT_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ email }),
})
const result = await response.json()
if (result.verification?.valid) {
console.log('Email is valid')
} else {
console.log('Email is invalid or risky')
}
return result
}
Python
def verify_email(email: str):
response = requests.post(
'https://api.mailsh.it/v1/verify',
headers={
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json',
},
json={'email': email},
)
result = response.json()
verification = result.get('verification', {})
if verification.get('valid'):
print('Email is valid')
else:
print('Email is invalid or risky')
return result
Use Cases
- Form Validation - Verify emails at signup before sending welcome emails
- List Cleaning - Validate your email list before a campaign
- Import Validation - Check emails when importing contacts
- Pre-Send Check - Verify before each transactional send
Rate Limits
Email verification counts against your API rate limit. For bulk verification, consider:
- Batch requests with delays
- Caching verification results
- Using verification in your flow instead of separate API calls