# XML Sitemap Validator (`automation-lab/xml-sitemap-validator`) Actor

Validate public XML sitemaps and sitemap indexes. Export syntax, nesting, duplicate and malformed locations, page HTTP status, redirects, response times, and aggregate health records.

- **URL**: https://apify.com/automation-lab/xml-sitemap-validator.md
- **Developed by:** [Stas Persiianenko](https://apify.com/automation-lab) (community)
- **Categories:** SEO tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.43 / 1,000 audit-record extracteds

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/running/actors-in-store.md#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

## XML Sitemap Validator

Validate public XML sitemap and sitemap-index URLs, check listed pages, and export machine-readable file, URL, and aggregate health records. This **xml sitemap validator** is built for recurring technical SEO audits rather than a one-off green/red badge.

It reports XML syntax, standard namespace use, nesting, malformed and duplicate locations, invalid metadata, cross-host locations, HTTP status, redirects, response time, and aggregate healthy/warning/broken counts.

### What does XML Sitemap Validator do?

1. Downloads each supplied public sitemap.
2. Validates well-formed XML and a supported `urlset` or `sitemapindex` root.
3. Follows nested sitemap indexes within your limits.
4. validates `loc`, `lastmod`, `changefreq`, and `priority` values.
5. Optionally requests listed pages and records status, redirect destination, and response time.
6. Saves typed `sitemap`, `url`, and `summary` records to the default dataset.

The Actor does not generate a sitemap, submit one to a search engine, crawl pages that are absent from the sitemap, or decide whether a URL is indexed.

### Who is this sitemap audit for?

- Technical SEO teams checking releases and migrations.
- Agencies auditing client sitemap health on a schedule.
- Site-reliability teams monitoring broken sitemap locations.
- Developers validating CMS sitemap changes in a pipeline.
- Data teams exporting repeatable sitemap findings to a warehouse.

### Why use this Actor?

A browser-based validator is useful for one URL. This Actor turns the audit into structured records that can be filtered, compared, scheduled, sent to webhooks, or consumed through the Apify API. Limits are explicit, duplicate locations remain visible, nested-file provenance is preserved, and deterministic issue codes simplify automation.

### Validation checks

| Area | Findings |
| --- | --- |
| XML | malformed XML, unsupported roots, missing standard namespace |
| File limits | empty sitemap, excessive entry count, excessive size |
| Location | malformed URL, duplicate URL, cross-host URL |
| Metadata | invalid `lastmod`, `changefreq`, or `priority` |
| Nesting | bounded sitemap-index depth and document count |
| HTTP | request failure, timeout, HTTP error, or redirect |

### Input parameters

| Field | Type | Default | Meaning |
| --- | --- | ---: | --- |
| `startUrls` | array | required | Public HTTP(S) sitemap or sitemap-index URLs |
| `maxUrls` | integer | 20 | Maximum URL entries checked across the run |
| `maxSitemaps` | integer | 50 | Maximum XML documents fetched |
| `maxDepth` | integer | 5 | Maximum nested index depth |
| `checkUrlStatus` | boolean | true | Whether listed page URLs are requested |
| `requestTimeoutSecs` | integer | 20 | Per-request timeout |
| `maxRetries` | integer | 2 | Retries for transient network, 429, and 5xx failures |

Only anonymous, publicly routable HTTP(S) URLs are supported. Private, loopback, link-local, and credential-bearing targets are rejected.

### Get started

1. Open the Actor in Apify Console.
2. Add one or more direct sitemap URLs under **Sitemap URLs**.
3. Keep `maxUrls` small for an initial audit.
4. Leave page status checks enabled when broken URLs and redirects matter.
5. Click **Start**.
6. Open the **Dataset** tab and filter `recordType` or `issueCodes`.
7. Save the input as an Apify Task when you want scheduled comparisons.

Example input:

```json
{
  "startUrls": [{ "url": "https://www.shopify.com/sitemap.xml" }],
  "maxUrls": 25,
  "maxSitemaps": 10,
  "maxDepth": 3,
  "checkUrlStatus": true
}
```

### Output records

Every row has a `recordType`:

- `sitemap` describes one fetched XML document.
- `url` describes one listed page location and its checks.
- `summary` provides aggregate health counts for a supplied root.

Representative URL record:

```json
{
  "recordType": "url",
  "rootSitemap": "https://www.shopify.com/sitemap.xml",
  "sitemapUrl": "https://www.shopify.com/sitemap_products_1.xml",
  "url": "https://www.shopify.com/blog/sitemap-guide",
  "depth": 1,
  "httpStatus": 200,
  "finalUrl": "https://www.shopify.com/blog/sitemap-guide",
  "responseTimeMs": 184,
  "lastModified": "2026-01-15T12:00:00.000Z",
  "changeFrequency": null,
  "priority": null,
  "isValid": true,
  "isDuplicate": false,
  "isSameHost": true,
  "issueCodes": [],
  "issueCount": 0,
  "auditedAt": "2026-01-15T12:01:00.000Z"
}
```

Nullable fields are expected: not every sitemap declares optional metadata, and status fields are null when `checkUrlStatus` is false.

### Issue-code interpretation

`MALFORMED_XML` and `UNSUPPORTED_XML_ROOT` identify file-level parsing failures. `MALFORMED_LOC`, `DUPLICATE_LOC`, and `CROSS_HOST_LOC` identify location findings. `INVALID_LASTMOD`, `INVALID_CHANGEFREQ`, and `INVALID_PRIORITY` identify metadata findings. `HTTP_ERROR`, `REDIRECT`, `TIMEOUT`, and `REQUEST_FAILED` identify request outcomes.

A redirect is a warning rather than a broken result. A request failure or HTTP error contributes to `brokenUrls`. Other findings contribute to `warningUrls`.

### How much does it cost to validate XML sitemap records?

Pay-per-event pricing includes a **$0.001 start fee** plus **$0.00072 per `audit-record` event on the Bronze tier**. One `audit-record` is one sitemap-file, listed-URL, or aggregate-summary row.

Approximate Bronze examples:

| Saved records | Approximate total |
| ---: | ---: |
| 10 | $0.0082 |
| 100 | $0.073 |
| 1,000 | $0.721 |

The exact price shown in Console depends on your Apify tier. Limits control the number of page checks, but index/file and summary rows are also useful charged records. Failed requests that produce an `audit-record` are charged because the failure finding is part of the audit.

### Recurring technical SEO workflow

Create one Task per site, use stable limits, and schedule it after releases or daily/weekly. Send the completed dataset to a webhook or automation. Compare `issueCodes`, `httpStatus`, `brokenUrls`, and `warningUrls` with the prior run. The Actor produces snapshots; it does not retain or compare historical runs itself.

### Export and integrations

The default dataset can be downloaded as JSON, CSV, Excel, XML, or RSS. Connect runs to Zapier, Make, Google Sheets, Slack, a webhook, or your data warehouse through standard Apify integrations. Use `recordType=summary` for dashboards and `recordType=url` for issue queues.

### Run with the Apify API

Replace `YOUR_TOKEN` with an Apify API token.

```bash
curl -X POST \
  "https://api.apify.com/v2/acts/automation-lab~xml-sitemap-validator/runs?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"startUrls":[{"url":"https://www.shopify.com/sitemap.xml"}],"maxUrls":25}'
```

JavaScript:

```javascript
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('automation-lab/xml-sitemap-validator').call({
  startUrls: [{ url: 'https://www.shopify.com/sitemap.xml' }],
  maxUrls: 25,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

Python:

```python
from apify_client import ApifyClient
client = ApifyClient(token="YOUR_TOKEN")
run = client.actor("automation-lab/xml-sitemap-validator").call(run_input={
    "startUrls": [{"url": "https://www.shopify.com/sitemap.xml"}],
    "maxUrls": 25,
})
items = client.dataset(run["defaultDatasetId"]).list_items().items
print(items)
```

### Use with MCP and AI agents

Add the Actor to Claude Code:

```bash
claude mcp add --transport http apify \
  "https://mcp.apify.com?tools=automation-lab/xml-sitemap-validator"
```

Claude Desktop, Cursor, and VS Code can use the same HTTP MCP server configuration:

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com?tools=automation-lab/xml-sitemap-validator"
    }
  }
}
```

Example prompts:

- “Validate this sitemap and summarize broken listed URLs.”
- “Audit the WordPress sitemap index with a 200-URL limit.”
- “Return only URL records with redirect or metadata issue codes.”

### Reliability and limits

The Actor follows redirects and retries only transient conditions. It does not retry malformed input or deterministic XML errors. A sitemap document is limited to 25 MB in memory, 50,000 protocol entries are treated as excessive, recursion is bounded, and page checks run sequentially to reduce load on user-supplied sites.

Very large or slow sites should be audited in bounded runs. A site may block automated requests, vary responses by region, or rate-limit repeated checks. Reduce `maxUrls`, increase the timeout carefully, or schedule less frequently. No residential proxy fallback is automatically enabled.

### Troubleshooting

#### Why is a sitemap marked invalid?

Inspect `issueCodes` and the run log. Common causes are malformed XML, a non-sitemap response such as HTML, an unsupported root, a private hostname, or a stable HTTP error.

#### Why is `httpStatus` null?

Page status fields remain null when page checking is disabled. On sitemap records, a null status means the XML request failed before a response was available.

#### Why are fewer URLs checked than the sitemap contains?

`maxUrls`, `maxSitemaps`, and `maxDepth` are hard safety limits. Increase only the specific limit needed. Duplicate locations still produce records and count toward `maxUrls` so duplicate auditing remains deterministic.

#### Does this prove that Google indexed every URL?

No. HTTP health and sitemap protocol checks are not search-index coverage. Use Google Search Console data for indexing decisions.

### Legality and responsible use

Audit only public URLs that you are allowed to request. Respect site terms, robots policies where applicable to your organization, rate limits, and relevant law. Avoid aggressive schedules against infrastructure you do not control. The Actor does not bypass login, CAPTCHA, or access controls.

### Related Actors

- [Sitemap XML URL Extractor](https://apify.com/automation-lab/sitemap-xml-url-extractor) for a lightweight deduplicated URL inventory without the full health audit.
- [Multi-page On-page SEO Audit Crawler](https://apify.com/automation-lab/multi-page-on-page-seo-audit) for page content and on-page SEO signals beyond sitemap validation.
- [Lighthouse Website Audit](https://apify.com/automation-lab/website-lighthouse-seo-audit) for performance, accessibility, best-practice, and Lighthouse SEO checks.

### FAQ

#### Can I supply multiple root sitemaps?

Yes. Add several `startUrls`; one summary row is emitted for each supplied root. Run-wide URL and sitemap limits apply across them.

#### Are gzip sitemaps supported?

Only responses exposed to the HTTP client as text are supported. A raw `.gz` file that is not transparently decoded by the server/client may produce an unsupported XML finding.

#### Can it validate image, video, or news extensions?

The core sitemap structure and page locations are validated. Extension-specific schemas and media-resource availability are not validated.

#### Can I skip page requests?

Yes. Set `checkUrlStatus` to false for a fast structure-and-metadata audit. URL status, redirect, and response-time fields will be null.

# Actor input Schema

## `startUrls` (type: `array`):

Public HTTP(S) sitemap or sitemap-index URLs to validate.

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

Maximum URL entries to validate across all supplied sitemaps.

## `maxSitemaps` (type: `integer`):

Maximum sitemap documents to fetch, including nested index children.

## `maxDepth` (type: `integer`):

Maximum nested sitemap-index depth to follow.

## `checkUrlStatus` (type: `boolean`):

Fetch every accepted page URL to report status, redirects, and response time.

## `requestTimeoutSecs` (type: `integer`):

Timeout in seconds for each sitemap or page request.

## `maxRetries` (type: `integer`):

Retries for timeouts, network resets, HTTP 429, and HTTP 5xx responses.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.shopify.com/sitemap.xml"
    }
  ],
  "maxUrls": 20,
  "maxSitemaps": 50,
  "maxDepth": 5,
  "checkUrlStatus": true,
  "requestTimeoutSecs": 20,
  "maxRetries": 2
}
```

# Actor output Schema

## `overview` (type: `string`):

Default dataset view containing sitemap, URL, and summary validation records.

# 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 = {
    "startUrls": [
        {
            "url": "https://www.shopify.com/sitemap.xml"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("automation-lab/xml-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 = { "startUrls": [{ "url": "https://www.shopify.com/sitemap.xml" }] }

# Run the Actor and wait for it to finish
run = client.actor("automation-lab/xml-sitemap-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 '{
  "startUrls": [
    {
      "url": "https://www.shopify.com/sitemap.xml"
    }
  ]
}' |
apify call automation-lab/xml-sitemap-validator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,automation-lab/xml-sitemap-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/mVUSi0HeVdMscP3zu/builds/6bqjzeXgdbdfobkp2/openapi.json
