# DNS Lookup API

> DNS Lookup retrieves published DNS records for any domain, including IPv4 (A), IPv6 (AAAA), and mail exchange (MX) servers. It provides hostnames, priorities, and dual-stack status flags, while paid plans add TXT, CNAME, and nameserver records.

**Endpoint:** `GET https://api.apiverve.com/v1/dnslookup`  
**Category:** Domain Data  
**Cost:** 6 credits per call  
**Canonical page:** https://apiverve.com/marketplace/dnslookup

## Overview

A DNS lookup API for checking a domain's records from code, the nslookup or dig step in onboarding, email and migration checks. Send a domain or hostname and DNS Lookup queries its records live and returns them as JSON, with flags for IPv6, mail servers and SPF. Every plan gets A, AAAA and MX records with priorities; paid plans add CNAME, NS, SOA and TXT records.

## Authentication

Every call carries your key in an `x-api-key` header. The same key works across the whole
APIVerve catalog — there are no per-API subscriptions. Responses always use the same three
top-level keys: `status`, `error`, and `data`.

## Example request

```bash
curl "https://api.apiverve.com/v1/dnslookup?domain=myspace.com&type=A%2CMX%2CTXT" \
  -H "x-api-key: YOUR_API_KEY"
```

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `domain` | string | Yes | The domain or DNS name to look up, without the protocol. Underscore names work too, such as _dmarc.example.com or _sip._tcp.example.com, and so do Unicode names such as münchen.de. With type PTR, a bare IP address is looked up as its reverse name. length 0-253 |
| `type` | string | No | Comma-separated record types to look up. Leave it out for A, AAAA, CNAME, MX, NS, PTR, SRV, SOA, TXT and CAA. HTTPS, SVCB, TLSA, NAPTR, DS and DNSKEY are returned only when named here. One of: A, AAAA, CNAME, MX, NS, PTR, SRV, SOA, TXT, CAA, HTTPS, SVCB, TLSA, NAPTR, DS, DNSKEY |

## Response fields

- `domain` — string · The domain name that was queried
- `records` — object · Object containing all DNS records for the domain
  - `records.A` — array · IPv4 address records for the domain
  - `records.AAAA` — array · IPv6 address records for the domain
  - `records.CNAME` — object · Canonical name alias records · (premium)
    - `records.MX.0.exchange` — string · Mail server hostname
    - `records.MX.0.priority` — number · Priority level for the mail server
  - `records.NS` — array · Nameserver records for the domain · (premium)
  - `records.PTR` — object · Pointer records published at this name
  - `records.SRV` — object · Service records, published at names such as _sip._tcp.example.com
  - `records.SOA` — object · Start of Authority record with DNS zone info · (premium)
    - `records.SOA.nsname` — string · Primary nameserver hostname · (premium)
    - `records.SOA.hostmaster` — string · Email address of domain administrator · (premium)
    - `records.SOA.serial` — number · Serial number for zone version tracking · (premium)
    - `records.SOA.refresh` — number · Secondary server refresh interval in seconds · (premium)
    - `records.SOA.retry` — number · Retry interval for failed transfers · (premium)
    - `records.SOA.expire` — number · Zone expiration time in seconds · (premium)
    - `records.SOA.minttl` — number · Minimum time to live for records · (premium)
  - `records.TXT` — array · Text records including SPF, DKIM, verification data · (premium)
    - `records.CAA.0.critical` — number
    - `records.CAA.0.issue` — string
- `ttl` — object · Seconds each record type stays cached, keyed by type (lowest in the set), as a public resolver serves it: it counts down from the zone's configured TTL while cached. null for a type with no records · (premium)
  - `ttl.A` — number · (premium)
  - `ttl.AAAA` — number · (premium)
  - `ttl.CNAME` — object · (premium)
  - `ttl.MX` — number · (premium)
  - `ttl.NS` — number · (premium)
  - `ttl.PTR` — object · (premium)
  - `ttl.SRV` — object · (premium)
  - `ttl.SOA` — number · (premium)
  - `ttl.TXT` — number · (premium)
  - `ttl.CAA` — number · (premium)
- `summary` — object · At-a-glance flags derived from the records above
  - `summary.hasIPv6` — boolean · Whether the domain publishes any AAAA (IPv6) records — indicates dual-stack readiness
  - `summary.hasMailServers` — boolean · Whether the domain publishes any MX records — indicates it is configured to receive email
  - `summary.hasSPF` — boolean · Whether a TXT record starting with v=spf1 is present — a coarse email-authentication posture flag (use the SPF Validator to parse it) · (premium)

## Sample response

