DNS Lookup
Every DNS record a domain publishes, its mail provider and DNS host, or reverse DNS for an IP.
curl -X POST https://api.1lookup.dev/v1/dns-lookup \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"domain":"example.com"}'{
"success": true,
"data": {
"query": "example.com",
"query_type": "domain",
"records": {
"a": [
{
"address": "203.0.113.10",
"ttl": 300
}
],
"aaaa": [
{
"address": "2001:db8::10",
"ttl": 300
}
],
"cname": [],
"mx": [
{
"priority": 10,
"exchange": "mx1.mailhost.example",
"ttl": 3600
},
{
"priority": 20,
"exchange": "mx2.mailhost.example",
"ttl": 3600
}
],
"txt": [
"v=spf1 include:_spf.mailhost.example ~all",
"example-site-verification=4f9c2a71d0b84e53"
],
"ns": [
"ns1.dnshost.example",
"ns2.dnshost.example"
],
"soa": {
"primary_ns": "ns1.dnshost.example",
"admin_email": "hostmaster@example.com",
"serial": 2026111201,
"refresh": 7200,
"retry": 3600,
"expire": 1209600,
"minimum_ttl": 300
},
"caa": [
{
"flags": 0,
"tag": "issue",
"value": "ca.example"
}
],
"ptr": []
},
"mail_provider": "Example Mail Hosting",
"dns_host": "Example DNS Host"
},
"meta": {
"credits_used": 2,
"credits_remaining": 999,
"cached": false,
"request_id": "req_8f3a2c1e9b7d"
}
}Authorization
Authorizationstring<bearer>requiredYour API key as a Bearer token. Live keys start with 1lk_live_. Test keys start with 1lk_test_ and return this endpoint's sample response without spending credits. See authentication.
Body
Send the fields as a JSON object with Content-Type: application/json.
domainstring<domain>requiredDomain. A domain, or an IP address for reverse DNS. Example: example.com
freshbooleanSkip the 7-day cache and run a new lookup. Charged as a normal lookup.
referencestringYour own identifier, echoed back in meta and shown in lookup history.
Response
A 200 response carries the result in data and the cost of the call in meta. These are the fields most integrations read.
successbooleantrue when the lookup ran.
data.records.aarrayIPv4 addresses the name resolves to, each with a TTL. IPv6 addresses sit beside them in records.aaaa.
data.records.mxarrayMail servers for the domain, in priority order.
data.records.txtarrayEvery TXT string, including SPF policies and site verification tokens.
data.records.nsarrayThe authoritative nameservers the domain is delegated to.
data.records.caaarrayWhich certificate authorities the domain allows to issue certificates for it.
data.mail_providerstringThe email service inferred from the MX hosts, or null when none is recognized.
data.dns_hoststringThe DNS service inferred from the nameservers.
data.records.ptrarrayHostnames an IP address points back to. Filled when you send an IP instead of a domain.
meta.credits_usednumberCredits charged for this call.
meta.credits_remainingnumberYour balance after the call.
meta.cachedbooleantrue when the result came from the 7-day cache.
meta.request_idstringQuote this when you contact support.
Errors
A failed request returns success: false with an error object, and is never charged. The full list is on the errors page.
| HTTP | Code | Meaning |
|---|---|---|
| 401 | unauthorized | The key is missing, malformed or revoked. |
| 402 | insufficient_credits | Your credits are used up and pay as you go is off or at its limit. |
| 422 | invalid_input | A field is missing or malformed. The field property names it. |
| 429 | rate_limited | Too many requests for this key. Wait for the Retry-After interval. |
| 500 | internal_error | Something failed on our side. Safe to retry. |
| 503 | source_unavailable | An upstream source did not answer in time. Safe to retry. |
Billing
2 credits. Charged when the lookup runs and returns a result. Errors are never charged, and repeating the same input within 7 days is served from cache at no charge.
Product overview and use cases