APIVoid logo

DNS Lookup API Reference

Resolve DNS records for any host: A, AAAA, MX, NS, TXT, SOA, and modern types like DMARC, BIMI, MTA-STS, TLS-RPT, HTTPS, TLSA, CAA, DNSSEC records and more.

Service details and pricing: DNS Lookup API

POSThttps://api.apivoid.com/v2/dns-lookup
1 credit per successful requestPOST · JSON

Request example

Query the endpoint via an HTTPS POST request (replace YOUR_API_KEY_HERE with your API key):

curl
curl -X POST "https://api.apivoid.com/v2/dns-lookup" \
     -H "Content-Type: application/json" \
     -H "X-API-Key: YOUR_API_KEY_HERE" \
     -d '{"host": "example.com", "dns_types": "A,AAAA,MX,NS,TXT,SOA,DMARC,BIMI,MTA-STS,TLS-RPT,ACME,HTTPS,TLSA,CAA,SRV,DNSKEY,DS,RRSIG"}'

The same request in PHP:

php
$host = 'example.com';

$apiKey = 'YOUR_API_KEY_HERE';

$curl = curl_init('https://api.apivoid.com/v2/dns-lookup');
curl_setopt($curl, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'X-API-Key: ' . $apiKey]);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode([
    'host' => $host,
    'dns_types' => 'A,AAAA,MX,NS,TXT,SOA,DMARC,BIMI,MTA-STS,TLS-RPT,ACME,HTTPS,TLSA,CAA,SRV,DNSKEY,DS,RRSIG'
]));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);

if ($httpCode === 200) {
    $responseData = json_decode($response, true);
    print_r($responseData);
} else {
    print_r('An error occurred: '.$response);
}

Request parameters

Required

hoststringRequired

Host to submit, e.g. google.com.

dns_typesstringRequired

DNS types, comma-separated with no spaces, such as: A,AAAA,MX,NS,TXT,SOA,DMARC,BIMI,MTA-STS,TLS-RPT,ACME,HTTPS,TLSA,CAA,SRV,DNSKEY,DS,RRSIG.

Response example

A successful request returns HTTP 200 with a JSON body:

