# Diff XML Sitemaps & Audit Broken Links and Redirects

**Use case:** 

Recursively parse XML/.xml.gz sitemaps, detect added or removed URLs via Watch Mode, and flag 404/5xx errors and redirect chains at 512 MB.

## Input

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

## Output

```json
{
  "url": {
    "label": "URL",
    "format": "string"
  },
  "sitemapDiffStatus": {
    "label": "Sitemap Diff",
    "format": "string"
  },
  "httpStatus": {
    "label": "HTTP",
    "format": "integer"
  },
  "redirectChainCount": {
    "label": "Redirects",
    "format": "integer"
  },
  "tlsVersion": {
    "label": "TLS",
    "format": "string"
  },
  "tlsDaysRemaining": {
    "label": "Cert Days Left",
    "format": "integer"
  },
  "securityHeadersGrade": {
    "label": "Sec Grade",
    "format": "string"
  },
  "securityHeadersScore": {
    "label": "Sec Score",
    "format": "integer"
  },
  "isBroken": {
    "label": "Broken",
    "format": "boolean"
  },
  "wafBlocked": {
    "label": "WAF Blocked",
    "format": "boolean"
  },
  "auditedAt": {
    "label": "Audited At",
    "format": "string"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The Sitemap Diff, Crawl Health & Security Header Audit Actor is ready to run with the inputs already set for "Diff XML Sitemaps & Audit Broken Links and Redirects". [Sign up or log in](https://console.apify.com/create-task-from-example/wCLrRcSwhDNiAvJNo) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Diff XML Sitemaps & Audit Broken Links and Redirects" task

The Sitemap Diff, Crawl Health & Security Header Audit Actor will start running based on the input automatically. You can also change all the input fields, like domains or sitemap urls, audit mode, and more, to match your specific use case.

### 3. Receive the "Diff XML Sitemaps & Audit Broken Links and Redirects" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as URL, sitemap diff, HTTP, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Diff XML Sitemaps & Audit Broken Links and Redirects" task via API](https://apify.com/structmint/sitemap-diff-crawl-security-audit.md).

## FAQ

### What happens when a watched sitemap has not changed?

With watchMode=true and onlyChanges=true, unchanged sitemaps emit 0 dataset items so only the $0.00005 start fee applies and downstream alerts stay quiet.

### Does it handle nested sitemap index files and .xml.gz?

Yes. It discovers sitemaps from robots.txt or explicit XML URLs, recursively expands sitemapindex trees, and decompresses .xml.gz sitemaps automatically.

## About this Actor

This example demonstrates how to use [Sitemap Diff, Crawl Health & Security Header Audit](https://apify.com/structmint/sitemap-diff-crawl-security-audit.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/structmint/sitemap-diff-crawl-security-audit.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

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 full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/structmint/sitemap-diff-crawl-security-audit.md

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`).
