DNS Lookup API

Overview

The Advanced DNS Lookup API is a powerful tool designed for developers and network administrators to query DNS records with ease. It supports both forward lookups (by domain name) and reverse lookups (by IP address). The API handles a wide range of DNS record types, making it ideal for integration into web applications and network tools.

Pricing Plans

Choose the right plan for your DNS lookup needs with flexible pricing options and no hidden fees

Basic

Free

1,000 Requests / Month

  • All DNS record types
  • Reverse DNS lookups
  • Structured JSON responses
POPULAR

Pro

$4.99 /month

10,000 Requests / Month

  • All DNS record types
  • Reverse DNS lookups
  • 10× more requests

Ultra

$14.99 /month

50,000 Requests / Month

  • All DNS record types
  • Reverse DNS lookups
  • 5× more than Pro plan

Mega

$49.99 /month

250,000 Requests / Month

  • All DNS record types
  • Reverse DNS lookups
  • 5× more than Ultra plan

Need a custom plan for high-volume usage? Contact us for enterprise pricing.

API Documentation

The Advanced DNS Lookup API is a powerful tool designed for developers and network administrators to query DNS records with ease. The API supports a wide range of DNS record types—including A, AAAA, MX, TXT, SOA, NS, and many others—and now also supports reverse DNS lookups using an IP address. It delivers clear JSON-formatted responses, making integration with web applications and network tools straightforward.

This documentation provides comprehensive details on how to integrate, query, and interpret responses from the DNS Lookup API for your network and domain management needs.

Try It Now

Click the button below to run and test this API with Postman:

You can also try the API with Zapier. Accepting this invitation gives you access to an early Beta version of DNS Lookup API Zapier, which is currently in development.

Build on Zapier

Base URL

https://advanced-dns-lookup-api.p.rapidapi.com

All API requests must be made over HTTPS. Requests over plain HTTP will fail. The API requires authentication via RapidAPI credentials in the request headers.

Authentication

To authenticate your requests, include the following headers:

{
  "X-RapidAPI-Key": "YOUR_RAPIDAPI_KEY",
  "X-RapidAPI-Host": "advanced-dns-lookup-api.p.rapidapi.com"
}

You can obtain your API key by subscribing to the DNS Lookup API on RapidAPI. Different subscription tiers offer varying request volumes.

Endpoints

GET /v1/check

Performs a DNS query for a specified domain name or a reverse DNS lookup if an IP address is provided.

Forward Lookup: Provide a name parameter (and optionally a type parameter) to retrieve DNS records for that domain.
Reverse Lookup: Provide an ip parameter to perform a reverse DNS lookup (PTR). In this case, the name parameter is optional. If both ip and name are provided, the API prioritizes the reverse lookup.

Query Parameters
  • ip (optional) - The IP address to perform a reverse DNS lookup.
  • name (required for forward lookup) - The domain name to query.
  • type (optional) - The DNS record type to query (e.g., A, AAAA, MX, TXT, etc.).
    Allowed Values: A, AAAA, TXT, CNAME, MX, NS, SOA, SRV, PTR, HINFO, MINFO, RP, AFSDB, etc.
  • Accept (header, optional) - Specifies that the client expects a JSON-formatted response.
    Value: application/json

Note:
- If no type parameter is provided during a forward lookup, the API automatically performs DNS queries for the default record types: A, AAAA, MX, TXT, SOA, and NS. The results are grouped by record type.
- When an ip parameter is provided, the API performs a reverse DNS lookup and returns PTR records in the same grouped format.

Response Format

Forward Lookup with Specific Record Type

Example Request:

GET /v1/check?name=example.com&type=A HTTP/1.1
Accept: application/json

Example Response (HTTP 200):

{
  "name": "example.com",
  "records": {
    "A": [
      {
        "name": "example.com",
        "TTL": 300,
        "data": "93.184.216.34"
      }
    ]
  }
}
When No Specific Record Type Is Provided

Example Request:

GET /v1/check?name=example.com HTTP/1.1
Accept: application/json

Example Response (HTTP 200):

{
  "name": "example.com",
  "records": {
    "A": [
      {
        "name": "example.com",
        "TTL": 300,
        "data": "93.184.216.34"
      }
    ],
    "AAAA": [
      {
        "name": "example.com",
        "TTL": 300,
        "data": "2606:2800:220:1:248:1893:25c8:1946"
      }
    ],
    "MX": [
      {
        "name": "example.com",
        "TTL": 300,
        "data": "10 mail.example.com."
      }
    ],
    "TXT": [
      {
        "name": "example.com",
        "TTL": 300,
        "data": "v=spf1 include:example.com -all"
      }
    ],
    "SOA": [
      {
        "name": "example.com",
        "TTL": 300,
        "data": "ns1.example.com. hostmaster.example.com. 2023010101 7200 3600 1209600 3600"
      }
    ],
    "NS": [
      {
        "name": "example.com",
        "TTL": 300,
        "data": "ns1.example.com."
      }
    ]
  }
}
Reverse Lookup

