Skip to main content

DNS Lookup API

free
GET/v1/dns/lookup

Performs comprehensive DNS lookups via DNS-over-HTTPS (RFC 8484) using Cloudflare's global anycast infrastructure. Returns structured JSON with TTL, priority values, and DNSSEC validation status across 22 record types — no output parsing required. Use type=ALL to query all record types in a single call.

What It Does

Queries DNS records via DNS-over-HTTPS (RFC 8484) across 22 record types: A, AAAA, CNAME, MX, NS, TXT, SOA, SRV, CAA, PTR, DNSKEY, DS, TLSA, NAPTR, SSHFP, HTTPS, SVCB, DNAME, LOC, URI, CERT, and SMIMEA. HTTPS and SVCB records (RFC 9460) are parsed into structured SvcParams — `alpn`, `port`, `ipv4hint`, `ipv6hint`, and `ech` — so callers can confirm HTTP/3 readiness and Encrypted Client Hello key publication in a single lookup. Follows CNAME chains automatically per RFC 1034 §3.6.2 (up to 8 hops with loop detection) and returns the full chain so apex-CNAMEs through CDNs resolve to their final addresses. Use type=ALL to fan out across all 22 types in parallel; the response includes a per-type DNSSEC authenticated flag rather than collapsing to a single value.

Why It's Useful

Returns structured JSON instead of dig's text output — no parsing, no flag-juggling, no missing fields. The HTTPS/SVCB support (RFC 9460) means a single request can answer "is this site reachable over HTTP/3?" or "has the operator published an ECH key?" — questions that previously required multiple `dig` invocations and manual presentation-form parsing. CNAME-chain following surfaces the actual destination behind apex aliases. Per-type DNSSEC authentication on type=ALL means audit pipelines see exactly which record types are signed, not a misleading aggregate.

Use Cases

Email Marketing Team

Email Deliverability Pre-Check

Before sending campaigns, verify that recipient domains have properly configured MX records pointing to active mail servers and are not configured with Null MX (RFC 7505).

Detect recipient domains with missing mail routes or explicit email rejection before attempting delivery.

DevOps Engineer

Domain Migration Monitoring

During domain migrations, continuously query multiple record types to verify changes propagated correctly.

Catch misconfigurations before they impact users, reducing migration-related downtime.

Security Engineer

Security Configuration Audit

Automated scanning of TLSA (DANE), DNSKEY, DS, and CAA records across organization domains to verify DNSSEC chains, certificate pinning, and CA authorization policies.

Maintain security policy compliance across hundreds of domains with automated checks covering the full DNS security stack.

Parameters

NameLocationTypeRequiredDescription
domainquerystringRequiredThe domain name to query (e.g., example.com)Example: example.com
typequerystringOptionalDNS record type to query. Use ALL to query all 22 types at once. Defaults to A if not specified.Example: AOptions: ALL, A, AAAA, CAA, CERT, CNAME, DNAME, DNSKEY, DS, HTTPS, LOC, MX, NAPTR, NS, PTR, SMIMEA, SOA, SRV, SSHFP, SVCB, TLSA, TXT, URI

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
record_typestringThe DNS record type queried (single type, or "ALL")
recordsarrayArray of DNS records with type, value, TTL, priority, weight (SRV), and port (SRV). HTTPS/SVCB records also include a parsed `svcb` object with priority, target, alpn[], port, ipv4hint[], ipv6hint[], has_ech, ech, no_default_alpn, raw_params (RFC 9460).
authenticatedbooleanDNSSEC AD bit for single-type queries; always false on type=ALL — see authenticated_by_type instead
authenticated_by_typeobjectOn type=ALL only: per-record-type AD bit (e.g., { A: true, MX: false }) so audits see exactly which types are DNSSEC-authenticated
cname_chainarrayCNAME hops followed (lowercased, FQDN-trimmed), present only when the queried name aliases via CNAME — e.g., ["www.example.com.cdn.cloudflare.net", "1234.cloudfrontnet"] (max 8 hops, loop-detected per RFC 1034 §3.6.2)
resolverstringThe DNS resolver used for the query
duration_msnumberTime taken for DNS query in milliseconds
record_countnumberNumber of records returned.

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/lookup?domain=example.com' \
  --header "Authorization: Bearer YOUR_API_KEY"
JavaScript
const response = await fetch(
  "https://api.edgedns.dev/v1/dns/lookup?domain=example.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/lookup?domain=example.com",
    headers={'Authorization': 'Bearer YOUR_API_KEY'},
    timeout=60,
)
response.raise_for_status()
data = response.json()
print(data)

Read the full DNS Lookup guide

Learn the concepts, choose a practical workflow, and interpret the observations from DNS Lookup 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 DNS Lookup endpoint live in the playground.

DNS Lookup API Reference | EdgeDNS