DNS Lookup API

DNS Lookup API: Get A, MX, TXT & More Records in JSON — Free Plan Available

Retrieve A, AAAA, MX, TXT, CNAME, NS, SOA, CAA, DMARC, BIMI, MTA-STS, and TLSRPT for any domain through a single API call. All record types in one JSON response, authenticated with the same token as all WhoisJSON services.

All record types
< 200ms response
1,000 free requests/month
Live Demo

Try the DNS Lookup API

Enter any domain to retrieve its full DNS record set in real time.

Record Types

Every DNS Record Type in One Call

A single request to our NSLookup endpoint returns all available record types for the queried domain. No need for separate calls per record type.

A / AAAA

Address Records

IPv4 and IPv6 addresses that a domain resolves to. The foundation of web hosting and service routing.

MX

Mail Exchange

Mail server routing with priority values. Each entry includes an exchange hostname and a priority integer.

TXT

Text Records

SPF policies, DKIM public keys, domain ownership verification tokens, and other free-form key-value data.

CNAME

Canonical Names

Domain aliases pointing to another hostname. Used for CDNs, subdomains, and service delegation. A dangling CNAME is a subdomain takeover vector.

NS

Nameservers

Authoritative DNS servers for a zone. Essential for NS change detection and DNS infrastructure analysis.

SOA

Start of Authority

Zone metadata: primary nameserver, hostmaster email, serial number, and refresh/retry/expire timers.

CAA

CA Authorisation

Restricts which certificate authorities may issue SSL certs for the domain. Each record includes flags, tag (issue, issuewild, iodef), and value.

Email Security Records — included in the same response

Most DNS APIs omit these types or expose them via separate endpoints. WhoisJSON returns all four automatically alongside standard records.

Use Cases

What Developers Build with DNS Data

Email Configuration Verification

Validate MX records, SPF and DKIM TXT records, and DMARC policies programmatically. Ensure email deliverability before sending campaigns or onboarding new domains.

DNS APIMX + TXT

Security Monitoring & Threat Detection

Detect unauthorized DNS changes, identify DNS hijacking, and monitor nameserver modifications. Pair with our Domain Monitoring for continuous tracking and alerts.

DNS APIMonitoring

DevOps & DNS Propagation Checks

Verify DNS propagation after deploying changes. Automate checks in your CI/CD pipeline to confirm that A records, CNAME aliases, and TXT verifications are live. Combine with SSL validation for full deployment verification.

DNS APISSL API

Domain Research & Competitive Intelligence

Analyze hosting infrastructure, CDN usage, and email providers of any domain. Cross-reference DNS data with WHOIS registration details and availability status for complete domain intelligence.

DNS APIWHOIS API
Integration

One Endpoint, All Record Types

A single GET request returns every DNS record available for a domain. Same API key and authentication as all WhoisJSON endpoints.

GET
/api/v1/nslookup?domain=example.com

Authentication: Authorization: TOKEN=YOUR_API_KEY

Response: JSON (default) or XML with format=xml

Full API Reference
Sample response (truncated)
{
  "A":    ["142.250.185.14"],
  "AAAA": ["2a00:1450:4007:80e::200e"],
  "MX": [
    { "exchange": "smtp.google.com", "priority": 10 }
  ],
  "NS":  ["ns1.google.com", "ns2.google.com"],
  "TXT": [
    "v=spf1 include:_spf.google.com ~all",
    "google-site-verification=..."
  ],
  "CAA": [
    { "flags": 0, "tag": "issue", "value": "pki.goog" }
  ],
  "SOA": {
    "nsname":     "ns1.google.com",
    "hostmaster": "dns-admin.google.com",
    "serial":     123456789,
    "refresh":    900,
    "retry":      900,
    "expire":     1800,
    "minttl":     60
  },
  "DMARC":  ["v=DMARC1; p=reject; rua=mailto:[email protected]"],
  "BIMI":   [],
  "MTASTS": ["v=STSv1; id=20250101000000Z"],
  "TLSRPT": ["v=TLSRPTv1; rua=mailto:[email protected]"]
}

What Is a DNS Lookup API?

A DNS lookup API allows developers to query the Domain Name System programmatically. Instead of running command-line tools likenslookup ordig, you send an HTTP request and receive structured data in return. WhoisJSON's NSLookup API resolves all record types — A, AAAA, MX, TXT, CNAME, NS, SOA, CAA, DMARC, BIMI, MTA-STS, and TLSRPT — in a single call, returning clean JSON that's ready for parsing, storage, and analysis. Average response time is under 200 milliseconds.

Part of the WhoisJSON Unified Platform

The DNS Lookup API is one of six endpoints available with every WhoisJSON account. The same API token also gives you access to WHOIS domain registration data, SSL certificate validation, real-time domain availability checks, subdomain discovery, and automated domain monitoring with alerts. No extra sign-ups, no extra keys — one token, six tools. Whether you are building an email verification system, a security scanner, or a domain management dashboard, all the data you need is accessible through a single, consistent API.

From Prototyping to Production

Every new account includes 1,000 free requests per month shared across all endpoints — enough for prototyping and small applications. Our paid plans scale to unlimited requests at up to 300 req/min with a 99.9% uptime SLA. Responses are cached for 3 hours by default; add force=1 to any request to bypass the cache. For common questions, check our FAQ or browse the full API documentation.

Free to start: 1,000 requests/month, no credit card required. One API key for DNS lookups and all other domain tools. Get your free API key →
FAQ

Frequently Asked Questions about the DNS Lookup API

A single API call returns all available record types at once: A, AAAA, CAA, CNAME, MX, NS, SOA, TXT, DMARC, BIMI, MTA-STS, and TLS-RPT. There is no need to specify individual types — the full DNS profile of the domain is returned in one request.

Yes. The API automatically includes DMARC, BIMI, MTA-STS, and TLS-RPT records alongside standard DNS types. This makes it straightforward to audit a domain's full email security configuration — SPF (via TXT), DKIM, DMARC, and BIMI — in a single call.

DNS lookups complete in under 200ms on average. Results are cached briefly for high-volume queries. Add _forceRefresh=1 to bypass the cache and get live DNS resolution — useful when checking propagation after a record change.

When no records exist for a given type, the corresponding field is absent from the response or returns an empty array. Only record types with actual DNS data are included, keeping responses lightweight.

The WHOIS API returns domain registration data (owner, registrar, expiry dates). The DNS Lookup API resolves live DNS records showing where services are actually hosted. Both use the same API token and are often combined for complete domain intelligence.

Start Resolving DNS Records Today

Create your free account and query DNS data for any domain in seconds.