json · 200
{
    "host": "example.com",
    "records": {
        "a": [
            {
                "target": "93.184.215.14",
                "ttl": 3380
            }
        ],
        "aaaa": [
            {
                "target": "2606:2800:21f:cb07:6820:80da:af6b:8b2c",
                "ttl": 3380
            }
        ],
        "caa": [
            {
                "flag": 0,
                "tag": "iodef",
                "ttl": 3600,
                "value": "mailto:caa-violations@stripe.com"
            },
            {
                "flag": 0,
                "tag": "issue",
                "ttl": 3600,
                "value": "amazon.com"
            },
            {
                "flag": 0,
                "tag": "issue",
                "ttl": 3600,
                "value": "digicert.com"
            },
            {
                "flag": 0,
                "tag": "issue",
                "ttl": 3600,
                "value": "visa.com"
            }
        ],
        "dmarc": [
            {
                "target": "v=DMARC1;p=reject;sp=reject;adkim=s;aspf=s",
                "ttl": 3390
            }
        ],
        "bimi": [
            {
                "target": "v=BIMI1; l=https://www.example.com/uploads/bimi.svg; a=https://www.example.com/uploads/bimi-cert.pem;",
                "ttl": 3390
            }
        ],
        "acme": [
            {
                "target": "TqufBc_OudO92bJuiVy_VChVELY6t9N990a41ofwkW4",
                "ttl": 300
            },
            {
                "target": "THfu-OTfch3gJMULczPtcIpNlyJ96D5aq6c2ZZ3xh70",
                "ttl": 300
            }
        ],
        "mta-sts": [
            {
                "target": "v=STSv1; id=20251202110430Z",
                "ttl": 290
            }
        ],
        "tls-rpt": [
            {
                "target": "v=TLSRPTv1; rua=mailto:tlsrpt@posteo.de",
                "ttl": 300
            }
        ],
        "https": [
            {
                "params": "h2,h3",
                "priority": 1,
                "target": ".",
                "ttl": 21600
            }
        ],
        "tlsa": [
            {
                "certificate": "b7273310126734f9de62f29eb1f21907bf4e02a0fa1c3feda4594098841139c9",
                "matching_type": 1,
                "selector": 1,
                "ttl": 900,
                "usage": 3
            },
            {
                "certificate": "5ce7c3caf94015db746880a8d937df5674cf539c426990682d5b84c3a3bfeca3",
                "matching_type": 1,
                "selector": 1,
                "ttl": 900,
                "usage": 3
            },
            {
                "certificate": "2cd895dcbc6c9d4e1a267d7d1d75ace8b4b051dff71c7a9fdf0fac1e46a9398f",
                "matching_type": 1,
                "selector": 1,
                "ttl": 900,
                "usage": 3
            },
            {
                "certificate": "604016df5069274948aa519ac9236b70fcf1b455867c97ab856022c8affcc6ea",
                "matching_type": 1,
                "selector": 1,
                "ttl": 900,
                "usage": 3
            },
            {
                "certificate": "8488d4c1d6a4194a0ba962f5f606725c1d2a6eef062743efdb949dbb313c9be9",
                "matching_type": 1,
                "selector": 1,
                "ttl": 900,
                "usage": 3
            }
        ],
        "mx": [
            {
                "pref": 10,
                "target": "alt1.gmail-smtp-in.l.google.com",
                "ttl": 2700
            },
            {
                "pref": 20,
                "target": "alt2.gmail-smtp-in.l.google.com",
                "ttl": 2700
            },
            {
                "pref": 30,
                "target": "alt3.gmail-smtp-in.l.google.com",
                "ttl": 2700
            },
            {
                "pref": 40,
                "target": "alt4.gmail-smtp-in.l.google.com",
                "ttl": 2700
            }
        ],
        "ns": [
            {
                "target": "b.iana-servers.net",
                "ttl": 86180
            },
            {
                "target": "a.iana-servers.net",
                "ttl": 86180
            }
        ],
        "soa": [
            {
                "expire": 1209600,
                "minttl": 3600,
                "mname": "ns.icann.org",
                "refresh": 7200,
                "retry": 3600,
                "rname": "noc@dns.icann.org",
                "serial": 2024081460,
                "ttl": 3380
            }
        ],
        "srv": [
            {
                "port": 5060,
                "priority": 50,
                "target": "ygg2.vp.vc",
                "ttl": 1800,
                "weight": 100
            },
            {
                "port": 5060,
                "priority": 10,
                "target": "ygg1.vp.vc",
                "ttl": 1800,
                "weight": 100
            }
        ],
        "txt": [
            {
                "target": "v=spf1 -all",
                "ttl": 86180
            },
            {
                "target": "wgyf8z8cgvm2qmxpnbnldrcltvk4xqfn",
                "ttl": 86180
            }
        ],
        "dnskey": [
            {
                "algorithm": 13,
                "flags": 256,
                "protocol": 3,
                "public_key": "t7/xPcfCnzUrxKawsmnR+SxQAJSSLABBt+y7eV2/BylpqG6vhGuJRVGSsHeuBt/VjC6IByqVMYGu1J9+/s1QbQ=="
            },
            {
                "algorithm": 13,
                "flags": 257,
                "protocol": 3,
                "public_key": "1NYmUeN/Ens1c5m8lmq5/SiqjpMK+dfGDY+3j8KkDgDSiDQev59JlxpQSIgRV723NGBrM5wyDtORZ20rSVkCqA=="
            }
        ],
        "ds": [
            {
                "algorithm": 13,
                "digest": "9778f2ff96889ebed549795deaa40a6113f1899af7ca8dd7947fddfeca9a190b",
                "digest_type": 2,
                "key_tag": 7037
            }
        ],
        "rrsig": [
            {
                "algorithm": 13,
                "expiration": 1790950700,
                "inception": 1788355413,
                "key_tag": 34374,
                "labels": 2,
                "original_ttl": 300,
                "signature": "wwIv4z1kEQbq5T81t7AydkBil0BaVA+agWJmaCbwXgSE69CYY/AoIgBQOFN3czf1Km9EovQqWFkT8kDoExZ3mw==",
                "signer_name": "example.com",
                "type_covered": "A"
            },
            {
                "algorithm": 13,
                "expiration": 1790932671,
                "inception": 1788339888,
                "key_tag": 34374,
                "labels": 2,
                "original_ttl": 3600,
                "signature": "xJjQH4pTz7ebffMdmkQ1n/IWIHROyh9ql3nNKeHOjPghuAzUiwZ4NDZzJquyEorRwstp6r/gmmYpEL+P2sUkEg==",
                "signer_name": "example.com",
                "type_covered": "MX"
            }
        ]
    },
    "elapsed_ms": 28
}