Example Request:

GET /v1/check?ip=8.8.8.8 HTTP/1.1
Accept: application/json

Example Response (HTTP 200):

{
  "ip": "8.8.8.8",
  "records": {
    "PTR": [
      {
        "name": "dns.google",
        "TTL": 300,
        "data": "dns.google"
      }
    ]
  }
}
Error Responses

Common error responses you might encounter:

400 Bad Request - Missing required parameter:

{
  "error": "Missing required parameter 'name' for DNS lookup"
}

500 Internal Server Error - DNS lookup failure:

{
  "error": "DNS lookup failed for record type A"
}

Code Examples

JavaScript/Node.js

const axios = require('axios');

const options = {
  method: 'GET',
  url: 'https://advanced-dns-lookup-api.p.rapidapi.com/v1/check',
  params: {name: 'example.com', type: 'A'},
  headers: {
    'X-RapidAPI-Key': 'YOUR_RAPIDAPI_KEY',
    'X-RapidAPI-Host': 'advanced-dns-lookup-api.p.rapidapi.com'
  }
};

try {
  const response = await axios.request(options);
  console.log(response.data);
} catch (error) {
  console.error(error);
}

Python

import requests

url = "https://advanced-dns-lookup-api.p.rapidapi.com/v1/check"

querystring = {"name":"example.com","type":"A"}

headers = {
    "X-RapidAPI-Key": "YOUR_RAPIDAPI_KEY",
    "X-RapidAPI-Host": "advanced-dns-lookup-api.p.rapidapi.com"
}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())

cURL

curl --request GET \
  --url 'https://advanced-dns-lookup-api.p.rapidapi.com/v1/check?name=example.com&type=A' \
  --header 'X-RapidAPI-Key: YOUR_RAPIDAPI_KEY' \
  --header 'X-RapidAPI-Host: advanced-dns-lookup-api.p.rapidapi.com'

Additional Notes

  • TXT Record Formatting:

    TXT record data may be returned with additional quotation marks as part of their DNS encoding. You may choose to strip these quotes in your application if a cleaner presentation is desired.

  • Supported DNS Record Types:

    The API supports querying various DNS record types. If you specify the type parameter, only that record type will be returned. Otherwise, the API returns the default group of record types (A, AAAA, MX, TXT, SOA, and NS).

  • Reverse DNS Lookup Precedence:

    If both ip and name parameters are provided, the API prioritizes the reverse DNS lookup based on the ip parameter.

  • Integration:

    The JSON-formatted responses are designed for seamless integration into web applications, network monitoring tools, and other systems requiring DNS lookup functionality.

Frequently Asked Questions

What DNS record types does the API support?

The Advanced DNS Lookup API supports a wide range of DNS record types including A, AAAA, TXT, CNAME, MX, NS, SOA, SRV, PTR, HINFO, MINFO, RP, AFSDB, and more. If no specific type is requested, the API will return results for A, AAAA, MX, TXT, SOA, and NS records by default.

Can I perform reverse DNS lookups with this API?

Yes, the API supports reverse DNS lookups using the ip parameter. Simply provide an IP address to the endpoint, and the API will return the PTR records associated with that IP. If both ip and name parameters are provided, the API will prioritize the reverse lookup.

What happens if I don't specify a record type?

If you don't specify a record type using the type parameter, the API will automatically perform queries for the default record types: A, AAAA, MX, TXT, SOA, and NS. The results will be grouped by record type in the response.

How do I integrate this API with my application?

The API delivers responses in a clear JSON format, making it easy to integrate with any application. You'll need to sign up for an API key on RapidAPI, then make HTTP requests to the API endpoint with your required parameters. The JSON response can be parsed and used directly in your web applications, network tools, or any system requiring DNS lookup functionality.

Are there any limitations to the free plan?

The free Basic plan includes 1,000 requests per month. All plans have the same features and capabilities; they differ only in the number of allowed monthly requests. If you exceed your plan's limit, you'll need to upgrade to a higher tier or wait until the next billing cycle.

Integrations Coming Soon

Connect our powerful APIs with your favorite platforms for seamless workflow automation

Zapier

Connect with 3,000+ apps

Try it now

Make.com

Create complex automation workflows

Power Automate

Microsoft's enterprise automation

n8n

Open-source workflow automation

Want to see us integrate with your favorite platform? Let us know!