# XML Sitemap Health Validator (`maximedupre/sitemap-validator`) Actor

Validate XML sitemaps and sitemap indexes. Check listed URLs for HTTP status, redirects, response time, errors, and sitemap metadata.

- **URL**: https://apify.com/maximedupre/sitemap-validator.md
- **Developed by:** [Maxime Dupré](https://apify.com/maximedupre) (community)
- **Categories:** SEO tools, Developer tools
- **Stats:** 1 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.90 / 1,000 checked urls

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

### 🗺️ Check sitemap URLs and find errors

Sitemap Validator is for SEO teams, developers, and site owners. It reads public sitemaps, checks each listed URL, and returns HTTP status, redirects, response time, sitemap metadata, and clear issue details.

- Use **[Sitemap Validator](https://apify.com/maximedupre/sitemap-validator/examples/sitemap-validator)** to check the URLs in a public sitemap.
- Use **[XML Sitemap Validator](https://apify.com/maximedupre/sitemap-validator/examples/xml-sitemap-validator)** to read and validate an XML sitemap.
- Use **[Sitemap Index Validator](https://apify.com/maximedupre/sitemap-validator/examples/sitemap-index-validator)** to follow child sitemaps in a sitemap index.
- Use **[Broken Sitemap Links Checker](https://apify.com/maximedupre/sitemap-validator/examples/broken-sitemap-links-checker)** to find client errors, server errors, timeouts, and network errors.
- Use **[Sitemap Redirect Checker](https://apify.com/maximedupre/sitemap-validator/examples/sitemap-redirect-checker)** to find redirects and see their final URLs.
- Use **[Sitemap Response Time Checker](https://apify.com/maximedupre/sitemap-validator/examples/sitemap-response-time-checker)** to compare the check time for listed URLs.
- Use **[Robots.txt Sitemap Validator](https://apify.com/maximedupre/sitemap-validator/examples/robots-txt-sitemap-validator)** to find declared sitemaps and check their listed URLs.

#### 📊 Returned data

Each saved row is one checked sitemap-listed URL. It includes the page and source sitemap, HTTP health, redirects, response time, sitemap metadata, and issue details. The Actor also saves a JSON report with totals for sitemap health and page issues.

The Actor saves the first eligible occurrence of a listed URL. If the same URL appears again, it is ignored.

#### 🚀 Running the Actor

1. Open the Input tab.
2. Add one or more public sitemap URLs, sitemap-index URLs, website roots, bare domains, or `robots.txt` URLs.
3. Set `Maximum URLs to check` to limit checks across all targets, or leave it empty to return all available results until the source is exhausted.
4. Set `Maximum index depth` to control how many sitemap-index levels are followed. Use `0` to stay at the submitted or directly found sitemap.
5. Run the Actor and open the dataset or JSON report.

The Actor reads XML URL sets, XML sitemap indexes, plain-text sitemaps, and gzip-compressed sitemap responses. It does not crawl unlisted pages, inspect page content, generate or submit sitemaps, or check search-engine indexation.

#### ✍️ Input

| Field | Type | What it does |
|---|---|---|
| `targets` | array of strings | Adds 1–100 public sitemap, sitemap-index, website, domain, or `robots.txt` targets. Each value must use HTTP or HTTPS. |
| `maxCheckedUrls` | integer | Stops after this many sitemap-listed URLs across all targets. Leave it empty to return all available results until the source is exhausted. |
| `maxIndexDepth` | integer | Sets how many nested sitemap-index levels to follow, from 0 to 10. Use `0` to check only the submitted sitemap. |

This example is the default input from a successful Actor run:

```json
{
  "targets": [
    "https://apify.com/sitemap.xml"
  ],
  "maxCheckedUrls": 5,
  "maxIndexDepth": 2
}
```

Targets must be public. No source-site login or API key is needed.

#### 📦 Output

The dataset has one row for each sitemap-listed URL checked by the run.

| Field | Type | What it does |
|---|---|---|
| `pageUrl` | string | URL listed in the sitemap. |
| `host` | string | Host from the listed page URL. |
| `sourceSitemapUrl` | string | Sitemap file that listed the page URL. |
| `parentSitemapIndexUrl` | string or null | Parent sitemap index, or `null` when the source sitemap was added or found directly. |
| `indexDepth` | integer | Depth below the added or found sitemap target. |
| `sitemapLastmod` | string or null | Listed last-modified value, when set. |
| `changefreq` | string or null | Listed change frequency, when set. |
| `priority` | number or null | Listed priority, when set. |
| `urlStatus` | string | `ok`, `redirect`, `broken`, `timeout`, `unreachable`, or `malformed`. |
| `httpStatus` | integer or null | HTTP response status, when a response was received. |
| `finalUrl` | string or null | Final URL after redirects, when reached. |
| `redirectCount` | integer | Number of redirects followed. |
| `responseTimeMs` | integer or null | Check time in milliseconds, when a request finished. |
| `issue` | object or null | Issue details, or `null` for a healthy URL. |
| `issue.category` | string | `redirect`, `client_error`, `server_error`, `timeout`, `malformed_url`, or `network_error`. |
| `issue.message` | string | Short reason for the issue. |

Here is a full row from a successful run:

```json
{
  "pageUrl": "https://apify.com/",
  "host": "apify.com",
  "sourceSitemapUrl": "https://apify.com/sitemap/pages.xml",
  "parentSitemapIndexUrl": "https://apify.com/sitemap.xml",
  "indexDepth": 1,
  "sitemapLastmod": null,
  "changefreq": null,
  "priority": null,
  "urlStatus": "ok",
  "httpStatus": 200,
  "finalUrl": "https://apify.com/",
  "redirectCount": 0,
  "responseTimeMs": 631,
  "issue": null
}
```

The `Validation report` link opens a JSON report with sitemap checks and totals for sitemap health and page issues. HTTP facts show what the Actor saw during the run and may change later.

#### 💳 Pricing

This Actor uses pay-per-event pricing. You are charged for each sitemap-listed URL checked and saved to the dataset. Invalid targets, unreachable sitemap files, empty sitemaps, and runs with no saved rows do not create this charge.

#### 🔌 Integrations

Use the dataset with the Apify API, schedules, webhooks, and available Apify integrations. You can also export it as JSON, CSV, Excel, XML, RSS, or HTML.

https://www.youtube.com/watch?v=bNACk1\_S\_6w\&list=PLObrtcm1Kw6MUrlLNDbK9QRg8VDJg0gOW\&index=4

#### ❓ FAQ

##### Why did my run save no rows?

The target may not have a public sitemap, the sitemap may be empty, or the file may not have been reachable during the run. These cases are logged and skipped.

##### What happens when the same listed URL appears more than once?

The first eligible occurrence is saved. Later copies are ignored, so one row does not gather every sitemap or target that also contained the URL.

##### Can it validate a sitemap index?

Yes. It follows child sitemap files up to `Maximum index depth`.

##### Does it validate XML online?

It validates supported public sitemap XML. It is not a general XML validator for other XML document types.

##### Can it crawl my whole website?

No. It checks URLs found in supported sitemap files. Use Website URL Crawler when you need a rendered link crawl.

##### Does it show whether Google indexed a URL?

No. It reports sitemap and HTTP facts, not search-engine indexation.

### 📝 Changelog

- 0.1: Added a JSON validation report with sitemap health, format, size, entry, and issue totals.
- 0.0: Initial release.

### 🆘 Support

For issues, questions, or feature requests, [file a ticket](https://console.apify.com/actors/maximedupre~sitemap-validator/issues) and I'll fix or implement it in less than 24h 🫡

### 🔗 Related Actors

- [Sitemap Sniffer](https://apify.com/maximedupre/sitemap-sniffer) — find public sitemap files and export their URL inventory before checking URL health.
- [Website URL Crawler & Link Extractor](https://apify.com/maximedupre/website-url-crawler) — build a website map from rendered links and public sitemaps.
- [Schema Markup Validator](https://apify.com/maximedupre/schema-markup-validator) — check structured data on the pages listed in a sitemap.
- [SSL Certificate Checker](https://apify.com/maximedupre/ssl-certificate-checker) — check certificate and TLS details for public HTTPS endpoints.
- [Robots.txt Generator](https://apify.com/maximedupre/robots-txt-generator) — create a `robots.txt` file with sitemap directives.

**Made with ❤️ by Maxime Dupré**

# Actor input Schema

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

Add the public sitemaps, sitemap indexes, websites, domains, or robots.txt URLs to validate.

## `maxCheckedUrls` (type: `integer`):

Stop after this many sitemap-listed URLs across all targets. Leave it empty to check all URLs found before the sitemaps end.

## `maxIndexDepth` (type: `integer`):

Set how many nested sitemap-index levels to follow. Use 0 to check only the submitted sitemap.

## Actor input object example

```json
{
  "targets": [
    "https://apify.com/sitemap.xml"
  ],
  "maxCheckedUrls": 5,
  "maxIndexDepth": 2
}
```

# Actor output Schema

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

Open the dataset. It has one row for each sitemap-listed URL checked by the run.

## `report` (type: `string`):

Open the JSON report. It has sitemap checks and totals for sitemap health and page issues.

# 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://apify.com/sitemap.xml"
    ],
    "maxCheckedUrls": 5,
    "maxIndexDepth": 2
};

// Run the Actor and wait for it to finish
const run = await client.actor("maximedupre/sitemap-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 = {
    "targets": ["https://apify.com/sitemap.xml"],
    "maxCheckedUrls": 5,
    "maxIndexDepth": 2,
}

# Run the Actor and wait for it to finish
run = client.actor("maximedupre/sitemap-validator").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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://apify.com/sitemap.xml"
  ],
  "maxCheckedUrls": 5,
  "maxIndexDepth": 2
}' |
apify call maximedupre/sitemap-validator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=maximedupre/sitemap-validator",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/cKeQAtREobiMCcJFy/builds/yOZaFRD1qe3s8V7cU/openapi.json