Response fields

The fields returned in the JSON response:

hoststring

Host submitted for the DNS lookup.

recordsobject

DNS records found for the host, grouped by record type.

records → aarray

A records; each item has target (IPv4 address) and ttl.

records → a[n] → targetstring

IPv4 address the A record points to.

records → a[n] → ttlinteger

Time-to-live (TTL) of the record, in seconds.

records → aaaaarray

AAAA records; each item has target (IPv6 address) and ttl.

records → aaaa[n] → targetstring

IPv6 address the AAAA record points to.

records → aaaa[n] → ttlinteger

Time-to-live (TTL) of the record, in seconds.

records → caaarray

CAA records; each item has flag, tag (e.g. issue, iodef), value and ttl.

records → caa[n] → flaginteger

CAA record flag; 0 by default, 128 marks the record as critical.

records → caa[n] → tagstring

CAA property tag, e.g. issue, issuewild or iodef.

records → caa[n] → ttlinteger

Time-to-live (TTL) of the record, in seconds.

records → caa[n] → valuestring

CAA property value, e.g. the certificate authority allowed to issue certificates.

records → dmarcarray

DMARC records found on _dmarc subdomain; each item has target (record value) and ttl.

records → dmarc[n] → targetstring

DMARC record value.

records → dmarc[n] → ttlinteger

Time-to-live (TTL) of the record, in seconds.

records → bimiarray

BIMI records found on default._bimi subdomain; each item has target (record value) and ttl.

records → bimi[n] → targetstring

BIMI record value.

records → bimi[n] → ttlinteger

Time-to-live (TTL) of the record, in seconds.

records → acmearray

ACME challenge records found on _acme-challenge subdomain; each item has target and ttl.

records → acme[n] → targetstring

ACME challenge token value.

records → acme[n] → ttlinteger

Time-to-live (TTL) of the record, in seconds.

records → mta-stsarray

MTA-STS records found on _mta-sts subdomain; each item has target and ttl.

records → mta-sts[n] → targetstring

MTA-STS record value.

records → mta-sts[n] → ttlinteger

Time-to-live (TTL) of the record, in seconds.

records → tls-rptarray

TLS-RPT records found on _smtp._tls subdomain; each item has target and ttl.

records → tls-rpt[n] → targetstring

TLS-RPT record value.

records → tls-rpt[n] → ttlinteger

Time-to-live (TTL) of the record, in seconds.

records → httpsarray

HTTPS records; each item has target, params (e.g. h2,h3), priority and ttl.

records → https[n] → paramsstring

HTTPS record SvcParams, e.g. the alpn values h2,h3.

records → https[n] → priorityinteger

HTTPS record priority; 0 indicates alias mode.

records → https[n] → targetstring

HTTPS record target name; a dot (.) refers to the record owner itself.

