DNS Lookup API
Query comprehensive DNS records for any domain using our REST API. Get A, AAAA, MX, TXT, NS, CAA, SRV, DNSKEY and more.
Last updated Nov 29, 2024
The DNS Lookup API allows you to query comprehensive DNS records for any domain. It returns all common record types including A, AAAA, MX, TXT, NS, CAA, SRV, DNSKEY, and more.
Endpoint
GET https://api.requestguard.com/v1/dns/lookup
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
domain | string | Yes | The domain name to query (e.g., example.com) |
Response
The API returns a JSON object with the following structure:
{
"success": true,
"data": {
"domain": "example.com",
"queryTimeMs": 145,
"dnssec": true,
"dnsProvider": "Cloudflare",
"records": [
{
"type": "A",
"name": "example.com.",
"value": "93.184.216.34",
"ttl": 86400,
"geo": {
"country": "US",
"asn": 15133,
"asnName": "Edgecast Inc."
}
}
],
"queriedAt": "2024-11-29T12:00:00.000Z"
}
}
Response Fields
Root Object
| Field | Type | Description |
|---|---|---|
success | boolean | Whether the request was successful |
data | object | The DNS query result |
Data Object
| Field | Type | Description |
|---|---|---|
domain | string | The queried domain name (normalized) |
queryTimeMs | number | Total query time in milliseconds |
dnssec | boolean | Whether DNSSEC is enabled for the domain |
dnsProvider | string | null | Detected DNS provider (e.g., Cloudflare, AWS Route 53) |
records | array | Array of DNS records |
queriedAt | string | ISO 8601 timestamp of when the query was made |
Record Object
| Field | Type | Description |
|---|---|---|
type | string | DNS record type (A, AAAA, MX, TXT, etc.) |
name | string | Record name (usually ends with a dot) |
value | string | Record value |
ttl | number | Time-to-live in seconds |
geo | object | undefined | Geolocation data for A/AAAA records |
Geo Object (for A/AAAA records)
| Field | Type | Description |
|---|---|---|
ip | string | The IP address |
country | string | Two-letter country code |
asn | number | Autonomous System Number |
asnName | string | ASN organization name |
Supported Record Types
The API queries the following DNS record types:
Address Records
- A - IPv4 address mapping
- AAAA - IPv6 address mapping
Mail Records
- MX - Mail exchange servers
Name Records
- NS - Authoritative nameservers
- CNAME - Canonical name aliases
- SOA - Start of authority
- PTR - Reverse DNS pointer
Text & Verification
- TXT - Text records (SPF, DKIM, DMARC, etc.)
Service Discovery
- SRV - Service location records
- HTTPS - HTTPS service binding
- SVCB - Service binding
- NAPTR - Naming authority pointer
Security & Certificates
- CAA - Certificate authority authorization
- TLSA - DANE TLS authentication
- SSHFP - SSH fingerprints
- DNSKEY - DNSSEC public keys
- DS - Delegation signer
Other
- LOC - Geographic location
Example Request
curl "https://api.requestguard.com/v1/dns/lookup?domain=cloudflare.com"
Example Response
{
"success": true,
"data": {
"domain": "cloudflare.com",
"queryTimeMs": 234,
"dnssec": true,
"dnsProvider": "Cloudflare",
"records": [
{
"type": "A",
"name": "cloudflare.com.",
"value": "104.16.132.229",
"ttl": 300,
"geo": {
"ip": "104.16.132.229",
"country": "US",
"asn": 13335,
"asnName": "CLOUDFLARENET"
}
},
{
"type": "AAAA",
"name": "cloudflare.com.",
"value": "2606:4700::6810:84e5",
"ttl": 300
},
{
"type": "MX",
"name": "cloudflare.com.",
"value": "10 mailstream-central.mxrecord.io.",
"ttl": 300
},
{
"type": "NS",
"name": "cloudflare.com.",
"value": "ns1.cloudflare.com.",
"ttl": 86400
},
{
"type": "TXT",
"name": "cloudflare.com.",
"value": "\"v=spf1 ip4:199.15.212.0/22 ip4:173.245.48.0/20 include:_spf.google.com ~all\"",
"ttl": 300
},
{
"type": "CAA",
"name": "cloudflare.com.",
"value": "0 issue \"digicert.com\"",
"ttl": 300
}
],
"queriedAt": "2024-11-29T12:00:00.000Z"
}
}
Error Responses
Invalid Domain
{
"success": false,
"error": {
"code": "INVALID_DOMAIN",
"message": "Invalid domain format"
}
}
Domain Not Found
{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "No DNS records found for this domain"
}
}
Rate Limits
| Plan | Requests per minute |
|---|---|
| Free | 10 |
| Pro | 100 |
| Enterprise | Unlimited |
DNS Provider Detection
The API automatically detects the DNS provider based on NS records. Supported providers include:
- Cloudflare
- AWS Route 53
- Google Cloud DNS
- Azure DNS
- GoDaddy
- Namecheap
- DigitalOcean
- DNSimple
- NS1
- Dyn
- UltraDNS
- Akamai
- Verisign
- Hetzner
- OVH
- Gandi
DNSSEC Validation
The API checks for DNSSEC by examining the AD (Authenticated Data) flag in the DNS response. If DNSSEC is enabled and the chain of trust is valid, dnssec will be true.
IP Geolocation
For A and AAAA records, the API includes geolocation data obtained via Team Cymru’s DNS-based IP-to-ASN service. This includes:
- Country code (ISO 3166-1 alpha-2)
- Autonomous System Number (ASN)
- ASN organization name
Try It Out
Use our interactive DNS Lookup Tool to query DNS records directly in your browser.