# Sitemap Diff, Crawl Health & Security Header Audit (`structmint/sitemap-diff-crawl-security-audit`) Actor

Recursive XML sitemap diffing, HTTP redirect/404 crawl health, TLS certificate expiry, OWASP security headers, and technical SEO tags at 512 MB.

- **URL**: https://apify.com/structmint/sitemap-diff-crawl-security-audit.md
- **Developed by:** [StructMint](https://apify.com/structmint) (community)
- **Categories:** SEO tools, Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 audited urls

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

## Sitemap Diff, Crawl Health & Security Header Audit

Recursively expand **XML sitemaps** (including `<sitemapindex>`, `.xml.gz`, and `robots.txt` discovery), diff URL additions/removals/`lastmod` updates across scheduled runs, and run a fast pure-HTTP audit covering **redirect chains**, **404/5xx crawl health**, **TLS certificate expiry**, **6 OWASP HTTP security headers**, and **canonical / robots meta / JSON-LD tags** — all inside a lightweight **512 MB** container under `LIMITED_PERMISSIONS`.

Zero browser overhead, zero proxy fees, and zero personal data (public technical infrastructure telemetry only).

### Key Capabilities

- **Recursive XML Sitemap & Index Discovery:** Reads `robots.txt` `Sitemap:` declarations or `/sitemap.xml`, expands nested `<sitemapindex>` trees and `.xml.gz` files, and respects wildcard `robots.txt` `Disallow:` rules.
- **Stateful Sitemap Diff Watch Mode (`watchMode: true`):** Persists complete sitemap URL inventories in your own user-scoped Named Key-Value Store (`structmint-sitemap-audit-v1`, 90-day retention) and classifies entries as `ADDED`, `REMOVED`, `LASTMOD_CHANGED`, or `PRESENT`. When `onlyChanges: true` and nothing changed, the run emits **0 dataset items**.
- **Complete-Scan Baseline Integrity:** If sitemap discovery hits depth or file ceilings (`discoveryComplete: false`), `REMOVED` alerts are suppressed and existing complete baselines are never overwritten.
- **Pure-HTTP Crawl, TLS & OWASP Security Audit:** Checks redirect hops (`301`/`302`/`307`/`308`), HTTP `404`/`5xx` status, TTFB latency, native TLS protocol version + X.509 certificate days remaining, 6 OWASP headers (`Strict-Transport-Security`, `Content-Security-Policy`, `X-Content-Type-Options`, `X-Frame-Options`, `Referrer-Policy`, `Permissions-Policy`) graded `A`–`F`, plus `<link rel="canonical">`, `<meta name="robots">`, `hreflang` count, and JSON-LD `@type` arrays.
- **Honest WAF Handling:** Never attempts to bypass bot challenges; returns `wafBlocked: true` transparently on `HTTP 403`/`429` or challenge responses.

### Pricing (Pay-Per-Event)

Billed strictly through Apify Pay-Per-Event with one primary unit (**1 audited URL = 1 dataset item**):

| Event | FREE | BRONZE | SILVER | GOLD | PLATINUM | DIAMOND |
| :--- | ---: | ---: | ---: | ---: | ---: | ---: |
| `apify-actor-start` *(one-time per run)* | `$0.00005` | `$0.00005` | `$0.00005` | `$0.00005` | `$0.00005` | `$0.00005` |
| `apify-default-dataset-item` *(per audited URL)* | `$0.0045` | `$0.0040` | `$0.0035` | `$0.0030` | `$0.0030` | `$0.0030` |

- **Minimum configurable max charge (`minimalMaxTotalChargeUsd`):** `$0.01`.
- **Unchanged Watch runs:** When `watchMode: true` and `onlyChanges: true` find zero sitemap changes, **0 dataset items** are emitted (only `$0.00005` start applies).
- **Tier safety caps:** Free accounts audit up to `2` domains / `25` URLs per run; paid accounts audit up to `15` domains / `500` URLs per run.

### Privacy & Security

- Public HTTP/HTTPS domains only; localhost, loopback, link-local, and private network IPs are rejected on initial targets and every redirect hop.
- Extracts exclusively public technical infrastructure signals (`httpStatus`, `tlsDaysRemaining`, `securityHeadersGrade`, `canonicalUrl`, `jsonLdTypes`) — zero WHOIS owner details or personal contact fields.

### Example Input

```json
{
  "targets": ["https://docs.apify.com/sitemap.xml"],
  "mode": "full_audit",
  "watchMode": true,
  "onlyChanges": true,
  "watchStateKey": "docs-weekly-audit",
  "maxUrlsToAudit": 25,
  "respectRobotsTxt": true,
  "checkTls": true,
  "extractSeo": true
}
```

### n8n & Make Quickstart

```text
POST https://api.apify.com/v2/actors/structmint~sitemap-diff-crawl-security-audit/run-sync-get-dataset-items?maxTotalChargeUsd=0.10
```

Schedule weekly in n8n or Make with `watchMode: true` and `onlyChanges: true` to alert Slack or Jira whenever new/removed sitemap URLs, broken `404`s, missing OWASP headers, or expiring TLS certificates appear.

# Actor input Schema

## `targets` (type: `array`):

Public domains (e.g. 'docs.apify.com'), homepage URLs, or direct XML/.xml.gz sitemap URLs to discover and audit. Private/localhost IPs are blocked. Free tier audits up to 2 targets / 25 URLs per run; paid tiers up to 15 targets / 500 URLs.

## `mode` (type: `string`):

'full_audit' checks HTTP status, redirect chains, TLS expiry, 6 OWASP security headers, canonical, meta robots, and JSON-LD types on each URL; 'sitemap_only' parses XML sitemap URLs and diffs without fetching HTML.

## `watchMode` (type: `boolean`):

Persists complete sitemap URL inventories in a user-scoped Named Key-Value Store (90-day retention) and detects ADDED, REMOVED, and LASTMOD_CHANGED entries across scheduled runs.

## `onlyChanges` (type: `boolean`):

Used with watchMode=true. Emits 0 dataset items when no URLs were added, removed, or updated since the last complete scan.

## `watchStateKey` (type: `string`):

Stable namespace isolating saved sitemap baselines for a recurring schedule.

## `maxUrlsToAudit` (type: `integer`):

Upper limit on emitted URL records per run (Free tier capped at 25; paid tiers up to 500).

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

Parallel HTTP inspection workers (1 to 10).

## `respectRobotsTxt` (type: `boolean`):

Checks each site's robots.txt wildcard Disallow/Allow rules before auditing HTML pages.

## `checkTls` (type: `boolean`):

Runs a lightweight native TLS handshake per HTTPS host to report TLS version, issuer, and days remaining until expiration.

## `extractSeo` (type: `boolean`):

Parses page title, canonical self-reference check, robots meta tag, hreflang count, and JSON-LD @type list from HTML.

## Actor input object example

```json
{
  "targets": [
    "https://docs.apify.com/sitemap.xml"
  ],
  "mode": "full_audit",
  "watchMode": false,
  "onlyChanges": true,
  "watchStateKey": "default-sitemap-watch",
  "maxUrlsToAudit": 10,
  "concurrency": 6,
  "respectRobotsTxt": true,
  "checkTls": true,
  "extractSeo": true
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `summary` (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 = {
    "targets": [
        "https://docs.apify.com/sitemap.xml"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("structmint/sitemap-diff-crawl-security-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 = { "targets": ["https://docs.apify.com/sitemap.xml"] }

# Run the Actor and wait for it to finish
run = client.actor("structmint/sitemap-diff-crawl-security-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 '{
  "targets": [
    "https://docs.apify.com/sitemap.xml"
  ]
}' |
apify call structmint/sitemap-diff-crawl-security-audit --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,structmint/sitemap-diff-crawl-security-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/u8StvQkYnAGlyasrz/builds/PwC0DvhWijZeuJGA7/openapi.json