records → https[n] → ttlinteger

Time-to-live (TTL) of the record, in seconds.

records → tlsaarray

TLSA records; each item has certificate, usage, selector, matching_type and ttl.

records → tlsa[n] → certificatestring

Certificate association data (hash of the certificate or public key).

records → tlsa[n] → matching_typeinteger

TLSA matching type: 0 (exact match), 1 (SHA-256) or 2 (SHA-512).

records → tlsa[n] → selectorinteger

TLSA selector: 0 (full certificate) or 1 (public key).

records → tlsa[n] → ttlinteger

Time-to-live (TTL) of the record, in seconds.

records → tlsa[n] → usageinteger

TLSA certificate usage, from 0 to 3 (e.g. 3 = domain-issued certificate).

records → mxarray

MX records; each item has target (mail server), pref (preference) and ttl.

records → mx[n] → prefinteger

Preference of the mail server; lower values are tried first.

records → mx[n] → targetstring

Mail server hostname.

records → mx[n] → ttlinteger

Time-to-live (TTL) of the record, in seconds.

records → nsarray

NS records; each item has target (name server) and ttl.

records → ns[n] → targetstring

Name server hostname.

records → ns[n] → ttlinteger

Time-to-live (TTL) of the record, in seconds.

records → soaarray

SOA records; each item has mname, rname, serial, refresh, retry, expire, minttl and ttl.

records → soa[n] → expireinteger

Seconds after which secondary name servers stop answering if the primary is unreachable.

records → soa[n] → minttlinteger

Minimum TTL, used for negative caching, in seconds.

records → soa[n] → mnamestring

Primary name server for the zone.

records → soa[n] → refreshinteger

Seconds between zone refresh checks by secondary name servers.

records → soa[n] → retryinteger

Seconds before a failed zone refresh is retried.

records → soa[n] → rnamestring

Email address of the zone administrator.

records → soa[n] → serialinteger

Serial number of the zone; increases on every zone update.

records → soa[n] → ttlinteger

Time-to-live (TTL) of the record, in seconds.

records → srvarray

SRV records; each item has target, port, priority, weight and ttl.

records → srv[n] → portinteger

Port where the service is available.

records → srv[n] → priorityinteger

Priority of the target host; lower values are tried first.

records → srv[n] → targetstring

Hostname providing the service.

records → srv[n] → ttlinteger

Time-to-live (TTL) of the record, in seconds.

records → srv[n] → weightinteger

Relative weight for records with the same priority.

records → txtarray

TXT records; each item has target (record value) and ttl.

records → txt[n] → targetstring

TXT record value.

records → txt[n] → ttlinteger

Time-to-live (TTL) of the record, in seconds.

records → dnskeyarray

DNSKEY records; each item has flags, protocol, algorithm and public_key.

records → dnskey[n] → flagsinteger

DNSKEY flags: 256 for a Zone Signing Key (ZSK), 257 for a Key Signing Key (KSK).

records → dnskey[n] → protocolinteger

DNSKEY protocol field, always 3.

records → dnskey[n] → algorithminteger

DNSSEC algorithm number, e.g. 13 (ECDSA P-256 with SHA-256) or 8 (RSA/SHA-256).

records → dnskey[n] → public_keystring

Public key material, base64-encoded.

records → dsarray

DS records; each item has key_tag, algorithm, digest_type and digest.

records → ds[n] → key_taginteger

Key tag identifying the DNSKEY this DS record refers to.

records → ds[n] → algorithminteger

DNSSEC algorithm number of the referenced DNSKEY, e.g. 13.

records → ds[n] → digest_typeinteger

Digest algorithm: 1 (SHA-1), 2 (SHA-256) or 4 (SHA-384).

records → ds[n] → digeststring

Digest of the referenced DNSKEY record, in hexadecimal.

records → rrsigarray

RRSIG records; each item has type_covered, algorithm, labels, original_ttl, expiration, inception, key_tag, signer_name and signature.

