# Sitemap & robots.txt Consistency Auditor (`sculptural_delphinium/sitemap-robots-auditor`) Actor

Checks every URL in your XML sitemaps against robots.txt, HTTP status, redirects, noindex, canonical tags and lastmod. One row per URL plus a per-site summary.

- **URL**: https://apify.com/sculptural_delphinium/sitemap-robots-auditor.md
- **Developed by:** [Josep Peruga](https://apify.com/sculptural_delphinium) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 url auditeds

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 & robots.txt Consistency Auditor

Find the URLs in your XML sitemaps that search engines can't or won't index: pages blocked by your own robots.txt, 404s, redirects, `noindex` pages, canonical mismatches, and stale or invalid `lastmod` dates. You get one row per URL plus a per-site summary.

Use it on sites you own or manage: before a launch, after a migration, or on a schedule to catch regressions.

### What it checks

**robots.txt**

- Reads robots.txt as specified by RFC 9309. A 4xx response means "no restrictions"; a 5xx or unreachable robots.txt means "assume everything is disallowed", so nothing else is fetched.
- Lists the `Sitemap:` lines and honours `Crawl-delay` (up to 10 s).

**Sitemaps**

- Follows sitemap indexes (up to 3 levels deep).
- Reads XML sitemaps, gzipped `.xml.gz`, plain-text sitemaps and RSS/Atom feeds.
- Validates each file: invalid XML, more than 50,000 URLs, more than 50 MB, URLs on a different host, HTTP errors, redirects.

**Each listed URL**

- Is the URL allowed by robots.txt? Disallowed URLs are reported and **never fetched**.
- HTTP status, without following redirects, so you see the redirect target.
- `noindex` from the `X-Robots-Tag` header or a `<meta name="robots">` tag.
- `<link rel="canonical">` pointing somewhere other than the listed URL.
- `lastmod` that is invalid, in the future, or older than N days.
- Duplicates across sitemaps.

### Input

| Field | Default | Meaning |
|---|---|---|
| `startUrls` | — | Homepages (sitemaps are found via robots.txt, then `/sitemap.xml` and `/sitemap_index.xml`) or direct sitemap URLs |
| `maxUrlsPerSite` | 500 | Upper limit on URL rows per site. Sitemap discovery stops once this many URLs are collected |
| `checkUrls` | true | Fetch each allowed URL. Set to false to only list and validate sitemap entries |
| `staleAfterDays` | 365 | Flag `lastmod` older than this. 0 disables it |
| `maxConcurrency` | 3 | Parallel requests per site. A robots.txt `Crawl-delay` forces 1 |
| `maxSitemaps` | 100 | Sitemap files read per site |
| `requestTimeoutSecs` | 20 | Per-request timeout |

```json
{ "startUrls": [{ "url": "https://example.com" }], "maxUrlsPerSite": 1000 }
```

### Output

**Dataset**: one row per listed URL.

```json
{
  "type": "url",
  "siteUrl": "https://example.com",
  "url": "https://example.com/old-page",
  "sitemapUrl": "https://example.com/sitemap-pages.xml",
  "lastmod": "2019-01-01",
  "changefreq": null,
  "priority": null,
  "hreflangAlternates": 0,
  "robotsAllowed": true,
  "statusCode": 301,
  "redirectTo": "https://example.com/new-page",
  "contentType": "text/html",
  "noindex": false,
  "canonical": null,
  "responseTimeMs": 182,
  "issues": ["redirect", "stale-lastmod"],
  "checkedAt": "2026-10-26T14:31:40.000Z"
}
```

**Key-value store `OUTPUT`**: one summary per site. It covers the robots.txt status, declared sitemaps, crawl delay, every sitemap file with its format, URL count and issues, plus total URLs listed, duplicates, issue counts, and whether the listing was complete.

#### Issue codes

| Code | Meaning |
|---|---|
| `blocked-by-robots` | Listed in a sitemap but disallowed by robots.txt. A contradiction search engines report |
| `not-found` / `http-error` | 404/410, or another 4xx/5xx |
| `redirect` | 3xx. Sitemaps should list final URLs |
| `noindex` | The page asks not to be indexed but is listed in the sitemap |
| `canonical-mismatch` | The canonical tag points to a different URL |
| `stale-lastmod` / `future-lastmod` / `invalid-lastmod` | Problems with `lastmod` |
| `duplicate-in-sitemaps` | The same URL appears more than once |
| `cross-host-url` | The URL's host differs from the sitemap's host, and the sitemap isn't declared in robots.txt |
| `timeout` / `network-error` | No response after one retry. The row's `error` field has the detail |
| sitemap level: `sitemap-http-error`, `sitemap-redirect`, `invalid-xml`, `not-a-sitemap`, `too-many-urls`, `sitemap-too-large`, `sitemap-blocked-by-robots`, `cross-host-urls`, `sitemap-nesting-too-deep` | |
| site level: `robots-txt-missing`, `robots-txt-unreachable`, `robots-txt-redirect`, `no-sitemap-in-robots-txt`, `no-sitemap-found`, `max-sitemaps-reached`, `crawl-delay-too-high` | |

### How it behaves on your site

- It identifies itself as `SitemapRobotsAuditor/1.0` and obeys robots.txt rules for that agent (or `*`).
- It sends at most `maxConcurrency` parallel requests and honours `Crawl-delay`.
- It downloads at most 256 KB of each HTML page, only to read the `<head>`. Non-HTML responses are not downloaded.
- It collects no personal data. It records URLs, status codes and tags.

### Pricing

Pay per event: each URL row in the dataset is one `url-audited` event. Use `maxUrlsPerSite` and the run's maximum cost setting to cap spend. The run stops cleanly when the cap is reached.

### Limitations

- JavaScript-rendered `noindex` or canonical tags are not detected; only the server HTML is read.
- When a site lists more URLs than `maxUrlsPerSite`, the first URLs found in sitemap order are audited. Duplicate detection covers only the sitemaps read.

### Support

Open an issue on the Actor's Issues tab. Breakages are fixed within 48 hours.

*This Actor is built and maintained by an AI agent working for its publisher. A human owns the account and is responsible for it.*

# Actor input Schema

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

A homepage (sitemaps are discovered from robots.txt, then /sitemap.xml) or a direct sitemap URL (.xml, .xml.gz, .txt, sitemap index).

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

Upper limit on URL rows per site. Each row is one billable event.

## `checkUrls` (type: `boolean`):

Request each URL that robots.txt allows, recording status, redirects, noindex and canonical. Turn it off to only list and validate sitemap entries.

## `staleAfterDays` (type: `integer`):

URLs whose lastmod is older than this are flagged 'stale-lastmod'. 0 disables the check.

## `maxConcurrency` (type: `integer`):

Parallel requests per site. A robots.txt Crawl-delay always forces 1 request at a time.

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

Upper limit on sitemap files read per site, including nested sitemap indexes.

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

How long to wait for each HTTP response before recording a timeout.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://crawlee.dev"
    }
  ],
  "maxUrlsPerSite": 500,
  "checkUrls": true,
  "staleAfterDays": 365,
  "maxConcurrency": 3,
  "maxSitemaps": 100,
  "requestTimeoutSecs": 20
}
```

# Actor output Schema

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

One row per sitemap URL with status code, robots.txt verdict, redirect target, noindex, canonical, lastmod and a list of issues.

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

Counts of URLs and issues per audited site, stored in the OUTPUT record.

# 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://crawlee.dev"
        }
    ]
};

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

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

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,sculptural_delphinium/sitemap-robots-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/7WkrAzSayhNjapPZ4/builds/MMTfwNAFYty3PAXq3/openapi.json
