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

Bulk DNS lookup for domains, URLs, email addresses and IPs over DNS-over-HTTPS. Get A, AAAA, CNAME, MX, NS, TXT, SOA, CAA and PTR records plus SPF, DMARC, MTA-STS and DKIM checks. Missing or invalid domains are free.

- **URL**: https://apify.com/joesimo/dns-lookup.md
- **Developed by:** [Joe Simo](https://apify.com/joesimo) (community)
- **Categories:** Developer tools, Lead generation, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.00 / 1,000 domains

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?

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 Lookup: Bulk A, MX, TXT, SPF and DMARC Records

Look up DNS records for a list of domains in one run and get one clean row per domain. Paste domains, website URLs, email addresses or IP addresses. Each domain comes back with its A, AAAA, CNAME, MX, NS, TXT, SOA and CAA records, the mail provider behind its MX records, and an email security check: SPF (with the full include tree and the 10-lookup limit), DMARC policy and report addresses, MTA-STS, TLS-RPT and optional DKIM selectors. IP addresses get reverse DNS (PTR) with a forward check.

Lookups go over DNS-over-HTTPS to Google Public DNS, with Cloudflare 1.1.1.1 as an automatic fallback. No login, no API key, no proxy, no browser.

Empty input runs a demo on apify.com, github.com, stripe.com, wikipedia.org and 1.1.1.1, so you can try it from the Store without filling in a form.

**$0.001 per domain or IP with records** ($1.00 per 1,000). Domains that do not exist (NXDOMAIN), names with no records, lookups that fail and invalid lines are saved as free status rows.

### What you get

Each paid row has `status: ok` and:

- `domain` (normalized, punycode for international names), `input` (the line you gave)
- `a`, `aaaa`, `ips`, `cname`
- `mx` as `{priority, exchange}` sorted by priority, plus `mailProvider` (Google Workspace, Microsoft 365, Proofpoint, Mimecast, Zoho Mail, Cisco Secure Email and 15 more)
- `ns`, `txt` (split strings joined), `soa` (primary name server, serial, timers), `caa` (`{flags, tag, value}`)
- `ttl` (lowest TTL per record type), `dnssecValidated` (the resolver's AD flag), `rcode`
- `email.spf`: record, `all` qualifier and its meaning, includes, ip4 and ip6 ranges, `dnsLookups` counted across the whole include tree, `tooManyLookups` (over 10 is a permerror for receivers), `includeTree`, errors
- `email.dmarc`: policy, subdomain policy, pct, `rua` and `ruf` report addresses, DKIM and SPF alignment
- `email.mtaSts`, `email.tlsRpt`, `email.dkim` (selector, key type, approximate key size, revoked)
- `email.security`: a grade (`strong`, `partial`, `weak`, `none`, `no_mail`) and a list of plain issues such as "DMARC policy is p=none (monitor only)" or "SPF needs 12 DNS lookups (limit is 10)"

IP rows have `ip`, `ptr`, `reverseName` and `forwardConfirmed` (the PTR name resolves back to the same IP).

### How to run it

| Goal | Input |
| --- | --- |
| Records for a list of domains | `"domains": ["stripe.com", "shopify.com", "notion.so"]` |
| Domains from a lead list of emails or URLs | `"domains": ["jane@acme.com", "https://www.acme.com/about"]` |
| Only mail records | `"recordTypes": ["MX", "TXT"]` |
| Check DKIM | `"dkimSelectors": ["google", "selector1"]` or `"checkCommonDkimSelectors": true` |
| Reverse DNS | `"domains": ["8.8.8.8", "2606:4700:4700::1111"]` |
| Plain records, no email checks | `"emailChecks": false` |
| Ask Cloudflare first | `"resolver": "cloudflare"` |

Hostnames are looked up as given: `www.github.com` returns the www records (a CNAME to github.com), so use `github.com` for the apex domain and its mail setup. Email addresses and URLs are reduced to their domain or hostname. Duplicates are checked and charged once.

### Good uses

- Email deliverability audits: find clients or prospects with no DMARC, `p=none`, `+all` or an SPF record over the 10-lookup limit.
- Lead enrichment: tag a list of company domains with their mail provider (Google Workspace vs Microsoft 365 vs a security gateway).
- Domain portfolio and migration checks: confirm A, MX and NS records after a DNS move, or watch CAA and TTLs.
- Security reviews: list which certificate authorities a domain allows and whether DNSSEC validates.
- Weekly monitoring with an Apify schedule, sent to Google Sheets, Slack or a webhook.

### How it works

- Every query is a DNS-over-HTTPS JSON request to `dns.google` (or `cloudflare-dns.com` if you pick it). If a request times out or returns an error, it is retried once and then sent to the other resolver.
- Each domain takes about 8 queries for the default record types plus 3 to 10 for the email checks. Identical queries in one run (for example `_spf.google.com`, which many domains include) are answered from a run cache.
- A is always queried, because it is what separates a missing domain (NXDOMAIN, free) from a domain that exists.
- Tested on Apify on Nov 9, 2026 at 256 MB: 99 well known domains plus 15 common DKIM selectors each took 2,761 DNS queries and 3.7 seconds of lookup time (4.7 s run). 91 graded `strong`, 8 `partial`, 3 had SPF over the 10-lookup limit, and 88 had at least one DKIM key among the common selectors.
- The Actor only reads public DNS. It does not send email, does not connect to mail servers and does not do WHOIS.

### Pricing

| Event | Price | When it is charged |
| --- | --- | --- |
| `domain` | $0.001 | One domain or IP row with `status: ok` |
| (free) | $0 | `not_found`, `empty`, `failed`, `invalid_input` |

Examples: the 5-target demo costs $0.005. An audit of 1,000 client domains costs $1.00. Email checks and DKIM selectors add no charge. Apify keeps 20% of pay-per-event revenue as its commission.

### Input example

```json
{
  "domains": ["stripe.com", "jane@acme.com", "https://www.shopify.com", "8.8.8.8"],
  "recordTypes": ["A", "AAAA", "MX", "NS", "TXT", "CAA"],
  "emailChecks": true,
  "dkimSelectors": ["google", "s1"]
}
```

### Output example

Real row from Nov 9, 2026 (`"domains": ["stripe.com"]`, types A, MX, NS, CAA, DKIM selector s1), trimmed:

```json
{
  "input": "stripe.com",
  "domain": "stripe.com",
  "status": "ok",
  "a": ["198.137.150.41", "198.202.176.41"],
  "mx": [
    { "priority": 10, "exchange": "aspmx.l.google.com" },
    { "priority": 20, "exchange": "alt1.aspmx.l.google.com" }
  ],
  "mailProvider": "Google Workspace",
  "ns": ["ns-705.awsdns-24.net", "ns-1882.awsdns-43.co.uk", "ns-423.awsdns-52.com", "ns-1087.awsdns-07.org"],
  "caa": [{ "flags": 0, "tag": "issue", "value": "digicert.com" }],
  "ttl": { "A": 30, "MX": 19183, "NS": 21591, "CAA": 980 },
  "dnssecValidated": false,
  "email": {
    "hasMx": true,
    "spf": {
      "record": "v=spf1 ip4:198.2.180.60/32 ip4:13.111.2.227/32 include:spf1.stripe.com include:greenhouse-outbound-mail.stripe.com include:_spf.qualtrics.com ~all",
      "all": "~",
      "allMeaning": "softfail (~all)",
      "includes": ["spf1.stripe.com", "greenhouse-outbound-mail.stripe.com", "_spf.qualtrics.com"],
      "dnsLookups": 7,
      "tooManyLookups": false
    },
    "dmarc": {
      "policy": "reject",
      "pct": 100,
      "rua": ["mailto:dmarc-reports@stripe.com"],
      "adkim": "r",
      "aspf": "r"
    },
    "mtaSts": null,
    "dkim": [{ "selector": "s1", "keyType": "rsa", "approxKeyBits": 1024, "revoked": false }],
    "security": { "grade": "strong", "issues": [] }
  },
  "rcode": "NOERROR",
  "checkedAt": "2026-11-10T00:46:41.779Z"
}
```

The OUTPUT record in the key-value store has a run summary: counts per status, DNS requests, which resolver answered, retries and the stop reason.

### Limits and notes

- DNS answers come from a public resolver cache, so a record changed in the last few minutes may still show the old value until its TTL runs out.
- DKIM selectors cannot be listed from DNS. A domain with no match among the selectors you give may still sign mail with another selector.
- `mailProvider` is a guess from MX host names. Domains behind a security gateway (Proofpoint, Mimecast) show the gateway, not the mailbox host.
- The SPF lookup count follows include and redirect. It does not expand `a` and `mx` targets, which matches how the 10-lookup limit is counted.
- Up to 50 domains run in parallel (default 10). The public resolvers rate limit very heavy use; failed lookups are retried, sent to the other resolver, and reported as free `failed` rows if both refuse.

### Integrations and API

Run it from the Apify API, a schedule, Make, Zapier, n8n, Google Sheets, webhooks or the Apify MCP server. Results are a standard Apify dataset (JSON, CSV, Excel, XML). Use the Overview view for a flat table and the Email security view for SPF and DMARC details.

### FAQ

**Is this a WHOIS tool?** No. It reads DNS records only. Registrar, owner and expiry data are not included.

**Does it verify email addresses?** No. It checks a domain's mail setup (MX, SPF, DMARC). To check single addresses, use an email validator.

**Why is my domain `not_found`?** The resolver answered NXDOMAIN: the name does not exist in DNS. These rows are free.

**Which resolver should I use?** Google is the default. Cloudflare gives the same answers for almost every domain. With the fallback on, a failing resolver is skipped automatically.

**Can I check subdomains?** Yes. Any hostname works, including names like `_dmarc.example.com` or `_sip._tcp.example.com` (pick SRV).

# Actor input Schema

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

One per line. Domains (stripe.com), hostnames (www.stripe.com), URLs (https://stripe.com/pricing), email addresses (billing@stripe.com) and IPv4 or IPv6 addresses (reverse DNS) all work. Duplicates are checked once. Leave empty for a 5-target demo.

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

DNS record types to look up for each domain. A is always included because it tells a missing domain apart from an empty one. SRV only makes sense on names like \_sip.\_tcp.example.com.

## `emailChecks` (type: `boolean`):

Parse SPF (with include tree and the 10-lookup limit), DMARC policy and report addresses, MTA-STS and TLS-RPT, guess the mail provider from MX, and give a short grade with plain issues. Adds 3 to 10 DNS queries per domain at no extra charge.

## `dkimSelectors` (type: `array`):

Optional DKIM selectors to test, such as google, selector1, s1. Each found key is listed with its type and approximate size.

## `checkCommonDkimSelectors` (type: `boolean`):

Tries google, selector1, selector2, default, k1, k2, s1, s2, dkim, mail, smtp, mandrill, everlytickey1, zoho and protonmail. DKIM selectors cannot be listed from DNS, so a miss here does not prove DKIM is off.

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

Public DNS-over-HTTPS resolver to ask first.

## `fallbackResolver` (type: `boolean`):

If the first resolver times out or returns an error, ask the other one.

## `maxItems` (type: `integer`):

Stop after this many domains with records. 0 means no cap (the run still stops at your maximum cost per run).

## `maxConcurrency` (type: `integer`):

How many domains are checked at the same time.

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

Timeout for one DNS-over-HTTPS request. Each failed request is retried once, then sent to the fallback resolver.

## Actor input object example

```json
{
  "domains": [
    "apify.com",
    "github.com",
    "stripe.com",
    "wikipedia.org",
    "1.1.1.1"
  ],
  "recordTypes": [
    "A",
    "AAAA",
    "CNAME",
    "MX",
    "NS",
    "TXT",
    "SOA",
    "CAA"
  ],
  "emailChecks": true,
  "dkimSelectors": [],
  "checkCommonDkimSelectors": false,
  "resolver": "google",
  "fallbackResolver": true,
  "maxItems": 0,
  "maxConcurrency": 10,
  "timeoutSecs": 10
}
```

# Actor output Schema

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

One item per domain or IP, plus free status rows for missing, empty, failed or invalid inputs.

## `runSummary` (type: `string`):

JSON summary: counts per status, DNS requests, resolver used, stop reason.

# 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": [
        "apify.com",
        "github.com",
        "stripe.com",
        "wikipedia.org",
        "1.1.1.1"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("joesimo/dns-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": [
        "apify.com",
        "github.com",
        "stripe.com",
        "wikipedia.org",
        "1.1.1.1",
    ] }

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

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,joesimo/dns-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/UGhFheybLkzOyJrK2/builds/yblzEcK0dpLP80Kbf/openapi.json
