Skip to Content
DNS API

DNS Lookup1 Credit

Query DNS records including A, AAAA, CNAME, MX, NS, TXT and more for comprehensive domain analysis.

GET
/v1/dns

The DNS API looks up any record type for a domain name or IP address, or ALL for the common ones. By default it asks the domain's authoritative nameservers itself, resolving from the root, so the answer comes from the source and not from a resolver's cache. Set server to ask a public resolver or any server you choose. Queries go over UDP, and an answer too large for UDP is asked again over TCP; transport=tcp asks everything over TCP. dnssec=true adds the DNSSEC records, and subdomains=true probes the full lists of well-known subdomains. verbose=true adds each query's response code, flags, sections and the trace of servers it asked.

Each call costs 1 credit. Results are cached for up to 10 minutes.

Authorization

See Authentication for details.

headerX-API-Key<token>

Provide your API key in an HTTP request header.

Query Parameters

name*string

The domain name to look up, or an IP address

Length1 <= length
verbose?boolean

Return extra detail: totalElapsed, retries and params, plus each errors entry's detail when the lookup fails. For DNS, also returns answers, one entry for each name and record type queried. Each has its response code, flags, authority and additional sections, and trace, the servers queried to reach the answer.

Defaultfalse
type?string

The type of DNS record to query, or ALL for all common record types.

Default"ALL"
Value in"ALL""REVERSE""SPF""SOA""NS""A""AAAA""CNAME""DNAME""MX""TXT""CAA""TLSA""DS""DNSKEY""RRSIG""NSEC""NSEC3""NSEC3PARAM""CDS""CDNSKEY""KEY""SIG""SRV""HTTPS""SVCB""CERT""HINFO""TSIG""OPENPGPKEY""RP""SSHFP""URI""NAPTR""LOC""PTR"
server?string

DNS server to use for queries, or authoritative for authoritative server queries.

recursive?boolean

Enable recursive resolution. Some public servers require or ignore this. Authoritative queries always have server-based recursion disabled as we do the resolution ourselves.

Defaulttrue
dnssec?boolean

Enable DNSSEC validation and return additional DNSSEC records. Some nameservers do not support this and will return errors.

Defaultfalse
subdomains?boolean

Probe the full lists of well-known subdomains (www, mail, _dmarc and many more) alongside the domain itself. By default only a handful of the most common names are probed, which is considerably faster. Applies to ALL, A, AAAA, CNAME and TXT queries for a base domain — other record types, and queries for a subdomain, are unaffected.

Defaultfalse
transport?string

The DNS transport protocol to use. UDP is faster, and an answer too large for it is asked again over TCP. TCP asks everything over TCP.

Default"udp"
Value in"udp""tcp"

Response Body

Successful dns response

application/json
  1. response
tool*string

Tool that generated this result

Value in"dns""domain""reverse""site""dnssec""ssl""email""redirect"
query*string

The original FQDN/qname that was queried

requestId*|

Unique request identifier that generated this result

timestamp*string

UTC timestamp when the result was generated

elapsed*|

Time taken to generate the result in milliseconds

cached*boolean

Whether this result was served from cache

totalElapsed?|

Returned with verbose. Total time in milliseconds, including retries and any lookups this one made. For a cached result, the time to read it

retries?number

Returned with verbose. Number of retries before the answer, 0 for a cached result

params?

Returned with verbose. The query parameters you set that differ from their defaults

results*array<||||||||||||||||||||||||||||||||>|

Every record found, each once, in canonical order (name, type, priority, content, TTL). Each record has its name, type, class and ttl, then the fields of its type under their RFC names in camelCase: preference and exchange for MX, strings for TXT, keyTag for DS.

queryType*string

The original query type

Value in"ALL""REVERSE""SPF""SOA""NS""A""AAAA""CNAME""DNAME""MX""TXT""CAA""TLSA""DS""DNSKEY""RRSIG""NSEC""NSEC3""NSEC3PARAM""CDS""CDNSKEY""KEY""SIG""SRV""HTTPS""SVCB""CERT""HINFO""TSIG""OPENPGPKEY""RP""SSHFP""URI""NAPTR""LOC""PTR"
server*string

The address of the server that gave most of the answers, and serverName its name.

serverName?string

The name of the server that provided the answers

serverType*string

The requested server type

Value in"custom""authoritative""public""privacy""safety""isp""root""reverse"
transport*string

The transport protocol used

Value in"udp""tcp"
recursive*boolean

Whether recursive resolution was requested

dnssec*boolean

Whether DNSSEC was requested

subdomains*boolean

Whether subdomains were probed

status?string

What the answers for the name and type asked amount to. For ALL: nxdomain if any says so, else ok if any has records, else alias, else nodata, else failed. A name that does not exist is a 200 with nxdomain, whatever the server type

Value in"ok""nxdomain""nodata""referral""alias""failed"
answers?array<>

With verbose=true: one entry for each name and record type asked, with its rcode, status, header flags, the three sections and the trace of every server asked from the root.

errors*array<>

Empty on a clean answer. On a 200, one entry for each question of the lookup that failed. On any other status, why the request failed. The HTTP status is in the response line only

Errors

See Errors for the response format.

