MX Lookup API
Priority sorted
SPF parsing
Batch: 50

Where does mail go?MX records, SPF, and SMTP reachability.

Look up mail exchange records sorted by priority, optionally resolve MX host IPs, parse SPF policies, and test SMTP port 25 connectivity — via GET or POST, single or batch.

mxRecords · priorityresolveIps · A/AAAAincludeSpf · TXT parsevalidateSmtp · port 25

Why MX Lookup API

Email routing intel, structured.

Priority-Sorted MX
Mail exchange records returned in priority order so routing logic matches real-world mail flow.
IP Resolution
Optional resolveIps flag resolves A/AAAA addresses for each MX host (default true).
SPF Parsing
includeSpf extracts SPF TXT records with include mechanisms and the all policy suffix.
SMTP Connectivity
validateSmtp checks TCP port 25 reachability on MX hosts without sending email.
Batch up to 50
Query multiple domains via comma-separated GET or domains array in POST body.
GET or POST
Same lookup logic on both methods — choose query strings for quick tests or JSON for pipelines.

/api/v1/mx-lookup

Endpoints, at a glance.

GET for quick queries, POST for structured batch jobs. Per-domain DNS failures stay in the data array.

GET/mx-lookup
MX lookup (query)
Pass `domains` as a single domain or comma-separated list. Optional resolveIps, validateSmtp, and includeSpf query flags.
GET
POST/mx-lookup
MX lookup (JSON)
JSON body with `domains` string or array (≤50). Same optional flags as GET — recommended for batch pipelines.
PRIMARY
GET/mx-lookup/health
Service health
Service status and uptime.
ParameterTypeDefaultDescription
domainsstring | arrayRequired. Single domain, comma-separated (GET), or array (POST). Max 50.
resolveIpsbooleantrueResolve A/AAAA for each MX exchange host.
validateSmtpbooleanfalseTCP port 25 connectivity check per MX host.
includeSpfbooleanfalseParse SPF record from TXT when present.

Requests & responses.

Quick GET with SPF enabled, or POST a batch with full control over enrichment flags.

GET with SPF
Single domain, MX + SPF + IP resolution.
GET https://datpaq.com/api/v1/mx-lookup?domains=gmail.com&includeSpf=true&resolveIps=true
POST batch
Multiple domains with optional flags in JSON body.
POST https://datpaq.com/api/v1/mx-lookup
Content-Type: application/json

{
  "domains": ["gmail.com", "protonmail.com"],
  "resolveIps": true,
  "validateSmtp": false,
  "includeSpf": true
}
Health
https://datpaq.com/api/v1/mx-lookup/health
Metrics
https://datpaq.com/api/v1/mx-lookup/metrics

Error reference

Predictable errors, always structured.

Batch MX lookups continue when one domain fails DNS — check data[].error for per-domain issues.

400Missing Domains
Required domains parameter not provided in query string or JSON body.
400Batch Size Exceeded
More than 50 domains in a single request. Split into smaller batches.
401Unauthorized
API key missing or invalid. Pass as x-api-key header or api_key query parameter.
429Rate Limited
Too many requests. Retry after the indicated period.
200*Per-Domain DNS Failure
Individual domain DNS failures return in data[].error without failing the top-level response.
Example per-domain error in batch
{
  "domain": "nonexistentdomainthatdoesnotexist12345.com",
  "mxRecords": [],
  "error": "DNS lookup failed"
}

FAQ

API questions developers ask first.

Does validateSmtp send an email?

No. validateSmtp performs a TCP connectivity check on port 25 only — it does not send mail or run full SMTP conversation validation.

What does includeSpf return?

When enabled, the API parses SPF records from TXT records and returns the raw record, include mechanisms, and the all mechanism (e.g. ~all).

How do I authenticate with this API?

Create an API key in your Datpaq dashboard and send it with each request as a bearer token in the Authorization header.

Is there a free tier?

Yes. Datpaq APIs include a free tier for building, testing, and small production workloads before you move to a paid plan.

What format do requests and responses use?

Datpaq APIs use REST over HTTPS and return JSON by default. Endpoint docs show the supported methods, query parameters, request bodies, and response fields.

Where can I see limits and errors?

Each API documents rate limits, validation rules, and error responses in the landing page and API docs so integrations can retry and fail cleanly.

Email routing intel, on demand.

MX records, SPF policies, and SMTP reachability in one API — built for deliverability troubleshooting and email verification flows.