# DNS Records Lookup: Bulk A, MX, TXT, SPF, DMARC (`ucchiii/dns-records-lookup`) Actor

Bulk DNS lookup for up to 2,000 domains over DNS-over-HTTPS (Cloudflare, Google): A, AAAA, CNAME, MX, NS, TXT, SOA, CAA, SRV plus SPF, DMARC, DNSSEC flag. Empty input = free demo. $0.50 per 1,000 domains.

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

## Pricing

from $0.35 / 1,000 domain resolveds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## DNS Records Lookup — bulk A, AAAA, MX, NS, TXT, SPF, DMARC and more for a list of domains

**For anyone who has to check DNS for many domains and is tired of running `dig` one name at a time:** IT and migration teams, email deliverability and security people checking SPF / DMARC, agencies that manage client domains, SEO and brand-protection teams. Give this Actor up to 2,000 domains (or a dataset) and get **one flat row per domain: A, AAAA, CNAME, MX, NS, TXT, SOA, CAA and SRV records, the SPF and DMARC policy lines, a "has mail server" flag and the DNSSEC flag**.
No scraping, no proxies, no API keys: it asks the public **DNS-over-HTTPS JSON APIs of Cloudflare and Google** and falls back to the other one when one fails.

**Try it free: leave input empty and press Start** (four example domains, not charged, rows carry `_demo: true`).

### Sample output

(Made-up placeholder values that show the shape of the rows.)

| domain | status | a | mx | spfRecord | dmarcRecord | hasMx | dnssec | resolver |
|---|---|---|---|---|---|---|---|---|
| example.com | ok | 192.0.2.10 | 10 mail.example.com | v=spf1 include:\_spf.example.net ~all | v=DMARC1; p=reject | true | true | cloudflare |
| no-such-name.example | nxdomain |  |  |  |  | false | false | cloudflare |

### Price

**$0.50 per 1,000 domains** ($0.0005 each; 1,000 domains cost $0.50, the full 2,000-domain cap costs $1). You pay only for domains that were **resolved**: records came back, or the resolver answered NXDOMAIN (a clear "this name does not exist" answer is a result). Failed lookups, invalid input and the demo are free. The price is the same for one record type or nine. Set a maximum charge per run to cap spend; the Actor stops cleanly when it is reached.

### What it does

- **Nine record types, your choice**: A, AAAA, CNAME, MX (as `"10 mail.example.com"`, sorted by priority), NS, TXT (long records joined), SOA, CAA, SRV. Default: A, AAAA, MX, NS, TXT.
- **Email helpers**: `spfRecord` (the TXT starting with `v=spf1`), `dmarcRecord` (from `_dmarc.<domain>`, can be switched off), `hasMx` (false for a null MX `0 .`).
- **DNSSEC flag**: `dnssec` is the resolver's AD ("authenticated data") flag: `true` when the answers were DNSSEC-validated.
- **Two output formats**: one flat row per domain (a list per type), or one row per DNS record with `domain`, `type`, `name`, `ttl`, `value`.
- **Messy input is fine**: `https://WWW.Example.com/page?x=1` becomes `www.example.com`, internationalized names become punycode, duplicates are removed, typos come back as an `error` row with `invalid_domain` (free). Hostnames and service names such as `_sip._tcp.example.com` work too.
- **Polite and robust**: default 5 domains in parallel (max 10), a minimum gap between requests to the same resolver, timeouts, up to 3 retries with backoff (honours `Retry-After`), then the other resolver is asked. One failing domain never stops the run.

### Input example

```json
{
  "domains": ["example.com", "python.org", "https://www.github.com/"],
  "recordTypes": ["A", "AAAA", "MX", "NS", "TXT"],
  "includeDmarc": true,
  "outputMode": "perDomain",
  "dnsResolver": "cloudflare",
  "concurrency": 5
}
```

Or point it at a dataset of another Actor with `datasetId` and `domainField`.

### Output

One row per domain (`outputMode: perDomain`). Lists appear only for the record types you chose; `spfRecord` needs TXT, `hasMx` needs MX.

```json
{
  "domain": "example.com",
  "status": "ok",
  "a": ["192.0.2.9", "192.0.2.10"],
  "aaaa": ["2001:db8::1"],
  "mx": ["10 mx1.example.com", "20 mx2.example.com"],
  "ns": ["ns1.example.net", "ns2.example.net"],
  "txt": ["v=spf1 include:_spf.example.net ~all"],
  "spfRecord": "v=spf1 include:_spf.example.net ~all",
  "dmarcRecord": "v=DMARC1; p=reject; rua=mailto:dmarc@example.com",
  "hasMx": true,
  "dnssec": true,
  "resolver": "cloudflare",
  "error": null,
  "checkedAt": "2026-10-24T09:00:00Z"
}
```

With `outputMode: perRecord` every record is a row: `{"domain": "example.com", "type": "MX", "name": "example.com", "ttl": 3600, "value": "10 mx1.example.com", "status": "ok", "resolver": "cloudflare"}`. The DMARC record is a TXT row named `_dmarc.example.com`. A name without any record, NXDOMAIN or an error still gets one row with `type` and `value` empty.

| status | meaning | charged |
|---|---|---|
| `ok` | all questions were answered (a name can be `ok` with an empty list: it exists but has no such record) | yes |
| `nxdomain` | the resolver says the name does not exist | yes |
| `error` | a lookup failed after retries and the fallback resolver (see `error`, e.g. `mx:dns_http_503`), or the input is not a valid domain (`invalid_domain`) | no |

If one question of a domain fails, the whole row is `error` (the records that did arrive are still shown) so that you never mistake a failure for "no record". Run those domains again. The record `SUMMARY` in the key-value store counts each status and the charged domains.

