Email Verification API: Build Resilient Systems with MailValid
Your email verification API call times out at 2 AM. Without retry logic and circuit breakers, that single failure can cascade into dropped user registrations, failed checkout flows, and lost revenue.
You need an email verification API that's both affordable and production-ready. Here's how to build resilient systems using MailValid's documented API while implementing standard reliability patterns.
The Problem: When Cheap Isn't Resilient (And Expensive Isn't Either)
Most teams pick an email verification service based on price per verification or feature lists. They miss the critical engineering question: What happens when the API fails?
DNS timeouts, SMTP handshake failures, and network partitions happen. When your verification pipeline breaks, you face the "fail vs. stall" dilemma: - Fail open: Let unverified emails through, risking deliverability - Fail closed: Block registrations, killing your conversion rate
Neither option alone is acceptable for revenue-critical systems — you need resilience patterns, not just a choice between the two.
The Solution: MailValid + Production-Grade Resilience Patterns
Start with a free account (100 credits, no card required) and implement these patterns against MailValid's real, documented API. If you haven't wired up the basics yet, start with our end-to-end verification API setup guide.
1. Exponential Backoff with Jitter
Don't hammer a struggling API. Implement progressive delays:
import time
import random
import requests
def verify_with_retry(email, api_key, max_retries=3):
for attempt in range(max_retries):
try:
response = requests.post(
"https://mailvalid.io/api/v1/verify/single",
headers={"X-API-Key": api_key, "Content-Type": "application/json"},
json={"email": email},
timeout=10
)
if response.status_code == 200:
return response.json()["result"]
elif response.status_code >= 500:
sleep_time = (2 ** attempt) + random.uniform(0, 1)
time.sleep(sleep_time)
continue
else:
return response.json()
except requests.exceptions.Timeout:
if attempt == max_retries - 1:
raise
time.sleep((2 ** attempt) + random.uniform(0, 1))
return {"status": "unknown", "error": "max_retries_exceeded"}
result = verify_with_retry("user@example.com", "your-api-key")
2. Circuit Breaker Pattern
Prevent cascade failures by "opening" the circuit when error rates spike:
const axios = require('axios');
class MailValidCircuitBreaker {
constructor(threshold = 5, timeout = 60000) {
this.failureCount = 0;
this.threshold = threshold;
this.timeout = timeout;
this.state = 'CLOSED'; // CLOSED, OPEN, HALF_OPEN
this.nextAttempt = Date.now();
}
async verify(email, apiKey) {
if (this.state === 'OPEN') {
if (Date.now() < this.nextAttempt) {
throw new Error('Circuit breaker is OPEN - using fallback validation');
}
this.state = 'HALF_OPEN';
}
try {
const response = await axios.post(
'https://mailvalid.io/api/v1/verify/single',
{ email },
{
headers: { 'X-API-Key': apiKey, 'Content-Type': 'application/json' },
timeout: 5000
}
);
this.onSuccess();
return response.data.result;
} catch (error) {
this.onFailure();
throw error;
}
}
onSuccess() {
this.failureCount = 0;
this.state = 'CLOSED';
}
onFailure() {
this.failureCount += 1;
if (this.failureCount >= this.threshold) {
this.state = 'OPEN';
this.nextAttempt = Date.now() + this.timeout;
console.warn('Circuit OPENED - verification API experiencing issues');
}
}
}
const breaker = new MailValidCircuitBreaker();
3. Graceful Degradation via cURL Retries
curl -X POST https://mailvalid.io/api/v1/verify/single \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"email":"user@example.com"}' \
--retry 3 \
--retry-delay 2 \
--retry-max-time 30
# Documented response includes: status, is_valid, is_disposable, is_role_based, confidence_score
Start with 100 free credits at MailValid
MailValid Pricing
| Plan | Monthly Price | Credits | Per-Email Cost |
|---|---|---|---|
| Free | $0 | 100 (one-time) | — |
| Pay as you go | One-time packs from $8 | 2,000 – 1,000,000 | $0.004 → ~$0.0009 |
| Plus | $29/mo | 10,000 | $0.0029 |
| Plus | $79/mo | 50,000 | $0.00158 |
| Plus | $129/mo | 100,000 | $0.00129 |
| Enterprise | Custom | 250,000+/mo | Custom |
Lower per-email cost with redundant verification (verifying at signup and at send-time) becomes more affordable the higher your plan tier.
Implementing Dead Letter Queues for Failed Verifications
Even with circuit breakers, some verifications fail. Don't lose them:
def verify_email_with_dlq(email, api_key):
try:
result = verify_with_retry(email, api_key)
if result.get("status") == "valid":
return result
except Exception as e:
# Push to dead letter queue (Redis, SQS, RabbitMQ)
dlq.push({
"email": email,
"timestamp": datetime.now(),
"error": str(e),
})
# Return an unverified marker as fallback
return {"status": "unknown", "syntax_valid": True}
return result
Process your DLQ during off-peak hours using MailValid's bulk verification endpoint (POST /api/v1/verify/bulk, up to 10,000 emails per request) rather than looping single calls. The same patterns apply to MCP-based email verification for AI agents; if you write your own TypeScript MCP server, put the breaker inside each tool handler.
Monitoring Your Email Verification API Health
Track these metrics to know when to trigger circuit breakers:
- Response time: MailValid's documented average is under 500ms; sustained spikes indicate upstream issues
- Error rate: 5xx responses should trigger alerts
- Credit usage: each verification uses 1 credit, and only
unknownresults are free, which affects how you budget for retries
When to Choose Which Resilience Pattern
| Scenario | Pattern | Implementation Cost |
|---|---|---|
| Occasional timeouts | Simple Retry | Low |
| High-volume bursts | Exponential Backoff + Jitter | Medium |
| Third-party outages | Circuit Breaker | Medium |
| Revenue-critical flows | Circuit + DLQ + Fallback | High |
Conclusion: Resilience Without Bankruptcy
Building resilient email verification isn't just about code patterns — it's about cost structure too. Every retry, every circuit breaker test, and every dead letter queue reprocessing has a real cost, so a lower per-email rate gives you more room to implement proper defensive programming without watching your API bill explode.
Get started with 100 free credits and build the verification system your users deserve.
Last Updated - 8 October 2026
MailValid Team
Email verification experts
Join teams that verify before they send
Stop letting bad emails hurt your deliverability
100 free credits. From $0.0008/email after. Credits never expire. No credit card required.