```json
{
  "status": "ok",
  "error": null,
  "data": {
    "domain": "google.com",
    "records": {
      "A": [
        "172.253.156.100",
        "172.253.156.113",
        "172.253.156.101",
        "172.253.156.139",
        "172.253.156.138",
        "172.253.156.102"
      ],
      "AAAA": [
        "2607:f8b0:4023:100d::65",
        "2607:f8b0:4023:100d::8a",
        "2607:f8b0:4023:100d::71",
        "2607:f8b0:4023:100d::64"
      ],
      "CNAME": null,
      "MX": [
        {
          "exchange": "smtp.google.com",
          "priority": 10
        }
      ],
      "NS": [
        "ns4.google.com",
        "ns3.google.com",
        "ns2.google.com",
        "ns1.google.com"
      ],
      "PTR": null,
      "SRV": null,
      "SOA": {
        "nsname": "ns1.google.com",
        "hostmaster": "dns-admin.google.com",
        "serial": 1005474929,
        "refresh": 900,
        "retry": 900,
        "expire": 1800,
        "minttl": 60
      },
      "TXT": [
        [
          "onetrust-domain-verification=0d477fe608074e6f9c12bca7826035cc"
        ],
        [
          "work-accounts-domain-verification=Tcj6JjIMZOw2KsSEw2Nt2rLae89tN6"
        ],
        [
          "google-site-verification=wD8N7i1JTNTkezJ49swvWW48f8_9xveREV4oB-0Hf5o"
        ],
        [
          "Z29vZ2xl"
        ],
        [
          "globalsign-smime-dv=CDYX+XFHUw2wml6/Gb8+59BsH31KzUr6c1l2BPvqKX8="
        ],
        [
          "arcules-domain-verification=2R4t5G7nI6tRCo61lpxxbLksPYstxhGmtV75cpr8x9K"
        ],
        [
          "v=spf1 include:_spf.google.com ~all"
        ],
        [
          "_r4rd1pvwyrpi7sw4a3hzmw8e51yh9td"
        ],
        [
          "apple-domain-verification=30afIBcvSuDV2PLX"
        ],
        [
          "onetrust-domain-verification=6d685f1d41a94696ad7ef771f68993e0"
        ],
        [
          "facebook-domain-verification=22rm551cu4k0ab0bxsw536tlds4h95"
        ],
        [
          "google-site-verification=TV9-DBe4R80X4v0M4U_bd_J9cpOJM0nikft0jAgjmsQ"
        ],
        [
          "MS=E4A68B9AB2BB9670BCE15412F62916164C0B20BB"
        ],
        [
          "docusign=05958488-4752-4ef2-95eb-aa7ba8a3bd0e"
        ],
        [
          "google-site-verification=4ibFUgB-wXLQ_S7vsXVomSTVamuOXBiVAzpR5IZ87D0"
        ],
        [
          "docusign=1b0a6754-49b1-4db5-8540-d2c12664b289"
        ],
        [
          "cisco-ci-domain-verification=47c38bc8c4b74b7233e9053220c1bbe76bcc1cd33c7acf7acd36cd6a5332004b"
        ]
      ],
      "CAA": [
        {
          "critical": 0,
          "issue": "pki.goog"
        }
      ]
    },
    "ttl": {
      "A": 10,
      "AAAA": 2,
      "CNAME": null,
      "MX": 74,
      "NS": 15382,
      "PTR": null,
      "SRV": null,
      "SOA": 25,
      "TXT": 300,
      "CAA": 21600
    },
    "summary": {
      "hasIPv6": true,
      "hasMailServers": true,
      "hasSPF": true
    }
  }
}
```

## Use cases

- **Mail Delivery Verification** — To verify email destination readiness, onboarding systems query incoming domain MX records and priority values before routing outbound messages.
- **Dual-Stack Infrastructure Auditing** — DevOps engineers inspect IPv4 and IPv6 addresses across client domains to confirm dual-stack network reachability and detect missing AAAA entries.
- **Domain Migration Monitoring** — When moving web infrastructure to new hosts, deployment pipelines check resolving A and MX records in real time to verify DNS propagation.
- **Custom Domain Onboarding** — Hosting platforms query target domains during customer onboarding to verify that resolved IP addresses point to designated web servers.

## SDKs

- **npm** — `npm install @apiverve/dnslookup` (https://www.npmjs.com/package/@apiverve/dnslookup)
- **PyPI** — `pip install apiverve-dnslookup` (https://pypi.org/project/apiverve-dnslookup/)
- **NuGet** — `dotnet add package APIVerve.API.DNSLookup` (https://www.nuget.org/packages/APIVerve.API.DNSLookup)
- **Source** — https://github.com/apiverve/dnslookup-api

## More

- Full reference: https://docs.apiverve.com/ref/dnslookup
- Get an API key: https://dashboard.apiverve.com
- Full catalog: https://apiverve.com/marketplace
