# Sitemap Change Feed for RAG & SEO Refresh (`natstandridge/sitemap-change-feed`) Actor

Track new, removed and lastmod-changed URLs across sitemap indexes. Export scope-checked snapshots for recurring RAG refresh and SEO monitoring, with partial-scan safeguards.

- **URL**: https://apify.com/natstandridge/sitemap-change-feed.md
- **Developed by:** [Nathaniel Standridge](https://apify.com/natstandridge) (community)
- **Categories:** SEO tools, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.20 / 1,000 sitemap url observations

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 Feed for RAG & SEO Refresh

Turn public XML sitemaps into a repeatable URL change feed. Use it to prepare a RAG document refresh queue, spot newly listed URLs, or monitor sitemap metadata for SEO operations. The Actor follows sitemap indexes, deduplicates URLs and exports a snapshot you can compare in the next run.

**$0.20 per 1,000 delivered URL observations ($0.0002 each).** No startup fee. Each baseline, added, unchanged, lastmod-changed or removed URL delivered to the default dataset is one charged observation. Empty sitemaps, rejected input, failed fetches, duplicate URLs and diagnostic records produce no observation charge. Every observed URL is returned, including unchanged URLs. A result spending limit can stop delivery; check `OUTPUT.complete` before advancing your baseline.

### Start with a baseline

```json
{
  "sitemapUrls": ["https://www.sitemaps.org/sitemap.xml"],
  "maxResults": 1000,
  "maxSitemaps": 25,
  "maxRunSeconds": 120
}
```

Download `SNAPSHOT` from the run's key-value store. When its `complete` field is `true`, paste that JSON into `previousSnapshot` for a later run with the **same sitemapUrls**. Snapshots are supplied explicitly; this Actor does not create a schedule or implicitly read another run's storage. Automations can retrieve SNAPSHOT through the Apify API and inject it into the next input.

### Interpret the feed

| changeStatus | Meaning |
| --- | --- |
| `baseline` | First observation without a prior snapshot. This is not a claim that the URL is new. |
| `added` | Listed now but absent from the supplied complete snapshot. |
| `unchanged` | Listed in both snapshots with the same raw `lastmod` value, including two missing values. |
| `lastmod_changed` | The raw sitemap `lastmod` value differs, including appearance or disappearance of that value. |
| `removed` | Present in the prior snapshot and absent after a complete scan of the current sitemap forest. This is not proof that the page was deleted. |

`lastmod` is publisher-supplied metadata, **not proof of page-content change**. The Actor does not fetch, render, summarize or hash the listed pages. A stale or inaccurate sitemap can omit real site changes. Timestamp formatting changes count as metadata changes; strings are retained rather than converted to dates.

Example observation:

```json
{
  "schemaVersion": 1,
  "observationId": "<stable hash of scope and URL>",
  "url": "https://example.com/docs/start",
  "changeStatus": "lastmod_changed",
  "lastmod": "2026-11-04",
  "previousLastmod": "2026-11-01",
  "sourceSitemap": "https://example.com/sitemap.xml",
  "occurrences": 1,
  "scanComplete": true,
  "scopeId": "<root-set hash>",
  "observedAt": "2026-11-05T00:00:00Z"
}
```

`sourceSitemap` is the first sitemap containing the URL. `occurrences` counts matching duplicate entries. Conflicting duplicate `lastmod` values are diagnosed and excluded from the charged dataset. All observations are globally deduplicated across the supplied roots.

### Coverage and comparison safeguards

- `OUTPUT` reports scan completeness, delivery completeness, counts, source errors and any limit reached. `SNAPSHOT` contains the normalized root set, a scope hash and current `url`/`lastmod` entries.
- **Any incomplete scan suppresses every removal.** Failed child sitemaps, invalid entries, cycles, unsupported URLs, depth limits and resource caps cannot manufacture removals. Usable current observations can still be delivered with `scanComplete: false`.
- An incomplete or differently scoped prior snapshot is rejected before collection or billing. Use the last complete snapshot until a new complete run succeeds. If delivery stops at the price cap, its exported snapshot is also incomplete.
- Collection is frozen before delivery. Resume uses the same frozen observations and reconciles existing dataset rows. An uncertain write stops instead of blindly retrying a potentially billed append.
- A valid empty sitemap completes without a charged dataset row. If no sitemap is readable, the run fails with safe error codes in OUTPUT.

### Supported inputs and limits

Supply 1–10 HTTPS roots using public DNS hosts on port 443. XML `urlset` and `sitemapindex` are supported, with or without the standard sitemap namespace, to five nested index levels. Source XML must use UTF-8. Gzip sitemap files and gzip/deflate HTTP responses are decompressed within a 4 MB compressed/expanded bound; multiple gzip members and malformed archives are rejected. RSS, Atom, text sitemaps and authenticated sources are outside this version's contract.

The listed page URLs can use HTTP or HTTPS, but they are never fetched. Sitemap fetches validate public DNS addresses and pin the connection to a validated address. Redirect destinations are independently checked. Robots rules are respected. Cookies, credentials and custom request headers are not accepted or forwarded.

Default bounds are 1,000 observations, 25 sitemap documents and 120 work seconds. Maximums are 5,000 observations, 100 sitemap documents and 180 seconds. Up to 25 seconds of the work budget is reserved for delivery. Storage calls and platform shutdown can add a short overhead. The frozen plan is bounded to 8 MiB. Result caps include potential removals; if the full comparison would exceed the cap, removals are suppressed and the snapshot is incomplete. For large sites, submit a smaller stable subset of sitemap roots in separate runs and maintain a snapshot per subset.

### Outputs and operational use

The dataset supports JSON, CSV and Excel export through Apify. Filter `added` and `lastmod_changed` to prepare a refresh queue; handle `removed` according to your retention policy after checking full coverage. Preserve `unchanged` observations when auditing why a refresh was skipped. Dataset rows, source error details and snapshots may contain URLs supplied by you or published by the source; use your normal Apify storage retention controls.

The observation price covers this Actor's output. Any downstream crawler, embedding service or scheduler has its own costs. No proxy or paid third-party API is used by this Actor.

### Development

```sh
uv sync --frozen
uv run python -B -m unittest discover -s tests -v
```

Python dependencies and the container base image are pinned. Tests cover parser changes, partial scans, stale scope, hostile URLs, decompression bounds, absolute network deadlines, uncertain billing outcomes and resume behavior. Live source checks are operational tests, not evidence of customer demand.

# Actor input Schema

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

1–10 public HTTPS XML sitemap or sitemap-index URLs. Duplicate normalized roots are scanned once.

## `maxResults` (type: `integer`):

Hard cap including removals; reaching a cap makes the snapshot incomplete and suppresses removals.

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

Total roots and nested sitemap documents to fetch.

## `maxRunSeconds` (type: `integer`):

Work budget including a storage/delivery reserve; platform shutdown may add a short overhead.

## `previousSnapshot` (type: `object`):

Paste a prior run's complete SNAPSHOT JSON using the identical sitemap root set. Omit on the first run.

## Actor input object example

```json
{
  "sitemapUrls": [
    "https://www.sitemaps.org/sitemap.xml"
  ],
  "maxResults": 1000,
  "maxSitemaps": 25,
  "maxRunSeconds": 120
}
```

# Actor output Schema

## `observations` (type: `string`):

No description

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

No description

## `snapshot` (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 = {
    "sitemapUrls": [
        "https://www.sitemaps.org/sitemap.xml"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("natstandridge/sitemap-change-feed").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 = { "sitemapUrls": ["https://www.sitemaps.org/sitemap.xml"] }

# Run the Actor and wait for it to finish
run = client.actor("natstandridge/sitemap-change-feed").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 '{
  "sitemapUrls": [
    "https://www.sitemaps.org/sitemap.xml"
  ]
}' |
apify call natstandridge/sitemap-change-feed --silent --output-dataset

```

## MCP server setup

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

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/mfZ946CAGK1sOyjol/builds/WtsJHWW4qoRVfQmIg/openapi.json
