# Sitemap URL Validator (`extezzu/sitemap-url-validator`) Actor

Reads a site's sitemap(s) and checks every URL: HTTP status, redirects, noindex, canonical mismatches, robots.txt blocks and slow pages. Polite, robots.txt-aware.

- **URL**: https://apify.com/extezzu/sitemap-url-validator.md
- **Developed by:** [Dmytro Volodymyrovych](https://apify.com/extezzu) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.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 URL Validator: Find Broken, Redirected & Noindex URLs in Your Sitemap

Your XML sitemap should only list pages that return **200**, are **indexable** and are the **canonical version**. This Actor reads a site's sitemap (including sitemap indexes and `.gz` files), checks each URL and tells you exactly which ones to fix. It is polite by design: low concurrency, a clear user agent and **robots.txt is respected**.

### What it checks for each sitemap URL

- HTTP status (404, 410, 5xx) and **redirect chains** (it follows up to 5 hops and reports the count)
- **`noindex`** in the meta robots tag or the `X-Robots-Tag` header while the URL sits in your sitemap
- **Canonical mismatch**: canonical tag points to a different URL
- Missing `<title>`
- Slow responses (configurable threshold)
- URLs **blocked by robots.txt** (reported, not fetched)
- Non-HTTPS URLs in the sitemap
- `lastmod` from the sitemap is returned alongside, so you can spot stale entries

Each row gets `severity` (`ok`, `warning`, `error`) and an `issues` array of codes. A summary with issue counts per code is saved to the key-value store as `OUTPUT`.

### Use cases

- Technical SEO audits and post-migration QA
- Weekly monitoring: schedule the Actor and alert on new errors
- Agencies: attach a clean sitemap health report to client work
- Finding "zombie" URLs after a CMS or e-commerce catalogue clean-up

Only check websites you own or have permission to test.

### Input example

```json
{
  "sites": ["https://example.com/", "https://example.org/sitemap.xml"],
  "maxUrlsPerSite": 30,
  "maxUrlsTotal": 60,
  "slowThresholdMs": 1500,
  "onlyReportProblems": false
}
```

Give either a home page (the Actor reads `robots.txt` for `Sitemap:` lines, falling back to `/sitemap.xml`) or a direct sitemap URL.

### Output example

```json
{
  "site": "https://example.com",
  "url": "https://example.com/old-page",
  "lastmodInSitemap": "2026-01-15",
  "httpStatus": 404,
  "redirectCount": 0,
  "noindex": true,
  "responseTimeMs": 97,
  "severity": "error",
  "issues": ["http-404", "noindex-in-sitemap"]
}
```

### Pricing (pay per event)

- **$2.00 per 1,000 URLs checked** (event `url-checked`, $0.002 each)
- URLs skipped because robots.txt disallows them, URLs on other hosts, and URLs that could not be fetched at all (DNS error, timeout, connection refused) are **free**. A 404 or 500 answer is a completed check and is charged.
- `maxUrlsPerSite` and `maxUrlsTotal` (plus the Console's max-cost-per-run setting) keep every run predictable.

### Safety limits

- Only URLs on the **same host** as the site you give are checked (sitemap entries pointing elsewhere are skipped), so the Actor cannot be pointed at third-party servers through a crafted sitemap.
- Localhost, private network and cloud-metadata addresses are refused; only http(s) is supported.
- Concurrency is capped at 10 (default 3), every worker waits at least 300 ms between requests, and robots.txt `Crawl-delay` (max 10 s) is honoured by forcing one request at a time. Max 50 sites, 5,000 URLs per site and 20,000 per run.
- If robots.txt answers with a 5xx error the site is treated as disallowed until it recovers.

### Notes

- Pages are fetched with a plain HTTP GET (no JavaScript rendering), reading only the first ~300 KB of HTML.
- Robots.txt handling uses the generic `*` group (`Allow`, `Disallow`, `*`, `$`, `Crawl-delay`). Redirect targets are not re-checked against robots.txt.
- If no sitemap URL can be read the run fails with a clear message and is not charged.
- No logins, no bypassing of protections, no personal data collected.

# Actor input Schema

## `sites` (type: `array`):

Website home pages (https://example.com) or direct sitemap URLs (https://example.com/sitemap.xml), up to 50. For a home page the Actor reads robots.txt for Sitemap: entries and falls back to /sitemap.xml. Only URLs on the same host as the site are checked. Only check websites you own or are allowed to test.

## `maxUrlsPerSite` (type: `integer`):

Maximum number of sitemap URLs to check per site (a cost safeguard).

## `maxUrlsTotal` (type: `integer`):

Maximum number of URLs checked across the whole run.

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

Skip fetching pages that robots.txt disallows for generic crawlers (User-agent: \*). They are reported as 'blocked-by-robots-txt' and are not charged. Keep this enabled unless you own the site.

## `slowThresholdMs` (type: `integer`):

Flag pages that take longer than this to respond.

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

Parallel requests per site (max 10). Each worker also waits at least 300 ms between requests, and robots.txt Crawl-delay is honoured, so the load on a target stays low.

## `onlyReportProblems` (type: `boolean`):

Skip clean URLs in the dataset (they are still counted in the summary). Charging still applies per URL checked.

## Actor input object example

```json
{
  "sites": [
    "https://crawlee.dev"
  ],
  "maxUrlsPerSite": 100,
  "maxUrlsTotal": 500,
  "respectRobotsTxt": true,
  "slowThresholdMs": 2000,
  "concurrency": 3,
  "onlyReportProblems": false
}
```

# Actor output Schema

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

One row per checked item, in the default dataset.

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

Totals and counts for the run (OUTPUT record in the key-value store).

# 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 = {
    "sites": [
        "https://crawlee.dev"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("extezzu/sitemap-url-validator").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 = { "sites": ["https://crawlee.dev"] }

# Run the Actor and wait for it to finish
run = client.actor("extezzu/sitemap-url-validator").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 '{
  "sites": [
    "https://crawlee.dev"
  ]
}' |
apify call extezzu/sitemap-url-validator --silent --output-dataset

```

## MCP server setup

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

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/edawaG5GlZyNeZMYK/builds/AoHk7M1yvTBr7c7v9/openapi.json
