# Sitemap Broken Link, Canonical & Redirect Checker (`sadis/sitemap-canonical-redirect-auditor`) Actor

Audit XML sitemaps and URL lists fast without browser overhead ($3/1k URLs): traces 301/302/307/308 redirect chains, detects loops, canonical mismatches, noindex directives & 4xx/5xx errors.

- **URL**: https://apify.com/sadis/sitemap-canonical-redirect-auditor.md
- **Developed by:** [Cipiwon Daisuki](https://apify.com/sadis) (community)
- **Categories:** SEO tools, Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 url checkeds

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

## Sitemap Broken Link, Canonical & Redirect Checker (`$3 / 1,000`)

Audit every URL in an XML sitemap (including nested `<sitemapindex>` files) or custom URL list using lightweight HTTP-only requests at **`$3.00 per 1,000 URLs` (`$0.003 / URL`)**. Traces full `301`/`302`/`307`/`308` redirect chains, detects redirect loops, catches `4xx`/`5xx` broken links, checks `<link rel="canonical">` mismatches, and flags accidental `noindex` directives.

Built for technical SEOs, site migration QA teams, and developers searching for **`sitemap url`**, **`broken link checker`**, **`redirect chain checker`**, and **`canonical audit`**.

***

### Why Use This Actor?

- **🗺️ Recursive Sitemap Index Support:** Parses standard `<urlset>` and nested `<sitemapindex>` XML files automatically.
- **🔁 Full Hop-by-Hop Redirect Tracing:** Captures every intermediate hop (`from`, `status`, `to`), detects circular redirect loops, and flags multi-hop chains.
- **🔍 Canonical & `noindex` Hygiene:** Inspects both HTML `<link rel="canonical">` / `<meta name="robots">` and HTTP `X-Robots-Tag` headers.
- **📄 CSV + Summary Exports:** Outputs `SUMMARY.json` and `AUDIT_REPORT.csv` alongside structured JSON dataset records.

***

### Input Example ("Try Me" Default)

```json
{
  "sitemapUrl": "",
  "urls": [
    "https://apify.com/",
    "http://apify.com/",
    "https://apify.com/non-existent-audit-test-404"
  ],
  "maxUrls": 10,
  "maxRedirectHops": 10,
  "concurrency": 8
}
```

#### Free Plan vs. Paid Apify Plan

| Tier | Max URLs Per Run | Outputs Included |
| :--- | :---: | :--- |
| **Free Apify Plan (Demo)** | Up to **10 URLs** | Full dataset + `SUMMARY.json` + `AUDIT_REPORT.csv` |
| **Paid Apify Plan** | Up to **500 URLs** | Deep sitemap index crawl & full CSV audit (`$3 / 1,000 URLs`) |

***

### Output Sample JSON

Verified live output from tracing `http://apify.com/`:

```json
{
  "inputUrl": "http://apify.com/",
  "finalUrl": "https://apify.com/",
  "initialStatus": 301,
  "finalStatus": 200,
  "hopCount": 1,
  "redirectChain": [
    {
      "from": "http://apify.com/",
      "status": 301,
      "to": "https://apify.com/"
    }
  ],
  "hasRedirectLoop": false,
  "canonicalUrl": "https://apify.com/",
  "canonicalMatch": true,
  "isNoIndex": false,
  "healthStatus": "REDIRECT_WARNING",
  "issues": ["single_hop_redirect"]
}
```

Every record is classified with an explicit `healthStatus` (`HEALTHY`, `REDIRECT_WARNING`, `NOINDEX_WARNING`, `CANONICAL_MISMATCH`, `BROKEN_4XX`, `ERROR_5XX`, `REDIRECT_LOOP`, or `NETWORK_ERROR`) and aggregated in `SUMMARY.json` + `AUDIT_REPORT.csv`.

***

### Pay-Per-Event (PPE) Pricing

| Event | Price | When Charged |
| --- | :---: | --- |
| `url-checked` | **`$0.003`** | Once per URL traced (**`$3.00` per 1,000 URLs**) |

***

### 🤖 Use with AI Agents (MCP), n8n & REST API

```bash
curl -X POST "https://api.apify.com/v2/acts/sadis~sitemap-canonical-redirect-auditor/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"sitemapUrl":"https://apify.com/sitemap.xml","maxUrls":100}'
```

***

### FAQ

**Q: Does this Actor support nested WordPress, Shopify, or Yoast `<sitemapindex>` XML files?**\
A: Yes. When `sitemapUrl` points to a `<sitemapindex>`, the Actor recursively expands child sitemaps (up to 3 levels deep) and decodes `<![CDATA[...]]>` and `&amp;` entities before tracing each URL up to `maxUrls`.

**Q: How does `maxRedirectHops` work?**\
A: `maxRedirectHops` is the exact maximum number of redirect hops followed before stopping. For example, setting `maxRedirectHops: 1` cleanly follows a 1-hop `301 -> 200` redirect and inspects the final destination's canonical and `noindex` directives, while flagging any 2+ hop chain with `exceeded_max_redirect_hops`.

**Q: How are `200 OK` pages with `noindex` reported?**\
A: Direct `200 OK` pages containing `<meta name="robots" content="noindex">`, `<meta name="googlebot" content="noindex">`, or an HTTP `X-Robots-Tag: noindex` header receive `healthStatus: "NOINDEX_WARNING"` (counted under `noindexWarnings` in `SUMMARY.json`), keeping indexing warnings cleanly separated from redirect warnings.

**Q: Why was my Free-plan run capped at 10 URLs?**\
A: Free Apify accounts include a 10-URL demo cap per run so you can test the full JSON dataset, `SUMMARY.json`, and `AUDIT_REPORT.csv` output at `$0`. Paid Apify plans unlock up to 500 URLs per run at `$3.00 / 1,000 URLs`.

***

### More Technical Audit Tools by `@sadis`

Explore the complete `@sadis` developer & SEO hygiene suite on Apify Store:

- **[AI Search (GEO / AEO), `llms.txt` & Markdown Generator](https://apify.com/sadis/geo-llms-ai-readiness-auditor)** — Audit AI crawler policies (`GPTBot`, `ClaudeBot`, `PerplexityBot`), validate JSON-LD, and generate ready-to-deploy `llms.txt` & `llms-full.txt` bundles (`$0.01/page`).
- **[WCAG 2.2 & EU EAA Accessibility Auditor (`EN 301 549`)](https://apify.com/sadis/wcag-eaa-accessibility-auditor)** — Real Chromium + `axe-core` accessibility audits mapped to `EN 301 549` clauses with Markdown & CSV remediation exports (`$0.05/page`).
- **[Bulk Email Verifier & MX / SPF / DMARC Validator](https://apify.com/sadis/bulk-email-mx-dmarc-validator)** — Zero-browser DNS MX, SPF, DMARC, role-based, and disposable email list hygiene (`$0.80 / 1,000 emails`).
- **[Sitemap Broken Link, Canonical & Redirect Checker](https://apify.com/sadis/sitemap-canonical-redirect-auditor)** — Recursive XML sitemap & URL redirect-chain tracer detecting loops, 4xx/5xx errors, canonical mismatches, and `noindex` issues (`$3.00 / 1,000 URLs`).

# Actor input Schema

## `sitemapUrl` (type: `string`):

Optional XML sitemap or nested <sitemapindex> URL (e.g., https://apify.com/sitemap.xml).

## `urls` (type: `array`):

List of URLs to trace redirects, HTTP status codes, canonical tags, and noindex flags.

## `maxUrls` (type: `integer`):

Maximum total URLs to audit from sitemap + URL list (up to 500 on paid Apify plans; Free plan runs are capped at 10 URLs as a demo).

## `maxRedirectHops` (type: `integer`):

Maximum redirects followed per URL before flagging excessive chain/loop (1 to 20).

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

Number of URLs audited concurrently (1 to 25).

## Actor input object example

```json
{
  "sitemapUrl": "",
  "urls": [
    "https://apify.com/",
    "http://apify.com/",
    "https://apify.com/non-existent-audit-test-404"
  ],
  "maxUrls": 10,
  "maxRedirectHops": 10,
  "concurrency": 8
}
```

# Actor output Schema

## `urls` (type: `string`):

No description

## `summary` (type: `string`):

No description

## `reportCsv` (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 = {
    "sitemapUrl": "",
    "urls": [
        "https://apify.com/",
        "http://apify.com/",
        "https://apify.com/non-existent-audit-test-404"
    ],
    "maxUrls": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("sadis/sitemap-canonical-redirect-auditor").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 = {
    "sitemapUrl": "",
    "urls": [
        "https://apify.com/",
        "http://apify.com/",
        "https://apify.com/non-existent-audit-test-404",
    ],
    "maxUrls": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("sadis/sitemap-canonical-redirect-auditor").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 '{
  "sitemapUrl": "",
  "urls": [
    "https://apify.com/",
    "http://apify.com/",
    "https://apify.com/non-existent-audit-test-404"
  ],
  "maxUrls": 10
}' |
apify call sadis/sitemap-canonical-redirect-auditor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,sadis/sitemap-canonical-redirect-auditor"
        }
    }
}
```

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/gFolmwmuZq458fMs5/builds/H30Nf7IpZ813z3WBq/openapi.json
