# Sitemap Robots Delta Monitor (`tom_the_builder/sitemap-robots-delta-monitor`) Actor

Monitor sitemap.xml and robots.txt for URL inventory changes and return new, changed, or removed URLs in normalized JSON.

- **URL**: https://apify.com/tom\_the\_builder/sitemap-robots-delta-monitor.md
- **Developed by:** [Danil Iarmolchik](https://apify.com/tom_the_builder) (community)
- **Categories:** SEO tools, Automation, Developer tools
- **Stats:** 0 total users, 0 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.01 / 1,000 url change alerts

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 a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## Sitemap Robots Delta Monitor

Track sitemap and robots.txt URL inventory changes for SEO, website migration, and competitor monitoring workflows.

### Why use this Actor?

Most sitemap tools give you a one-time URL dump. Most website change monitors compare page content. This Actor sits between those use cases: it checks public `robots.txt` and sitemap files on a schedule and returns only URL inventory changes.

Use it to monitor:

- new competitor landing pages
- removed or changed sitemap URLs during migrations
- fresh content URLs from publisher or documentation sites
- sitemap metadata changes before a larger crawl
- URL lists for downstream crawlers, RAG ingestion, or webhook automations

### Features

- Discovers sitemap URLs from `robots.txt`.
- Also tries `/sitemap.xml`.
- Accepts direct sitemap index or sitemap URLs.
- Traverses sitemap indexes within safe limits.
- Supports regex include and exclude filters.
- Can optionally check URL HTTP status with lightweight `HEAD` requests.
- Keeps state across runs by `stateKey`.
- Emits `new`, `changed`, and `removed` URL events.
- Produces dataset rows plus `OUTPUT`, `RUN_SUMMARY`, and `WEBHOOK_PAYLOAD`.

### Input

```json
{
  "mode": "delta",
  "changeMode": "new_and_changed",
  "stateKey": "seo-watch",
  "sites": ["https://apify.com"],
  "includeRobotsSitemaps": true,
  "includeDefaultSitemap": true,
  "sameHostOnly": true,
  "maxSitemapsPerSite": 10,
  "maxUrlsPerSite": 1000,
  "maxItems": 100,
  "includePatterns": ["/store", "/actors"],
  "excludePatterns": ["/login", "/users/"],
  "checkStatus": false,
  "includeRemoved": true,
  "webhookMode": "summary"
}
````

### Output

Each dataset item represents one URL inventory event:

```json
{
  "change_type": "new",
  "site": "https://apify.com",
  "url": "https://apify.com/store",
  "sitemap_url": "https://apify.com/sitemap.xml",
  "lastmod": "2026-05-05T00:00:00.000Z",
  "changefreq": "",
  "priority": "",
  "http_status": null,
  "final_url": "",
  "stable_id": "sitemap:...",
  "fingerprint": "...",
  "state_key": "seo-watch"
}
```

### Pricing signal

The primary value event is a URL change alert. For public Store monetization, use pay per result with the dataset item event as the primary event.

### Limitations

- Only public robots and sitemap data is used.
- The Actor does not fetch page bodies by default.
- `lastmod` quality depends on the website's sitemap.
- Optional HTTP status checks increase runtime.

### Suggested schedule

For most SEO monitoring, run daily or every few hours. Use separate `stateKey` values for unrelated site groups.

# Actor input Schema

## `mode` (type: `string`):

Use snapshot to return the current URL inventory, or delta to return only new, changed, and removed URLs compared with the previous run for the same state key.

## `changeMode` (type: `string`):

Choose whether delta runs return only new URLs or both new and changed URLs. Removed URLs are included when includeRemoved is enabled.

## `stateKey` (type: `string`):

Persistent state namespace. Use a stable key per monitored website group.

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

Website base URLs. The Actor discovers Sitemap declarations from robots.txt and /sitemap.xml.

## `sitemapUrls` (type: `array`):

Optional direct sitemap.xml or sitemap index URLs.

## `includeRobotsSitemaps` (type: `boolean`):

Discover Sitemap: declarations from /robots.txt.

## `includeDefaultSitemap` (type: `boolean`):

Also try the common /sitemap.xml location.

## `sameHostOnly` (type: `boolean`):

Keep sitemap URLs and listed pages on the same hostname as the input site.

## `maxSitemapsPerSite` (type: `integer`):

Maximum sitemap files to read per site, including sitemap indexes.

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

Maximum sitemap URL records to collect per site before delta filtering.

## `maxItems` (type: `integer`):

Maximum dataset items to write after snapshot or delta selection.

## `includePatterns` (type: `array`):

Optional JavaScript regex patterns. If set, only matching URLs are kept.

## `excludePatterns` (type: `array`):

Optional JavaScript regex patterns for URLs to exclude.

## `checkStatus` (type: `boolean`):

Use lightweight HEAD requests for listed URLs. This is slower but useful for sitemap QA.

## `includeRemoved` (type: `boolean`):

On delta runs, report URLs that existed in the previous state but no longer appear.

## `includeUnchanged` (type: `boolean`):

On delta runs, also include unchanged URLs. Usually leave this off for low-noise monitoring.

## `webhookMode` (type: `string`):

Full includes all output items in WEBHOOK\_PAYLOAD. Summary includes the first 20.

## `userAgent` (type: `string`):

User-Agent header used for sitemap, robots.txt, and optional status requests.

## Actor input object example

```json
{
  "mode": "snapshot",
  "changeMode": "new_and_changed",
  "stateKey": "sitemap-robots-default",
  "sites": [
    "https://apify.com"
  ],
  "sitemapUrls": [],
  "includeRobotsSitemaps": true,
  "includeDefaultSitemap": true,
  "sameHostOnly": true,
  "maxSitemapsPerSite": 10,
  "maxUrlsPerSite": 1000,
  "maxItems": 100,
  "includePatterns": [],
  "excludePatterns": [],
  "checkStatus": false,
  "includeRemoved": true,
  "includeUnchanged": false,
  "webhookMode": "full",
  "userAgent": "sitemap-robots-delta-monitor/0.1 (+https://apify.com)"
}
```

# Actor output Schema

## `urlChangeAlerts` (type: `string`):

Default dataset items containing snapshot, new, changed, or removed sitemap URL records.

## `runSummary` (type: `string`):

Compact summary with counts and selected configuration.

## `webhookPayload` (type: `string`):

Compact payload suitable for downstream SEO and automation workflows.

## `fullOutput` (type: `string`):

Full JSON output object containing summary, items, and webhook payload.

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

// Run the Actor and wait for it to finish
const run = await client.actor("tom_the_builder/sitemap-robots-delta-monitor").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://apify.com"] }

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

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Sitemap Robots Delta Monitor",
        "description": "Monitor sitemap.xml and robots.txt for URL inventory changes and return new, changed, or removed URLs in normalized JSON.",
        "version": "0.1",
        "x-build-id": "DqmnHRf0O3rMNUSxJ"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/tom_the_builder~sitemap-robots-delta-monitor/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-tom_the_builder-sitemap-robots-delta-monitor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/tom_the_builder~sitemap-robots-delta-monitor/runs": {
            "post": {
                "operationId": "runs-sync-tom_the_builder-sitemap-robots-delta-monitor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/tom_the_builder~sitemap-robots-delta-monitor/run-sync": {
            "post": {
                "operationId": "run-sync-tom_the_builder-sitemap-robots-delta-monitor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "mode": {
                        "title": "Run mode",
                        "enum": [
                            "snapshot",
                            "delta"
                        ],
                        "type": "string",
                        "description": "Use snapshot to return the current URL inventory, or delta to return only new, changed, and removed URLs compared with the previous run for the same state key.",
                        "default": "snapshot"
                    },
                    "changeMode": {
                        "title": "Delta mode",
                        "enum": [
                            "new_only",
                            "new_and_changed"
                        ],
                        "type": "string",
                        "description": "Choose whether delta runs return only new URLs or both new and changed URLs. Removed URLs are included when includeRemoved is enabled.",
                        "default": "new_and_changed"
                    },
                    "stateKey": {
                        "title": "State key",
                        "type": "string",
                        "description": "Persistent state namespace. Use a stable key per monitored website group.",
                        "default": "sitemap-robots-default"
                    },
                    "sites": {
                        "title": "Website base URLs",
                        "type": "array",
                        "description": "Website base URLs. The Actor discovers Sitemap declarations from robots.txt and /sitemap.xml.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "sitemapUrls": {
                        "title": "Direct sitemap URLs",
                        "type": "array",
                        "description": "Optional direct sitemap.xml or sitemap index URLs.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "includeRobotsSitemaps": {
                        "title": "Read robots.txt Sitemap lines",
                        "type": "boolean",
                        "description": "Discover Sitemap: declarations from /robots.txt.",
                        "default": true
                    },
                    "includeDefaultSitemap": {
                        "title": "Try /sitemap.xml",
                        "type": "boolean",
                        "description": "Also try the common /sitemap.xml location.",
                        "default": true
                    },
                    "sameHostOnly": {
                        "title": "Same host only",
                        "type": "boolean",
                        "description": "Keep sitemap URLs and listed pages on the same hostname as the input site.",
                        "default": true
                    },
                    "maxSitemapsPerSite": {
                        "title": "Max sitemaps per site",
                        "minimum": 1,
                        "maximum": 200,
                        "type": "integer",
                        "description": "Maximum sitemap files to read per site, including sitemap indexes.",
                        "default": 10
                    },
                    "maxUrlsPerSite": {
                        "title": "Max URLs per site",
                        "minimum": 1,
                        "maximum": 100000,
                        "type": "integer",
                        "description": "Maximum sitemap URL records to collect per site before delta filtering.",
                        "default": 1000
                    },
                    "maxItems": {
                        "title": "Max output items",
                        "minimum": 1,
                        "maximum": 100000,
                        "type": "integer",
                        "description": "Maximum dataset items to write after snapshot or delta selection.",
                        "default": 100
                    },
                    "includePatterns": {
                        "title": "Include URL regex patterns",
                        "type": "array",
                        "description": "Optional JavaScript regex patterns. If set, only matching URLs are kept.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "excludePatterns": {
                        "title": "Exclude URL regex patterns",
                        "type": "array",
                        "description": "Optional JavaScript regex patterns for URLs to exclude.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "checkStatus": {
                        "title": "Check URL HTTP status",
                        "type": "boolean",
                        "description": "Use lightweight HEAD requests for listed URLs. This is slower but useful for sitemap QA.",
                        "default": false
                    },
                    "includeRemoved": {
                        "title": "Include removed URLs",
                        "type": "boolean",
                        "description": "On delta runs, report URLs that existed in the previous state but no longer appear.",
                        "default": true
                    },
                    "includeUnchanged": {
                        "title": "Include unchanged URLs",
                        "type": "boolean",
                        "description": "On delta runs, also include unchanged URLs. Usually leave this off for low-noise monitoring.",
                        "default": false
                    },
                    "webhookMode": {
                        "title": "Webhook payload",
                        "enum": [
                            "summary",
                            "full"
                        ],
                        "type": "string",
                        "description": "Full includes all output items in WEBHOOK_PAYLOAD. Summary includes the first 20.",
                        "default": "full"
                    },
                    "userAgent": {
                        "title": "User-Agent",
                        "type": "string",
                        "description": "User-Agent header used for sitemap, robots.txt, and optional status requests.",
                        "default": "sitemap-robots-delta-monitor/0.1 (+https://apify.com)"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
