DNS Lookup

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 domain as a query parameter (GET) or in a JSON body (POST).
  • You can pass a bare domain or a URL; https://www.example.com/path is read as www.example.com. Internationalized names are converted to punycode.
  • Each record has name (no trailing dot), ttl in seconds, type and data exactly 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-lookup
Look up every supported record type for a domain. POST with the same field in a JSON body also works.

Query Parameters

ParameterTypeRequiredDescription
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 name
401
Missing or invalid API key
403
API key inactive, expired, or not allowed from this IP
404
No DNS records found for the domain
429
Rate limit exceeded
500
Internal server error

Code Examples

curl "https://opentools.ca/api/v1/tools/dns-lookup?domain=example.com" \
  -H "Authorization: Bearer YOUR_API_KEY"

Ready to get started?

Create an API key to start using the DNS Lookup API.

Rather use it in your browser? Open the DNS Lookup