# DNS Posture: MX, SPF and DMARC Reader (`luxe_tasks/dns-posture`) Actor

Look up public MX, SPF and DMARC DNS records for a list of exact names and add a plain-language reading. Queries are ordinary unencrypted DNS to Cloudflare. This reads public DNS text; it is not a security assessment or a guarantee about mail delivery.

- **URL**: https://apify.com/luxe_tasks/dns-posture.md
- **Developed by:** [Luxe Tasks](https://apify.com/luxe_tasks) (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

from $0.50 / 1,000 domain lookups

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 Posture: MX, SPF and DMARC Reader

Look up **public** MX, SPF and DMARC DNS records for a list of domains and add a plain-language reading of the published policies.

This Actor reads public DNS text. It is **not** a security assessment, penetration test, mailbox verifier, or a guarantee that mail will be delivered or blocked. A timeout or server failure means a record is unknown, not that it is absent. Unusual or changing published text can produce a false reading.

### What you get

For each unique domain, as an **exact-name** query (not an apex rollup and not an organizational-domain conclusion):

- MX records (priority and exchange), including a note when a null MX is published
- A **partial** SPF reading of `v=spf1` text at the queried name, with split TXT strings joined, common mechanisms, the `all` qualifier, a top-level include count, and an **estimate** of lookup-causing terms against the RFC 7208 limit of 10 (nested `include` / `redirect` lookups are not fetched; this is not a full SPF validation)
- Multiple `v=spf1` records marked as a permanent error
- The `_dmarc.<name>` record when a single valid policy is present (`p`, `sp`, `pct`, and whether `rua` / `ruf` addresses are present). More than one DMARC record, or a record without a valid `p`, is not treated as a policy. Organizational-domain fallback (RFC 7489 section 6.6.3) is not performed.
- A short plain-language policy reading

Saved rows use the normalized domain. Path and query from a pasted URL are dropped. Raw published SPF or DMARC text may still include reporting addresses that the domain owner published.

### Input

- `domains`: domain names to look up (up to 1,000). You may paste hosts or full URLs; the scheme, port, path and query are stripped before the lookup. A leading `www.` label is **kept**, because `www.example.com` and `example.com` are different DNS names; the result describes that exact name only.
- Duplicates after that normalization are skipped and do not add a domain-lookup event; the $0.005 start fee still applies when the run starts.
- Invalid strings (empty values, IP addresses, reserved names such as `localhost`) are recorded as skipped rows and do not add a domain-lookup event; the $0.005 start fee still applies when the run starts.
- Maximum 1,000 unique domains per run. Concurrency is fixed at 50 (it is not an input field) so a 1,000-name worst-case lookup fits the 300 second run timeout. Each DNS query uses a 2 second timeout and one try per nameserver, with fallback from 1.1.1.1 to 1.0.0.1 only on timeout or a transport error.
- If the input object is empty, or `domains` is omitted or an empty list, the Actor looks up `example.com`, `google.com` and `cloudflare.com`. Prepaid usage for that fallback is $0.0005 per saved domain result plus a $0.005 start fee (the per-run minimum); for those three names that is $0.0065 plus any platform compute and storage. A malformed `domains` value, including null, or a top-level array is refused and no domain-lookup event is applied; the $0.005 start fee still applies if the platform starts the run.

### Pricing (prepaid usage)

Prepaid usage is **$0.0005 per `domain-lookup`** (one saved result for each valid unique domain, including rows where the resolver failed, such as NXDOMAIN, SERVFAIL, timeout, or unknown (truncated/unreadable); unknown rows are billed $0.0005 each, plus the $0.005 start fee per run at the fixed 256 MB size; not one DNS query and not only successful answers); that start fee is the per-run minimum.

The synthetic `apify-default-dataset-item` event is not part of this Actor's pricing. That is **$0.50 per 1,000 domains**, plus the start fee. A run that cannot start because of invalid input or unsafe pricing still incurs the start fee when the platform applies it.

Saved result rows store the normalized domain (scheme, path and query are dropped). Skipped or duplicate rows store only that sanitized host form, not the original URL path or query. Progress is persisted on the platform persistState event (including migration), at the end of the run, and at most every 50 processed domains — not after every domain. On a restart of the same run, names already present in this run's default dataset are skipped: they are not saved again and no further domain-lookup event is applied for them. That is not a cross-run guarantee, and if the dataset cannot be read the run stops instead of guessing. A crash after a dataset save and before the matching charge call leaves that saved row without a domain-lookup event (this favors the user).

### Resolvers

Lookups use a small UDP-only DNS client (not Node's `dns.promises.Resolver`, and with no TCP fallback) against Cloudflare `1.1.1.1` and `1.0.0.1`. Each query is an ordinary unencrypted DNS datagram on port 53, sent to a third party, with EDNS0 advertising a 1232-byte UDP payload. The client reads one datagram per query and drops any packet that is larger than 1232 bytes or whose ID, question, or source address and port do not match. A truncated (TC) answer, an oversized datagram, or a malformed answer is reported as unknown (truncated/unreadable), never as “no SPF” or “no DMARC”: very large published records can therefore come back as unknown. If `1.1.1.1` times out or cannot be reached, the same query is sent once to `1.0.0.1`; a DNS error or unreadable answer from the first server is not retried on the second. Do not submit confidential or internal names. See [Cloudflare's public DNS resolver privacy documentation](https://developers.cloudflare.com/1.1.1.1/privacy/public-dns-resolver/). No API key is required. Custom resolver addresses are not accepted. This Actor does not state how long any platform storage keeps your dataset.

### Example

```json
{
  "domains": ["example.com", "google.com", "cloudflare.com"]
}
```

### Limitations

- Nested SPF includes are not followed; the lookup-limit figure is an estimate from the top-level record only.
- TXT strings that arrive as multiple chunks are joined; unusual encodings may still fail to parse.
- Resolver failures, truncated or oversized answers and rate limits are reported on the row rather than retried without bound. Because there is no TCP fallback, a record that does not fit in a 1232-byte UDP response is unknown, not treated as absent.
- Results describe published records at lookup time and can change.
- DMARC is read only at `_dmarc.<exact-name>`; parent-domain fallback is not performed.

### Support

Open an issue on the Actor's page in Apify Store.

# Actor input Schema

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

Domain names to look up (up to 1,000). You may paste hosts or full URLs; the scheme, port, path and query are stripped and are not saved. A leading www. label is kept, because www.example.com and example.com are different DNS names; each result is an exact-name query, not an apex or organizational-domain conclusion. Duplicates after normalization are skipped and do not add a domain-lookup event. If this list is omitted or empty, the Actor looks up example.com, google.com and cloudflare.com. Prepaid usage for that fallback is $0.0005 per saved domain result plus a $0.005 start fee (the per-run minimum); for those three names that is $0.0065 plus any platform compute and storage. A malformed domains value, including null, is refused and no domain-lookup event is applied. Do not submit confidential or internal names.

## `maxDomains` (type: `integer`):

Upper bound on unique domains processed in this run.

## `timeoutMs` (type: `integer`):

Timeout in milliseconds for each DNS query (default 2000). The resolver uses one try per nameserver and falls back from 1.1.1.1 to 1.0.0.1 only on a timeout or transport error.

## Actor input object example

```json
{
  "domains": [
    "example.com",
    "google.com",
    "cloudflare.com"
  ],
  "maxDomains": 1000,
  "timeoutMs": 2000
}
```

# Actor output Schema

## `domainResults` (type: `string`):

Saved domain rows from the default dataset.

# 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",
        "google.com",
        "cloudflare.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("luxe_tasks/dns-posture").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",
        "google.com",
        "cloudflare.com",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("luxe_tasks/dns-posture").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",
    "google.com",
    "cloudflare.com"
  ]
}' |
apify call luxe_tasks/dns-posture --silent --output-dataset

```

## MCP server setup

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

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/ohDcH2Gqg6dL1N6uO/builds/6prTGkxMeowGCsuHc/openapi.json
