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.
Endpoint
One host, one path per API. The block below shows this call in four languages; every one of them is the same HTTP request. Making requests covers the timeouts, retries and parameter rules that apply to all of them. The SDKs wrap the same call in a typed client.
curl "https://api.apiverve.com/v1/dnslookup?domain=myspace.com&type=A%2CMX%2CTXT" \
-H "x-api-key: your_api_key_here"const res = await fetch('https://api.apiverve.com/v1/dnslookup?domain=myspace.com&type=A%2CMX%2CTXT', {
headers: { 'x-api-key': 'your_api_key_here' },
});
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const { data } = await res.json();
console.log(data);import requests
res = requests.get(
"https://api.apiverve.com/v1/dnslookup?domain=myspace.com&type=A%2CMX%2CTXT",
headers={"x-api-key": "your_api_key_here"},
timeout=15,
)
res.raise_for_status()
print(res.json()["data"])package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.apiverve.com/v1/dnslookup?domain=myspace.com&type=A%2CMX%2CTXT", nil)
req.Header.Set("x-api-key", "your_api_key_here")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(string(out))
}Replace your_api_key_here with the key from your dashboard. When the inputs arrive as a list rather than one at a time, batch requests run up to 200 of them through this same API in a single call.
Authentication
Send your key in the x-api-key header. That is the only auth step — there is no token exchange and no per-endpoint scope to configure. Authentication covers creating, rotating and revoking keys.
A 401 means the key is missing, invalid or expired. A 403 means the key is valid but not permitted here — blocked by a key restriction or an IP allow-list. Running out of credits is a 429.
Parameters
Sent in the query string. Premium parameters are accepted on every plan but only take effect on plans that include them.
| Parameter | Type | Description |
|---|---|---|
domainRequired | string | 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 length 0–253 |
typeOptional | string | 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 hereAAAAACNAMEMXNSPTRSRVSOA+8 |
Response
Every API returns the same three top-level keys, so one response handler covers your whole integration: status, error and data. Only data changes shape. Response format covers the envelope, the other output formats and how premium fields are withheld.
{
"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
}
}
}
Response fields
Paths are relative to data. Premium fields are absent rather than zeroed on plans that do not include them, so check for presence instead of comparing to 0.
| Field | Type | Example | Description |
|---|---|---|---|
domain | string | "google.com" | The domain name that was queried |
records | object | {...} | Object containing all DNS records for the domain |
A | array | [172.253.156.100, ...] | IPv4 address records for the domain |
AAAA | array | [2607:f8b0:4023:100d::65, ...] | IPv6 address records for the domain |
CNAMEPremium | object | null | Canonical name alias records |
MX | array[1] | Mail exchange server records with priority | |
exchange | string | "smtp.google.com" | Mail server hostname |
priority | number | 10 | Priority level for the mail server |
NSPremium | array | [ns4.google.com, ...] | Nameserver records for the domain |
PTR | object | null | Pointer records published at this name |
SRV | object | null | Service records, published at names such as _sip._tcp.example.com |
SOAPremium | object | {...} | Start of Authority record with DNS zone info |
nsnamePremium | string | "ns1.google.com" | Primary nameserver hostname |
hostmasterPremium | string | "dns-admin.google.com" | Email address of domain administrator |
serialPremium | number | 1005474929 | Serial number for zone version tracking |
refreshPremium | number | 900 | Secondary server refresh interval in seconds |
retryPremium | number | 900 | Retry interval for failed transfers |
expirePremium | number | 1800 | Zone expiration time in seconds |
minttlPremium | number | 60 | Minimum time to live for records |
TXTPremium | array | Array of arrays | Text records including SPF, DKIM, verification data |
CAA | array[1] | Certificate Authority Authorization records: which CAs may issue certificates. Each entry has critical plus its tag (issue, issuewild or iodef) as the key | |
critical | number | 0 | |
issue | string | "pki.goog" | |
ttlPremium | 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 |
APremium | number | 10 | |
AAAAPremium | number | 2 | |
CNAMEPremium | object | null | |
MXPremium | number | 74 | |
NSPremium | number | 15382 | |
PTRPremium | object | null | |
SRVPremium | object | null | |
SOAPremium | number | 25 | |
TXTPremium | number | 300 | |
CAAPremium | number | 21600 | |
summary | object | {...} | At-a-glance flags derived from the records above |
hasIPv6 | boolean | true | Whether the domain publishes any AAAA (IPv6) records — indicates dual-stack readiness |
hasMailServers | boolean | true | Whether the domain publishes any MX records — indicates it is configured to receive email |
hasSPFPremium | boolean | true | Whether a TXT record starting with v=spf1 is present — a coarse email-authentication posture flag (use the SPF Validator to parse it) |
Errors
Read the HTTP status first, then error for the specific reason. The body names the parameter that has to change. Error handling covers the full status list and which of them are worth retrying.
| Status | Meaning | What to do |
|---|---|---|
400 | Input was rejected | Read error; it names the parameter. |
401 | Key missing or invalid | Check the header name and the key value. |
403 | Key valid, but not permitted | A key restriction or IP allow-list; see key scoping. |
429 | Rate limited, or out of credits | Read error to tell them apart; see rate limits. |
Start from a template
A working app built on this API, ready to deploy with your own key. Vercel asks for the key when you deploy; the code is on GitHub to change first.
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.
Other ways to use DNS Lookup
Set up DNS Lookup on APIVerve, or reach the same source a different way. Your APIVerve account and credits work on all of them — one key, one balance.
Related
More in Domain Data:
