# Domain Health Audit: SPF, DMARC, SSL & Security Headers Score (`lightdata-tools/domain-health-audit`) Actor

Bulk audit of domains: SPF, DMARC, DKIM, MX, SSL expiry, security headers, security.txt. One 0-100 score and a prioritized fix list per domain.

- **URL**: https://apify.com/lightdata-tools/domain-health-audit.md
- **Developed by:** [LightData Tools](https://apify.com/lightdata-tools) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

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

## Domain Health Audit: Email Auth, SSL & Security Headers Score

**Demo video:** https://youtu.be/Q213CkcVlkM

Paste a list of domains and get a 0-100 score, an A-F grade and a fix list sorted by impact for each one. Built for agencies, IT teams and cold-email senders who need to audit many domains fast.

### What it checks

- **SPF**: present, one record only, ends in ~all/-all, follows redirect=, counts DNS lookups (limit 10).
- **DMARC**: policy (none/quarantine/reject), pct, rua reporting. Subdomains inherit the parent domain policy, as the standard says.
- **DKIM**: tries about 30 common selectors plus yours. Selectors are private, so "not detected" means unknown, never "missing". DKIM does not change the score.
- **MX records**, **SSL certificate** (expiry, invalid, self-signed), **security headers** (HSTS, CSP, X-Frame-Options, nosniff, Referrer-Policy), **security.txt**.

Only public DNS and HTTPS requests. No logins, no private data.

### Input

```json
{ "domains": ["example.com", "yourclient.com"], "dkimSelectors": ["mycustom"], "concurrency": 20, "timeoutSecs": 8 }
```

Up to 100,000 domains per run (default cap 10,000). Duplicates are removed.

### Output

One dataset row per domain: `domain, score, grade, topIssue, issues[], mx, spf, dmarc, dmarcPolicy, dkimStatus, dkimSelectorsFound, sslDaysLeft, securityHeaders, securityTxt`.
Export from the Console in **JSON, CSV, Excel, XML or HTML**, or use the API. Each run also saves `REPORT.csv` (one row per domain with all fixes), `REPORT.md` (readable fix report, worst domains first) and `SUMMARY` (grade counts) in the key-value store.

### How the score works

Starts at 100. Penalties: no DMARC -20, SSL problem -20, no SPF -15, SPF/DMARC weak -10, missing HSTS -5, and smaller ones for other headers. Grades: A 90+, B 80+, C 70+, D 55+, F below. Every deduction is listed in `issues` so nothing is hidden. A site with no MX is not penalised for having no mail server, but missing SPF/DMARC on it is still flagged because parked domains are commonly spoofed.

### API

```bash
curl -X POST "https://api.apify.com/v2/acts/USERNAME~domain-health-audit/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" -d '{"domains":["example.com"]}'
```

```js
import { ApifyClient } from 'apify-client';
const run = await new ApifyClient({ token: 'YOUR_TOKEN' }).actor('USERNAME/domain-health-audit').call({ domains: ['example.com'] });
```

```python
from apify_client import ApifyClient
run = ApifyClient('YOUR_TOKEN').actor('USERNAME/domain-health-audit').call(run_input={'domains': ['example.com']})
items = ApifyClient('YOUR_TOKEN').dataset(run['defaultDatasetId']).list_items().items
```

CSV: `https://api.apify.com/v2/datasets/DATASET_ID/items?format=csv&token=YOUR_TOKEN`

### Limits

Results are a snapshot of public DNS/HTTPS at run time. A domain behind aggressive bot protection may show headers differently. This is an audit aid, not a penetration test.

# Actor input Schema

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

Domains to audit, e.g. example.com (no https://).

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

Optional. Your DKIM selector(s) (see s= in a DKIM-Signature header). About 30 common selectors are always tried. If none match we report 'not detected', never 'missing'.

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

Timeout for each DNS/HTTPS check, in seconds. Raise it for slow sites.

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

Domains audited at once (max 50).

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

Safety cap for very large lists.

## Actor input object example

```json
{
  "domains": [
    "example.com",
    "github.com"
  ],
  "timeoutSecs": 8,
  "concurrency": 20,
  "maxDomains": 10000
}
```

# Actor output Schema

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

No description

## `reportCsv` (type: `string`):

No description

## `reportMd` (type: `string`):

No description

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

// Run the Actor and wait for it to finish
const run = await client.actor("lightdata-tools/domain-health-audit").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",
        "github.com",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("lightdata-tools/domain-health-audit").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",
    "github.com"
  ]
}' |
apify call lightdata-tools/domain-health-audit --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,lightdata-tools/domain-health-audit"
        }
    }
}
```

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/katu8ka4a9BmDfIvY/builds/zhw4RuRBSby5W55vb/openapi.json
