
DNS Lookup API
Development
Query DNS records for any domain. Retrieve A, AAAA, CNAME, MX, NS, SOA, TXT, and other record types instantly.
Authentication
All API requests require a valid API key passed in the Authorization header as a Bearer token.
Rate Limit
20 requests per minute
Endpoints
1 endpoint available
Overview
Look up the DNS records for a domain. One call queries A, AAAA, CNAME, MX, NS, SOA, TXT and CAA records through Google Public DNS (DNS over HTTPS) and returns every record found.
Notes
- Send
domainas a query parameter (GET) or in a JSON body (POST). - You can pass a bare domain or a URL;
https://www.example.com/pathis read aswww.example.com. Internationalized names are converted to punycode. - Each record has
name(no trailing dot),ttlin seconds,typeanddataexactly as the resolver returns it (MX data includes the priority, e.g.10 mail.example.com.). - A record type that fails or times out is left out rather than failing the whole lookup. If no records are found at all, the API returns 404.
Endpoints
GET
https://opentools.ca/api/v1/tools/dns-lookupLook up every supported record type for a domain. POST with the same field in a JSON body also works.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| domain | string | Required | Domain to look up, e.g. example.com. A URL is accepted and its hostname is used. Max 300 characters. |
Response Example
{
"success": true,
"domain": "example.com",
"count": 5,
"records": [
{
"name": "example.com",
"ttl": 300,
"type": "A",
"data": "93.184.215.14"
},
{
"name": "example.com",
"ttl": 300,
"type": "AAAA",
"data": "2606:2800:21f:cb07:6820:80da:af6b:8b2c"
},
{
"name": "example.com",
"ttl": 3600,
"type": "MX",
"data": "0 ."
},
{
"name": "example.com",
"ttl": 86400,
"type": "NS",
"data": "a.iana-servers.net."
},
{
"name": "example.com",
"ttl": 3600,
"type": "TXT",
"data": "v=spf1 -all"
}
]
}Error Codes
400
Missing or invalid domain name401
Missing or invalid API key403
API key inactive, expired, or not allowed from this IP404
No DNS records found for the domain429
Rate limit exceeded500
Internal server errorCode Examples
curl "https://opentools.ca/api/v1/tools/dns-lookup?domain=example.com" \
-H "Authorization: Bearer YOUR_API_KEY"Rather use it in your browser? Open the DNS Lookup