Skip to main content

MX Records API

free
GET/v1/dns/mx

Retrieves MX (Mail Exchange) records for a domain and identifies the email service provider. Returns mail server hostnames, priority values, and provider detection for Google Workspace, Microsoft 365, Proofpoint, Mimecast, Barracuda, Amazon SES, ProtonMail, Zoho, Fastmail, iCloud Mail, and more.

What It Does

Queries MX records, identifies the email provider and security gateways, and surfaces three classes of misconfiguration as `sanity_flags`: MX hostnames that resolve via CNAME (a violation of RFC 5321 §5.1 that breaks delivery on strict resolvers), MX hostnames that resolve to private/reserved IPs (mail will never reach them), and lame mail delegation (MX with no A or AAAA at all). Detects Null MX (RFC 7505) — the explicit "this domain does not accept mail" signal. Enriches each MX IP with its ASN and country code via Team Cymru, surfaces unique-ASN and unique-country counts for diversity assessment, and returns a `linked_endpoints` hint for callers who want full SPF/DMARC/MX-Health analysis.

Why It's Useful

The sanity flags catch the three failure modes responsible for most "why isn't email arriving?" tickets — RFC 5321 forbids MX→CNAME, RFC 1918 IPs in MX records mean mail never leaves, and lame MX is invisible to plain `dig`. ASN + country enrichment gives M&A due diligence and fraud teams a clear "your MX moved to AS in another country" anomaly signal without writing the lookup themselves. Provider detection identifies the security gateways (Proofpoint, Mimecast, Barracuda) and downstream providers in the mail path so callers understand the defense stack.

Use Cases

Email Administrator

Email Deliverability Troubleshooting

Emails to a specific domain are bouncing. Check if MX records exist and are properly configured.

Quickly diagnose email delivery issues by verifying mail server configuration.

Security Analyst

Email Security Posture Assessment

Map an organization's email security stack by identifying security gateways (Proofpoint, Mimecast, Barracuda), cloud email providers, and backup mail servers from MX records.

Understand email infrastructure defenses without active scanning — identify gaps in the security gateway chain.

IT Consultant

Migration Planning

Document current email infrastructure before migrating clients to a new email platform.

Ensure smooth email migrations by understanding existing mail routing.

Parameters

NameLocationTypeRequiredDescription
domainquerystringRequiredThe domain to query MX records forExample: google.com

Response Fields

Result fields below are inside the JSON data object. Any row named meta describes the sibling response metadata object. See response and error handling for status codes and error responses. Optional observations may be absent or null; inspect warnings and partial-failure fields before treating a missing result as a negative finding.

FieldTypeDescription
domainstringThe queried domain
has_mxbooleanWhether domain has MX records configured
is_null_mxbooleanWhether domain uses Null MX (RFC 7505) to reject email
mx_recordsarrayPer-MX detail: priority, host, ttl, ips[], asns[] (each {asn, country}), points_to_cname (RFC 5321 §5.1 violation), has_private_ip, has_no_address (lame)
providerobjectDetected email provider name, type, features, confidence, and backup_provider (backend provider behind security gateways)
unique_asnsnumberDistinct ASNs across all MX IPs — useful for redundancy assessment
unique_countriesnumberDistinct ISO country codes across all MX IPs
sanity_flagsarrayDetected misconfigurations with severity and code: mx_points_to_cname (RFC 5321 §5.1), mx_private_ip, mx_lame
linked_endpointsarraySuggested follow-up endpoints (/v1/security/spf, /v1/security/dmarc, /v1/dns/mx-health) for full email-stack analysis
record_countnumberNumber of MX records found

Code Examples

Replace YOUR_API_KEY with your API key. This endpoint requires the free plan or higher; see plans and usage limits.

cURL
curl --request GET 'https://api.edgedns.dev/v1/dns/mx?domain=google.com' \
  --header "Authorization: Bearer YOUR_API_KEY"
JavaScript
const response = await fetch(
  "https://api.edgedns.dev/v1/dns/mx?domain=google.com",
  {
    "method": "GET",
    "headers": {
      "Authorization": "Bearer YOUR_API_KEY"
    }
  }
);

if (!response.ok) {
  throw new Error(`EdgeDNS returned HTTP ${response.status}`);
}
const data = await response.json();
console.log(data);
Python
import requests

response = requests.request(
    'GET',
    "https://api.edgedns.dev/v1/dns/mx?domain=google.com",
    headers={'Authorization': 'Bearer YOUR_API_KEY'},
    timeout=60,
)
response.raise_for_status()
data = response.json()
print(data)

Read the full MX Records guide

Learn the concepts, choose a practical workflow, and interpret the observations from MX Records before acting on them. Run supported checks via MCP or through REST.

Read the guide →

    Related Endpoints

    External References

    Learn more about the standards and protocols behind this endpoint.

    Try This Endpoint

    Test the MX Records endpoint live in the playground.

    MX Records API Reference | EdgeDNS