# Sitemap Change Monitor — New, Updated & Removed URLs (`quartz_apple_dnx/sitemap-change-monitor`) Actor

Monitor XML sitemaps over time and emit new, updated, and removed URLs. Failed or truncated scans preserve the last good snapshot to prevent false removal alerts.

- **URL**: https://apify.com/quartz\_apple\_dnx/sitemap-change-monitor.md
- **Developed by:** [Austin DeMoss](https://apify.com/quartz_apple_dnx) (community)
- **Categories:** SEO tools, Automation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$10.00 / 1,000 completed sitemap source checks

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 Change Monitor — New, Updated & Removed URLs

Monitor public XML sitemaps over time and emit only meaningful URL changes.

This Actor is built for scheduled monitoring, SEO audits, content inventories, migration checks, and lightweight website-change pipelines. It stores a persistent snapshot for each source and compares a new **complete** observation with the last good snapshot.

### Why the fail-safe behavior matters

A temporary 404, timeout, broken child sitemap, response-size cap, URL cap, or sitemap-depth cap must **not** look like thousands of pages disappeared. This Actor therefore refuses to replace prior state when a scan is incomplete. Failed or incomplete checks are reported in `RUN_SUMMARY`, produce no false `removed` rows, and are not charged as completed `site-check` events.

### What it does

- accepts domains, website URLs, direct sitemap URLs, and `.xml.gz` sitemaps;
- discovers sitemap URLs from `robots.txt` or common sitemap locations;
- follows sitemap indexes recursively with depth/file/URL safety caps;
- supports gzip-compressed sitemaps;
- stores the last complete snapshot in a named Apify key-value store;
- emits `new`, `updated`, and `removed` URL events on later runs;
- emits one `summary` row when a run produces no URL-change rows, so a successful no-change check is visible instead of returning an empty dataset;
- can optionally emit `baseline` rows on the first run;
- treats changes to sitemap `lastmod`, `changefreq`, or `priority` as `updated`;
- supports include/exclude URL regex filters;
- blocks localhost/private-network fetch targets and re-checks redirect destinations;
- uses direct HTTP only — no browser or proxy is required.

### Example input

```json
{
  "sources": ["https://example.com"],
  "stateKey": "production",
  "emitBaseline": false,
  "changeTypes": ["new", "updated", "removed"],
  "maxUrlsPerSource": 20000
}
```

Run the Actor again later with the same `sources` and `stateKey`. The second and later complete runs compare against the previous complete snapshot.

### Output

Each emitted dataset row includes:

- `event`: `baseline`, `new`, `updated`, `removed`, or `summary`;
- `url`;
- current and previous `lastmod`, `changefreq`, and `priority` where applicable;
- `source` and `sourceSitemap` provenance;
- `observedAt` in UTC.

When no URL-change rows are emitted, the default dataset contains one `summary` row with run-level counts and status. `RUN_SUMMARY` also reports every requested source as complete, incomplete, or failed, plus sitemap-file count, URL count, emitted changes, response bytes, and truncation/error diagnostics.

### State model

Snapshots are isolated by `stateKey` and source URL. A snapshot is replaced only after a complete scan. This is intentionally conservative: preserving a known-good baseline is more useful than emitting a destructive false delta from a partial observation.

If you intentionally change a source's include/exclude filters or want a clean baseline, use a new `stateKey`.

### Pricing

Pay per **completed source check**, not per discovered URL. Failed and incomplete source observations are not charged as completed `site-check` events.

### Limitations

- This monitors sitemap metadata, not page-body content. A page can change without its sitemap metadata changing.
- A site's sitemap can omit URLs that still exist; `removed` means removed from the monitored sitemap snapshot, not necessarily deleted from the web.
- Very large sitemap estates can exceed configured safety caps; those checks remain incomplete and preserve prior state until limits are intentionally raised within the Actor's supported bounds.
- DNS/IP validation materially reduces SSRF risk for user-supplied fetch targets, but this Actor is not a general-purpose network scanner.

# Actor input Schema

## `sources` (type: `array`):

One to 100 public website domains, URLs, sitemap XML URLs, or .xml.gz sitemap URLs.

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

Stable label used to isolate one monitoring history from another. Reuse the same value on later runs to compare against the prior complete snapshot.

## `emitBaseline` (type: `boolean`):

When enabled, the first complete observation emits baseline rows. By default the first run stores state silently and later runs emit only changes.

## `changeTypes` (type: `array`):

Which change events to emit after a baseline exists.

## `includePattern` (type: `string`):

Optional regular expression. Only sitemap URLs matching it are stored and compared.

## `excludePattern` (type: `string`):

Optional regular expression. Matching sitemap URLs are ignored.

## `maxUrlsPerSource` (type: `integer`):

Safety cap. If a source exceeds this cap, that observation is marked incomplete and does not replace the last good snapshot.

## `maxSitemapsPerSource` (type: `integer`):

Safety cap for sitemap indexes and child sitemap files.

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

Maximum sitemap-index nesting depth.

## `timeoutSecs` (type: `integer`):

Maximum seconds per HTTP request.

## Actor input object example

```json
{
  "sources": [
    "https://docs.apify.com/sitemap.xml"
  ],
  "stateKey": "apify-store-qa",
  "emitBaseline": false,
  "changeTypes": [
    "new",
    "updated",
    "removed"
  ],
  "includePattern": "",
  "excludePattern": "",
  "maxUrlsPerSource": 20000,
  "maxSitemapsPerSource": 200,
  "maxDepth": 5,
  "timeoutSecs": 15
}
```

# Actor output Schema

## `changes` (type: `string`):

No description

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

No description

# 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 = {
    "sources": [
        "https://docs.apify.com/sitemap.xml"
    ],
    "stateKey": "apify-store-qa",
    "maxUrlsPerSource": 20000
};

// Run the Actor and wait for it to finish
const run = await client.actor("quartz_apple_dnx/sitemap-change-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 = {
    "sources": ["https://docs.apify.com/sitemap.xml"],
    "stateKey": "apify-store-qa",
    "maxUrlsPerSource": 20000,
}

# Run the Actor and wait for it to finish
run = client.actor("quartz_apple_dnx/sitemap-change-monitor").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 '{
  "sources": [
    "https://docs.apify.com/sitemap.xml"
  ],
  "stateKey": "apify-store-qa",
  "maxUrlsPerSource": 20000
}' |
apify call quartz_apple_dnx/sitemap-change-monitor --silent --output-dataset

```

## MCP server setup

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

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/XVQZ8vLAdYnxdYPdG/builds/vqQyuOt1KVsAhLlu4/openapi.json