### Use cases

- Check SPF and DMARC for a client or supplier list before a deliverability audit
- Find domains with no mail server (`hasMx: false`) or with old MX / NS records before a migration
- Export every record with TTL (`perRecord`) to diff against a zone file
- Spot dangling CNAMEs and missing CAA records across a portfolio
- Enrich a domain list from another scraper with IPs, nameservers and mail providers

### Limits (cannot be raised by input)

- 2,000 domains per run (extra names are ignored with a log warning); up to 10 in parallel
- At most as many connections to one resolver as your concurrency setting, at least 0.05 s between requests to the same resolver
- Each request has a timeout (default 10 s, max 60 s) and is retried at most 3 times per resolver
- The answers are those of Cloudflare's and Google's public resolvers, which cache; TTLs shown are the remaining TTL and can differ between calls. Both resolvers apply their own rate limits; heavy runs may see `error` rows, which are free
- `dnssec` shows whether the resolver validated the answers, not whether the domain's registrar has the right DS record

### FAQ

**Which resolver answers?** The one you choose first (default Cloudflare); if it fails the other one. Each row says which one in `resolver`.
**Why is a subdomain without records `ok` with an empty list?** DNS answers "no data" for that type. NXDOMAIN is only when the name does not exist at all.
**How do I get SRV records?** Add SRV to the types and give the full service name, e.g. `_sip._tcp.example.com`. DKIM works the same way with TXT: give `selector._domainkey.example.com`.
**Does it return WHOIS or registrar data?** No. This Actor is DNS only.

### More tools from the same developer

- [Domain WHOIS & DNS Lookup](https://apify.com/ucchiii/domain-whois) — bulk WHOIS (RDAP) and DNS lookup: registrar, expiry, days left, A/MX/NS, no personal data
- [Domain Availability Checker](https://apify.com/ucchiii/domain-availability-checker) — bulk domain availability check via RDAP: registered or likely available
- [Website Technology Detector](https://apify.com/ucchiii/website-technology-detector) — tech stack of websites in bulk: CMS, frameworks, analytics and tag IDs, CDN, consent tools
- [Bulk URL Status Checker](https://apify.com/ucchiii/url-status-checker) — bulk HTTP status and redirect-chain checker for URL lists

# Actor input Schema

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

Names to look up, one per entry, e.g. 'example.com' or 'mail.example.com'. URLs ('https://www.example.com/page') are cut down to the host name; internationalized names (münchen.de) are converted to punycode. For SRV records give the full service name, e.g. '\_sip.\_tcp.example.com'. Duplicates are removed. Leave empty (and no dataset) to run a free demo (not charged). Up to 2,000 names per run.

## `datasetId` (type: `string`):

Optional. Dataset ID (a finished run's 'defaultDatasetId', e.g. 'WkzbQMuFYuamGv3YF') whose items contain domain names or URLs, for example the output of another Actor. Added to the domains above. The 2,000-name cap applies to the total.

## `domainField` (type: `string`):

Name of the field in each dataset item that holds the domain or URL. Default 'domain'.

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

Which DNS record types to look up for every name. Each type is one question to the resolver. Default: A, AAAA, MX, NS, TXT. The price per domain is the same whatever you pick. The SPF helper field (spfRecord) needs TXT.

## `includeDmarc` (type: `boolean`):

Also read the TXT record at \_dmarc.<domain> and return the policy line as dmarcRecord (empty when the domain has none). Adds one question per domain.

## `outputMode` (type: `string`):

One flat row per domain is best for spreadsheets and CRMs. One row per record gives every record with its TTL; a name with no records, NXDOMAIN or an error still gets one row (type empty). Charging is per domain in both modes.

## `dnsResolver` (type: `string`):

Which public DNS-over-HTTPS JSON API is asked first. If it fails after retries, the other one is asked automatically; the row's 'resolver' field says which one answered.

## `timeoutSecs` (type: `integer`):

Timeout for each request, in seconds. Failed requests are retried up to 3 times with a growing pause before the other resolver is tried. Allowed range 1 to 60 (default 10).

## `concurrency` (type: `integer`):

How many domains are looked up in parallel. Allowed range 1 to 10 (default 5). That is also the maximum number of connections to one resolver at a time, with at least 0.05 s between requests to the same resolver.

## Actor input object example

```json
{
  "domains": [
    "example.com",
    "python.org",
    "github.com"
  ],
  "domainField": "domain",
  "recordTypes": [
    "A",
    "AAAA",
    "MX",
    "NS",
    "TXT"
  ],
  "includeDmarc": true,
  "outputMode": "perDomain",
  "dnsResolver": "cloudflare",
  "timeoutSecs": 10,
  "concurrency": 5
}
```

# Actor output Schema

## `results` (type: `string`):

One row per domain (or one row per record, if chosen) in the default dataset: record lists per type, SPF and DMARC policy lines, DNSSEC flag, resolver and status. Download as CSV, JSON, Excel and more from here.

## `summary` (type: `string`):

Record SUMMARY: how many domains were ok, NXDOMAIN, invalid or failed, and how many were charged.

# 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": [
        "example.com",
        "python.org",
        "github.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ucchiii/dns-records-lookup").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": [
        "example.com",
        "python.org",
        "github.com",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("ucchiii/dns-records-lookup").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": [
    "example.com",
    "python.org",
    "github.com"
  ]
}' |
apify call ucchiii/dns-records-lookup --silent --output-dataset

```

## MCP server setup

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

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/koh6QFra9PHmqXUjc/builds/KLrjNQ99z7nlfGbpR/openapi.json
