# DNS Records Lookup — Bulk A/MX/TXT/NS/AAAA Scraper (`devilscrapes/dns-records-lookup-scraper`) Actor

Bulk DNS record lookup for any list of domains. Resolves A, AAAA, MX, TXT, NS, CNAME, SOA and CAA records via Cloudflare and Google DNS-over-HTTPS, with automatic fallback between resolvers. One clean row per domain, ready for portfolio monitoring or DNS change detection.

- **URL**: https://apify.com/devilscrapes/dns-records-lookup-scraper.md
- **Developed by:** [DevilScrapes](https://apify.com/devilscrapes) (community)
- **Categories:** Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

<div align="center">
  <img src=".actor/icon.svg" width="160" alt="Devil Scrapes mark" />

## DNS Records Lookup — Bulk A/MX/TXT/NS/AAAA Scraper

**💰 $1.20 / 1 000 results**  ·  pay only for results  ·  no credit card to try

*The devil's in the data — we just make sure it decodes cleanly.* 😈

Bulk DNS record lookup for any list of domains. Resolves A, AAAA, MX, TXT, NS, CNAME, SOA and CAA records via Cloudflare and Google DNS-over-HTTPS, with automatic fallback between resolvers. One clean row per domain, ready for portfolio monitoring or DNS change detection.

</div>

***

### 🎯 What this scrapes

Feed this Actor a list of domains and the DNS record types you care about, and it comes back with one dataset row per domain — every requested record type decoded into a readable string (`MX`, not `15`; `NOERROR`, not `0`), grouped together so you get a full DNS snapshot in a single glance.

- Any domain — apex, subdomain, or a mix
- Standard record types: `A`, `AAAA`, `MX`, `TXT`, `NS`, `CNAME`, `SOA`, `CAA`
- Two independent DNS-over-HTTPS resolvers (Cloudflare + Google), so a query survives either resolver having a bad day

### 🔥 Features

- 🌐 **Two-resolver fallback** — every lookup tries your chosen primary resolver first (Cloudflare or Google) and automatically retries on the other if it errors, times out, or returns something unparsable.
- 🧱 **Per-domain and per-type fault isolation** — one domain's problem never blocks the rest of the batch, and one record type failing never blows up the whole row.
- 🔁 **Retries with backoff** on `408 / 429 / 503` before falling back to the other resolver.
- 🧊 **Clean, typed dataset rows** — Pydantic-validated, decoded type/status strings, ISO-8601 timestamps.
- 📡 **Concurrent per-domain fan-out** — every requested record type for a domain is queried in parallel.
- 💰 **Pay-Per-Event pricing** — you pay only for rows that land. No data, no charge beyond the small actor-start fee.

### 💡 Use cases

- **Domain portfolio monitoring** — run daily against a list of domains you manage and catch unexpected DNS changes.
- **MX record auditing** — verify mail routing configuration across a list of client domains.
- **SPF/DKIM/DMARC visibility** — pull `TXT` records in bulk to check email-authentication posture across a portfolio.
- **Migration verification** — confirm `A`/`AAAA`/`NS` records point where you expect after a DNS cutover.
- **Security research** — bulk-resolve a domain list gathered from another source (e.g. a WHOIS or subdomain-enumeration Actor) and get structured DNS data back.

### ⚙️ How to use it

1. Click **Try for free** at the top of the page.
2. Paste one or more domains into the `domains` field — one per line.
3. Optionally adjust `recordTypes` (defaults to `A, AAAA, MX, TXT, NS`) and pick a `resolver` preference.
4. Click **Start**. Rows stream into the dataset as each domain resolves.
5. Export from **Storage → Dataset** as JSON, CSV, or Excel — or call the Apify API directly.

For recurring monitoring, use Apify Schedules (cron syntax) so the dataset refreshes on your preferred cadence.

### 📥 Input

| Field | Type | Required | Default | Notes |
|---|---|:--:|---|---|
| `domains` | `array` | **yes** | `["github.com", "cloudflare.com"]` | Domains to look up. One per line. |
| `recordTypes` | `array` | no | `["A", "AAAA", "MX", "TXT", "NS"]` | DNS record types to query for every domain. Uppercased automatically. |
| `resolver` | `string` | no | `"cloudflare"` | Primary resolver — `cloudflare` or `google`. The other is used as an automatic fallback. |
| `proxyConfiguration` | `object` | no | `{"useApifyProxy": false}` | Standard Apify Proxy field. Not required for this target's traffic pattern. |

#### Example input

```json
{
  "domains": [
    "github.com",
    "cloudflare.com"
  ],
  "recordTypes": ["A", "AAAA", "MX", "TXT", "NS"],
  "resolver": "cloudflare"
}
```

### 📤 Output

One dataset row per domain, with records grouped by type:

```json
{
  "domain": "github.com",
  "resolver_used": "cloudflare",
  "records": [
    {
      "type": "MX",
      "status": "NOERROR",
      "ttl": 300,
      "data": "0 github-com.mail.protection.outlook.com"
    }
  ],
  "record_types_queried": ["A", "AAAA", "MX", "TXT", "NS"],
  "record_types_failed": [],
  "queried_at": "2026-09-05T12:00:00+00:00"
}
```

- `records` — every decoded answer across every queried type for this domain.
- `record_types_failed` — types where **both** resolvers failed for this domain (a clean NXDOMAIN or empty answer is not a failure and doesn't appear here).

### 💰 Pricing

Pay-Per-Event — you're charged only when the Actor actually does something:

| Event | Price | When |
|---|---|---|
| Actor start | $0.20 | Once per run |
| Result | $0.001 | Once per domain row written to the dataset ($1.20 / 1,000 results incl. the flat start fee) |

No results, no result charge — only the small warm-up fee applies.

### 🚧 Limitations

- No zone-transfer (AXFR) and no DNSSEC validation surfacing beyond what the upstream resolver already returns — this is a lookup tool, not a DNS security auditor.
- No WHOIS lookups and no reverse-DNS (PTR) bulk mode in v1.
- Very large domain lists run sequentially domain-by-domain to keep memory bounded and stream rows as they resolve, so total run time scales roughly linearly with domain count.

### ❓ FAQ

**Does this need an API key?**
No — both upstream resolvers (Cloudflare, Google) are public, keyless DNS-over-HTTPS APIs.

**What happens if a domain doesn't exist?**
You still get a row. `records` will be empty for that domain and `record_types_failed` stays empty too — an NXDOMAIN is a valid answer, not an error.

**What happens if a DNS resolver is temporarily down?**
We retry with backoff, then fall back to the other resolver automatically. Only if both resolvers fail for a given record type does it show up in `record_types_failed`.

**Can I query custom record types?**
Yes — any DNS record type name is accepted in `recordTypes`; numeric types outside the common set decode as `TYPE<n>` rather than crashing the row.

### 🙋 Your feedback

Found a domain or record type this Actor doesn't handle well? Leave a review or open an issue from the Actor's Apify Store page — we read every one and ship fixes fast.

# Actor input Schema

## `domains` (type: `array`):

Domains to look up. One per line. At least one is required.

## `recordTypes` (type: `array`):

DNS record types to query for every domain (e.g. A, MX, TXT). Uppercased automatically.

## `resolver` (type: `string`):

Primary DNS-over-HTTPS resolver. The other resolver is used automatically as a fallback.

## `proxyConfiguration` (type: `object`):

Standard Apify Proxy field. Not required for this target — neither DoH resolver rate-limits or blocks datacenter IPs at typical volume.

## Actor input object example

```json
{
  "domains": [
    "github.com",
    "cloudflare.com"
  ],
  "recordTypes": [
    "A",
    "AAAA",
    "MX",
    "TXT",
    "NS"
  ],
  "resolver": "cloudflare",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `datasetItems` (type: `string`):

All dataset items as JSON.

## `datasetItemsCsv` (type: `string`):

Same data exported to CSV.

## `datasetView` (type: `string`):

Open the run dataset in the Console.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "domains": [
        "github.com",
        "cloudflare.com"
    ],
    "recordTypes": [
        "A",
        "AAAA",
        "MX",
        "TXT",
        "NS"
    ],
    "resolver": "cloudflare",
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("devilscrapes/dns-records-lookup-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "domains": [
        "github.com",
        "cloudflare.com",
    ],
    "recordTypes": [
        "A",
        "AAAA",
        "MX",
        "TXT",
        "NS",
    ],
    "resolver": "cloudflare",
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("devilscrapes/dns-records-lookup-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "domains": [
    "github.com",
    "cloudflare.com"
  ],
  "recordTypes": [
    "A",
    "AAAA",
    "MX",
    "TXT",
    "NS"
  ],
  "resolver": "cloudflare",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call devilscrapes/dns-records-lookup-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,devilscrapes/dns-records-lookup-scraper"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/1E84vZNXjBo0P96pZ/builds/CnOH7A1agKyTM33pm/openapi.json
