DNS Lookup API

Query A, AAAA, MX, TXT, NS, CNAME, SOA, CAA, SRV and more for any domain, or reverse-lookup an IP (PTR), via DNS over HTTPS. Clean JSON output.

GEThttps://apibox.io.vn/v1/dns
Network & Validation▶ Try it online

The DNS Lookup API resolves the records of a domain and returns them as tidy JSON. By default it queries A, AAAA, MX, TXT, NS and CNAME in parallel; choose your own set with type (comma separated) from A, AAAA, CNAME, MX, TXT, NS, SOA, PTR, SRV, NAPTR, DS, DNSKEY, HTTPS and CAA.

Records are normalised for you: MX records come as {priority, exchange}, TXT strings are unquoted and joined, trailing dots are removed, and every record carries its TTL. The overall response status is the DNS RCODE (NOERROR, NXDOMAIN, SERVFAIL…), so you can tell a missing record from a domain that does not exist. You can pass a bare domain or a URL – the scheme and path are stripped.

For reverse DNS, pass an IP address as domain with type=PTR: the API builds the in-addr.arpa / ip6.arpa name. Queries go through Cloudflare’s 1.1.1.1 DNS over HTTPS resolver and are cached for 5 minutes.

Parameters

NameInTypeRequiredDefault
domainquerystringyesDomain name or URL (or an IP for type=PTR).
typequerystringnoA,AAAA,MX,TXT,NS,CNAMEComma-separated record types: A, AAAA, CNAME, MX, TXT, NS, SOA, PTR, SRV, NAPTR, DS, DNSKEY, HTTPS, CAA.

Example

curl "https://apibox.io.vn/v1/dns?domain=github.com&type=A,MX" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

{
  "domain": "github.com",
  "status": "NOERROR",
  "records": {
    "A": [
      {
        "value": "20.205.243.166",
        "ttl": 23
      }
    ],
    "MX": [
      {
        "priority": 0,
        "exchange": "github-com.mail.protection.outlook.com",
        "ttl": 300
      }
    ]
  }
}

Use cases

  • Verify SPF, DKIM and DMARC TXT records when setting up e-mail
  • Check that a customer’s custom domain points to your servers
  • Monitor DNS changes and propagation after a migration
  • Reverse-lookup IPs from logs to hostnames

FAQ

How do I check the MX records of a domain?

Call /v1/dns?domain=example.com&type=MX. Records are returned sorted as the resolver gives them, each with priority, exchange host and TTL.

How do I do a reverse DNS (PTR) lookup?

Pass the IP as the domain: /v1/dns?domain=8.8.8.8&type=PTR returns dns.google. IPv6 addresses are supported as well.

Why do I see old values after changing DNS?

Resolvers cache records for their TTL, and APIBox caches each answer for 5 minutes. Wait for the old TTL to expire; the ttl field shows how long the current answer stays cached.

Related APIs

Start with 1,000 free requests every month. Get free API key →