invalid_request
A parameter is missing or not valid, or is not one this endpoint takes.
400
invalid_query
The name or record type cannot be asked.
400
blocked_address
The server resolves to a private or reserved address.
400
authentication_failed
No API key was sent, or it could not be checked.
401
invalid_api_key
The API key is not valid.
401
api_key_expired
The API key has expired.
401
out_of_credits
The account has no credits left.
402
forbidden
The caller may not use this tool.
403
server_not_found
No server can be found to ask.
422
rate_limited
The caller is over its rate limit; retry after the Retry-After header.
429
internal_error
An internal error on our side.
500
upstream_timeout
A DNS server did not answer in time.
503
upstream_unreachable
A DNS server could not be reached.
503
upstream_invalid
A DNS server sent an answer that cannot be used.
503
Example Request
curl -X GET 'https://api.dns.tools/v1/dns?name=google.com'
Example Response
{  "tool": "dns",  "query": "google.com",  "queryType": "ALL",  "server": "216.239.36.10",  "serverName": "ns3.google.com",  "serverType": "authoritative",  "transport": "udp",  "recursive": false,  "dnssec": false,  "subdomains": true,  "status": "ok",  "requestId": "43fdb9c6-f438-4b20-a2f5-84c319fbcc57",  "timestamp": "2026-11-26T00:26:37.608Z",  "elapsed": 235,  "cached": false,  "errors": [],  "results": [    {      "name": "google.com",      "type": "SOA",      "class": "IN",      "ttl": 60,      "mname": "ns1.google.com",      "rname": "dns-admin.google.com",      "serial": 1028908002,      "refresh": 900,      "retry": 900,      "expire": 1800,      "minimum": 60    },    {      "name": "google.com",      "type": "NS",      "class": "IN",      "ttl": 345600,      "target": "ns1.google.com"    },    {      "name": "google.com",      "type": "NS",      "class": "IN",      "ttl": 345600,      "target": "ns2.google.com"    },    {      "name": "google.com",      "type": "NS",      "class": "IN",      "ttl": 345600,      "target": "ns3.google.com"    },    {      "name": "google.com",      "type": "NS",      "class": "IN",      "ttl": 345600,      "target": "ns4.google.com"    },    {      "name": "google.com",      "type": "A",      "class": "IN",      "ttl": 300,      "address": "142.251.210.46"    },    {      "name": "google.com",      "type": "AAAA",      "class": "IN",      "ttl": 300,      "address": "2607:f8b0:4006:811::200e"    },    {      "name": "google.com",      "type": "MX",      "class": "IN",      "ttl": 300,      "preference": 10,      "exchange": "smtp.google.com"    },    {      "name": "google.com",      "type": "TXT",      "class": "IN",      "ttl": 300,      "strings": [        "_r4rd1pvwyrpi7sw4a3hzmw8e51yh9td"      ]    },    {      "name": "google.com",      "type": "TXT",      "class": "IN",      "ttl": 300,      "strings": [        "apple-domain-verification=30afIBcvSuDV2PLX"      ]    },    {      "name": "google.com",      "type": "TXT",      "class": "IN",      "ttl": 300,      "strings": [        "arcules-domain-verification=2R4t5G7nI6tRCo61lpxxbLksPYstxhGmtV75cpr8x9K"      ]    },    {      "name": "google.com",      "type": "TXT",      "class": "IN",      "ttl": 300,      "strings": [        "cisco-ci-domain-verification=47c38bc8c4b74b7233e9053220c1bbe76bcc1cd33c7acf7acd36cd6a5332004b"      ]    },    {      "name": "google.com",      "type": "TXT",      "class": "IN",      "ttl": 300,      "strings": [        "docusign=1b0a6754-49b1-4db5-8540-d2c12664b289"      ]    },    {      "name": "google.com",      "type": "TXT",      "class": "IN",      "ttl": 300,      "strings": [        "docusign=05958488-4752-4ef2-95eb-aa7ba8a3bd0e"      ]    },    {      "name": "google.com",      "type": "TXT",      "class": "IN",      "ttl": 300,      "strings": [        "facebook-domain-verification=22rm551cu4k0ab0bxsw536tlds4h95"      ]    },    {      "name": "google.com",      "type": "TXT",      "class": "IN",      "ttl": 300,      "strings": [        "globalsign-smime-dv=CDYX+XFHUw2wml6/Gb8+59BsH31KzUr6c1l2BPvqKX8="      ]    },    {      "name": "google.com",      "type": "TXT",      "class": "IN",      "ttl": 300,      "strings": [        "google-site-verification=4ibFUgB-wXLQ_S7vsXVomSTVamuOXBiVAzpR5IZ87D0"      ]    },    {      "name": "google.com",      "type": "TXT",      "class": "IN",      "ttl": 300,      "strings": [        "google-site-verification=TV9-DBe4R80X4v0M4U_bd_J9cpOJM0nikft0jAgjmsQ"      ]    },    {      "name": "google.com",      "type": "TXT",      "class": "IN",      "ttl": 300,      "strings": [        "google-site-verification=wD8N7i1JTNTkezJ49swvWW48f8_9xveREV4oB-0Hf5o"      ]    },    {      "name": "google.com",      "type": "TXT",      "class": "IN",      "ttl": 300,      "strings": [        "MS=E4A68B9AB2BB9670BCE15412F62916164C0B20BB"      ]    },    {      "name": "google.com",      "type": "TXT",      "class": "IN",      "ttl": 300,      "strings": [        "onetrust-domain-verification=0d477fe608074e6f9c12bca7826035cc"      ]    },    {      "name": "google.com",      "type": "TXT",      "class": "IN",      "ttl": 300,      "strings": [        "onetrust-domain-verification=6d685f1d41a94696ad7ef771f68993e0"      ]    },    {      "name": "google.com",      "type": "TXT",      "class": "IN",      "ttl": 300,      "strings": [        "v=spf1 include:_spf.google.com ~all"      ]    },    {      "name": "google.com",      "type": "TXT",      "class": "IN",      "ttl": 300,      "strings": [        "work-accounts-domain-verification=Tcj6JjIMZOw2KsSEw2Nt2rLae89tN6"      ]    },    {      "name": "google.com",      "type": "TXT",      "class": "IN",      "ttl": 300,      "strings": [        "Z29vZ2xl"      ]    }  ]}