records → rrsig[n] → type_coveredstring

DNS record type covered by this signature, e.g. A, MX, SOA.

records → rrsig[n] → algorithminteger

DNSSEC algorithm number used for the signature, e.g. 13.

records → rrsig[n] → labelsinteger

Number of labels in the original owner name (used for wildcard validation).

records → rrsig[n] → original_ttlinteger

Original TTL of the signed record set, in seconds.

records → rrsig[n] → expirationinteger

Unix timestamp after which the signature is no longer valid.

records → rrsig[n] → inceptioninteger

Unix timestamp from which the signature is valid.

records → rrsig[n] → key_taginteger

Key tag of the DNSKEY that produced the signature.

records → rrsig[n] → signer_namestring

Zone name that signed the record set, e.g. example.com.

records → rrsig[n] → signaturestring

Cryptographic signature, base64-encoded.

elapsed_msinteger

Time taken to process the request, in milliseconds.

Bulk domains request

You can also submit multiple domains in a single request on the /bulk endpoint. The required JSON field is hosts (plural), with comma-separated domains, instead of the host field used for the single-domain request:

curl
curl -X POST "https://api.apivoid.com/v2/dns-lookup/bulk" \
     -H "Content-Type: application/json" \
     -H "X-API-Key: YOUR_API_KEY_HERE" \
     -d '{"hosts": "google.com,stripe.com,msn.com,amazon.com,yahoo.com", "dns_types": "A,NS"}'

The same request in PHP:

php
$hosts = 'google.com,stripe.com,msn.com,amazon.com,yahoo.com';
$dnsTypes = 'A,NS';

$apiKey = 'YOUR_API_KEY_HERE';

$curl = curl_init('https://api.apivoid.com/v2/dns-lookup/bulk');
curl_setopt($curl, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'X-API-Key: ' . $apiKey]);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode(['hosts' => $hosts, 'dns_types' => $dnsTypes]));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);

if ($httpCode === 200) {
    $responseData = json_decode($response, true);
    print_r($responseData);
} else {
    print_r('An error occurred: '.$response);
}

Each subscription plan has a different limit on the number of domains that can be submitted in one bulk request; for example, the Basic plan allows up to 5. Each domain counts as a separate API request, so submitting 5 domains in bulk consumes the same credits as 5 single requests. You can check the X-Service-Quota header (call-usage).

Required

hostsstringRequired

Comma-separated list of hosts to resolve (no spaces), e.g. google.com,stripe.com. The maximum number of hosts per request depends on your plan.

dns_typesstringRequired

DNS types, comma-separated with no spaces, same values as the single-domain request.

The JSON output is different from the single-domain request: each host is returned as an entry with its own records object (same record structure as documented above):

