# Sitemap Extractor: All Website URLs + New/Removed Pages (`pewterdesk/sitemap-url-inventory-diff`) Actor

Sitemap extractor that lists every URL a website publishes, with lastmod, images and hreflang. Finds sitemaps via robots.txt; handles nested indexes, gzip and text sitemaps. Compare runs to see new, updated and removed pages, and optionally check HTTP status.

- **URL**: https://apify.com/pewterdesk/sitemap-url-inventory-diff.md
- **Developed by:** [PewterDesk](https://apify.com/pewterdesk) (community)
- **Categories:** SEO tools, Developer tools, Automation
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## 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 Extractor: All Website URLs + New/Removed Pages

**Sitemap extractor:** get every URL from a website's sitemap.xml in one table, then schedule it to track new, updated and removed pages.&#x20;

Get **every URL a website publishes in its XML sitemaps** in one clean table. Then **schedule it to see what changed**: new pages, updated pages and removed pages since the last run.

- **Automatic discovery.** Sitemaps are found in `robots.txt` and at common locations (`/sitemap.xml`, `/sitemap_index.xml`, `/wp-sitemap.xml`, and gzip versions). You can also pass sitemap URLs directly.
- **Handles real-world sitemaps.** Nested sitemap indexes, `.xml.gz`, plain-text sitemaps, RSS used as a sitemap, broken or truncated XML (recovered), and files with 50,000+ URLs. Shopify, WordPress/Yoast, Next.js and custom CMSs all work.
- **Rich fields.** `lastmod`, `changefreq`, `priority`, image URLs, **hreflang alternates**, Google News tags, video count, and the sitemap each URL came from.
- **Change tracking.** Each URL is marked `new`, `updated` (lastmod changed), `unchanged` or `removed`, with the previous lastmod. Use *Only changes* to monitor competitors cheaply.
- **Optional HTTP status check.** Find 404s and redirects in your own sitemap, a common SEO problem.
- **Section scoping.** Enter `example.com/blog/` to inventory just that section. You can also use include/exclude regex and a "modified after" date.

### Use cases

- **SEO audits.** Get a full URL inventory, find stale lastmod dates, missing hreflang, and 404s or redirects listed in the sitemap.
- **Competitor monitoring.** Schedule daily runs in *Only changes* mode to see every new product, landing page or blog post a competitor publishes. Connect Slack or email.
- **E-commerce intelligence.** Track product launches and discontinued products (removed URLs) on Shopify stores.
- **Crawl seeding.** Feed URLs into your scraper or into *Documents to AI-Ready Markdown* for RAG.

### Input example

```json
{
  "startUrls": ["https://www.allbirds.com", "https://example.com/blog/"],
  "outputMode": "changes",
  "compareWithPrevious": true,
  "stateName": "competitors",
  "includePatterns": ["/products/"]
}
```

### Output

URL rows:

```json
{
  "type": "url", "site": "https://www.allbirds.com",
  "url": "https://www.allbirds.com/products/mens-wool-runners",
  "changeStatus": "updated", "lastmod": "2026-10-11T10:36:01-07:00", "previousLastmod": "2026-10-04T08:00:00-07:00",
  "changefreq": "daily", "imageCount": 1, "images": ["https://cdn.shopify.com/..."], "alternates": [],
  "sitemapUrl": "https://www.allbirds.com/sitemap_products_1.xml?from=...", "httpStatus": 200
}
```

Each site also gets a free **site summary** row with sitemap files found, URL count, new/updated/unchanged/removed counts and errors.

### Pricing (pay per event)

| Event | Price |
|---|---|
| Site scanned | $0.003 |
| URL listed (each output row) | $0.0003, i.e. $0.30 per 1,000 URLs |
| URL status checked (optional) | $0.001 |
| Sites without a sitemap | free |

For example, a daily *changes-only* monitor of 10 competitor sites with about 20 changes a day costs about $0.04 a day. If your spending limit stops a run early, the snapshot isn't advanced, so the undelivered changes are reported again in the next run.

### FAQ

**Where is the snapshot stored?** In your account, in a named key-value store (`sitemap-inventory-<stateName>`), compressed.

**What if the site has more URLs than my cap?** You get the first N URLs. Removal detection is turned off for that site in that run, so you won't get false "removed" alerts.

**Does it crawl pages?** No, it only reads sitemaps (plus optional HEAD status checks). That makes it fast, cheap and polite.

***

Built by **PewterDesk** ([pewterdesk.pages.dev](https://pewterdesk.pages.dev)). More tools: [apify.com/pewterdesk](https://apify.com/pewterdesk).

# Actor input Schema

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

Domains (example.com), section URLs (example.com/blog/ - only URLs under that path) or direct sitemap URLs.

## `outputMode` (type: `string`):

'Only changes' makes scheduled monitoring very cheap.

## `compareWithPrevious` (type: `boolean`):

Keep a snapshot per site (in your named key-value store) and mark each URL new / updated / unchanged / removed.

## `stateName` (type: `string`):

Use different names for independent monitors.

## `firstRunMode` (type: `string`):

Behaviour the first time a site is scanned with change tracking.

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

Regex or text; keep only URLs matching any (e.g. /products/).

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

Drop URLs matching any.

## `lastmodAfter` (type: `string`):

Keep only URLs whose lastmod is on/after this date.

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

Safety cap. Removal detection is disabled for a site when the cap is hit.

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

Cap on sitemap files (including nested indexes) fetched per site.

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

HEAD-request each output URL (robots.txt respected) to find 404s and redirects in your sitemap.

## `maxStatusChecks` (type: `integer`):

Upper limit on URLs status-checked per site.

## Actor input object example

```json
{
  "startUrls": [
    "https://www.allbirds.com"
  ],
  "outputMode": "all",
  "compareWithPrevious": true,
  "stateName": "default",
  "firstRunMode": "return_all",
  "maxUrlsPerSite": 200,
  "maxSitemapsPerSite": 10,
  "checkStatus": false,
  "maxStatusChecks": 1000
}
```

# Actor output Schema

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

Every sitemap URL with change status (new/updated/removed) plus per-site summaries (default dataset).

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

Counts for this run (processed, failed, stopped at spending limit) as JSON.

# 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": [
        "https://www.allbirds.com"
    ],
    "maxUrlsPerSite": 200,
    "maxSitemapsPerSite": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("pewterdesk/sitemap-url-inventory-diff").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": ["https://www.allbirds.com"],
    "maxUrlsPerSite": 200,
    "maxSitemapsPerSite": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("pewterdesk/sitemap-url-inventory-diff").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": [
    "https://www.allbirds.com"
  ],
  "maxUrlsPerSite": 200,
  "maxSitemapsPerSite": 10
}' |
apify call pewterdesk/sitemap-url-inventory-diff --silent --output-dataset

```

## MCP server setup

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

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/9Q4bJ3diL3NQnD50y/builds/Oy1pkwcMX4eAUfgDL/openapi.json