json · 200 · bulk
{
    "entries": [
        {
            "host": "google.com",
            "records": {
                "a": [
                    {
                        "target": "173.194.212.102",
                        "ttl": 300
                    },
                    {
                        "target": "173.194.212.138",
                        "ttl": 300
                    },
                    {
                        "target": "173.194.212.139",
                        "ttl": 300
                    },
                    {
                        "target": "173.194.212.100",
                        "ttl": 300
                    },
                    {
                        "target": "173.194.212.101",
                        "ttl": 300
                    },
                    {
                        "target": "173.194.212.113",
                        "ttl": 300
                    }
                ],
                "ns": [
                    {
                        "target": "ns1.google.com",
                        "ttl": 86400
                    },
                    {
                        "target": "ns3.google.com",
                        "ttl": 86400
                    },
                    {
                        "target": "ns4.google.com",
                        "ttl": 86400
                    },
                    {
                        "target": "ns2.google.com",
                        "ttl": 86400
                    }
                ]
            }
        },
        {
            "host": "stripe.com",
            "records": {
                "a": [
                    {
                        "target": "3.229.145.172",
                        "ttl": 60
                    },
                    {
                        "target": "54.162.8.126",
                        "ttl": 60
                    },
                    {
                        "target": "3.90.98.12",
                        "ttl": 60
                    }
                ],
                "ns": [
                    {
                        "target": "ns-1087.awsdns-07.org",
                        "ttl": 43200
                    },
                    {
                        "target": "ns-1882.awsdns-43.co.uk",
                        "ttl": 43200
                    },
                    {
                        "target": "ns-423.awsdns-52.com",
                        "ttl": 43200
                    },
                    {
                        "target": "ns-705.awsdns-24.net",
                        "ttl": 43200
                    }
                ]
            }
        },
        {
            "host": "msn.com",
            "records": {
                "a": [
                    {
                        "target": "204.79.197.219",
                        "ttl": 3600
                    }
                ],
                "ns": [
                    {
                        "target": "ns4-204.azure-dns.info",
                        "ttl": 86400
                    },
                    {
                        "target": "dns1.p08.nsone.net",
                        "ttl": 86400
                    },
                    {
                        "target": "dns2.p08.nsone.net",
                        "ttl": 86400
                    },
                    {
                        "target": "dns3.p08.nsone.net",
                        "ttl": 86400
                    },
                    {
                        "target": "dns4.p08.nsone.net",
                        "ttl": 86400
                    },
                    {
                        "target": "ns1-204.azure-dns.com",
                        "ttl": 86400
                    },
                    {
                        "target": "ns2-204.azure-dns.net",
                        "ttl": 86400
                    },
                    {
                        "target": "ns3-204.azure-dns.org",
                        "ttl": 86400
                    }
                ]
            }
        },
        {
            "host": "amazon.com",
            "records": {
                "a": [
                    {
                        "target": "205.251.242.103",
                        "ttl": 900
                    },
                    {
                        "target": "52.94.236.248",
                        "ttl": 900
                    },
                    {
                        "target": "54.239.28.85",
                        "ttl": 900
                    }
                ],
                "ns": [
                    {
                        "target": "ns1.amzndns.org",
                        "ttl": 7200
                    },
                    {
                        "target": "ns2.amzndns.co.uk",
                        "ttl": 7200
                    },
                    {
                        "target": "ns2.amzndns.com",
                        "ttl": 7200
                    },
                    {
                        "target": "ns2.amzndns.net",
                        "ttl": 7200
                    },
                    {
                        "target": "ns2.amzndns.org",
                        "ttl": 7200
                    },
                    {
                        "target": "ns1.amzndns.co.uk",
                        "ttl": 7200
                    },
                    {
                        "target": "ns1.amzndns.com",
                        "ttl": 7200
                    },
                    {
                        "target": "ns1.amzndns.net",
                        "ttl": 7200
                    }
                ]
            }
        },
        {
            "host": "yahoo.com",
            "records": {
                "a": [
                    {
                        "target": "98.137.11.163",
                        "ttl": 1800
                    },
                    {
                        "target": "98.137.11.164",
                        "ttl": 1800
                    },
                    {
                        "target": "74.6.143.26",
                        "ttl": 1800
                    },
                    {
                        "target": "74.6.143.25",
                        "ttl": 1800
                    },
                    {
                        "target": "74.6.231.20",
                        "ttl": 1800
                    },
                    {
                        "target": "74.6.231.21",
                        "ttl": 1800
                    }
                ],
                "ns": [
                    {
                        "target": "ns1.yahoo.com",
                        "ttl": 86400
                    },
                    {
                        "target": "ns5.yahoo.com",
                        "ttl": 86400
                    },
                    {
                        "target": "ns4.yahoo.com",
                        "ttl": 86400
                    },
                    {
                        "target": "ns2.yahoo.com",
                        "ttl": 86400
                    },
                    {
                        "target": "ns3.yahoo.com",
                        "ttl": 86400
                    }
                ]
            }
        }
    ],
    "elapsed_ms": 313
}