# Sitemap URL Extractor & Change Detector (`adaptive_labs/sitemap-url-extractor`) Actor

Extract every URL from any website sitemap, with lastmod, priority, hreflang and images. Finds sitemaps automatically, checks status codes and detects new pages. Free.

- **URL**: https://apify.com/adaptive_labs/sitemap-url-extractor.md
- **Developed by:** [Adaptive Labs](https://apify.com/adaptive_labs) (community)
- **Categories:** SEO tools, Developer tools, Automation
- **Features:** 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 URL Extractor & Change Detector

Get **every URL from a website's sitemap** in seconds. Give this Actor a domain and it finds the sitemaps through robots.txt and the usual locations, follows sitemap indexes and gzip files, and returns each URL with its **lastmod date, change frequency, priority, hreflang alternates and image count**.

Switch on **change detection** and schedule it to get only the **new, updated and removed pages** on any site, perfect for competitor monitoring and SEO. Optionally check the **HTTP status** of every URL to find broken or redirected pages. No login, no API key and no proxy needed.

### What you get

- Automatic sitemap discovery from robots.txt, /sitemap.xml, /sitemap_index.xml, WordPress and gzip sitemaps
- Follows nested sitemap indexes (up to 5 levels) and plain-text sitemaps
- lastmod, changefreq, priority, hreflang alternates and image URLs for each page
- Include and exclude filters with plain text or regular expressions
- Optional HTTP status and redirect check for every URL (find 404s and redirects in your sitemap)
- Change detection: only new, updated (lastmod changed) and removed URLs since the last run
- Many sites in one run, with a per-site limit

### Who uses it

- **SEO specialists**: audit sitemaps, find broken or redirected URLs and check lastmod freshness
- **Competitor monitoring**: get alerted when a competitor publishes new products, pages or blog posts
- **Content and growth teams**: build a full URL inventory for migrations, internal linking or content audits
- **Developers and data teams**: feed URL lists into crawlers, scrapers or RAG pipelines
- **Agencies**: run one schedule across all client sites

### Quick start (under a minute)

1. Enter one or more **websites** (the example `https://apify.com` works out of the box) or direct sitemap URLs.
2. Optionally add **Only URLs containing** filters such as `/blog/`, or tick **Check HTTP status**.
3. Click **Start**. URLs appear in the **Sitemap URLs** table within seconds.
4. To track new pages, turn on **Change detection**, set a **Monitor name** and add a daily schedule.

### Input example

```json
{
  "startUrls": [
    "https://www.example.com",
    "https://competitor.example/sitemap_index.xml"
  ],
  "maxUrlsPerSite": 10000,
  "includePatterns": [
    "/blog/"
  ],
  "checkStatus": false,
  "onlyNew": true,
  "monitorName": "competitor-blog"
}
```

#### Input fields

- **startUrls**: A domain (example.com), a home page or a sitemap URL. Sitemaps are discovered automatically.
- **includePatterns, excludePatterns**: Plain text matches anywhere in the URL. Wrap in slashes for a regular expression.
- **onlyNew**: First run saves everything as new. Later runs save only new, updated and removed URLs.

### Output example

```json
{
  "url": "https://www.example.com/blog/how-to-choose-a-crm",
  "lastmod": "2026-11-10T09:12:00+00:00",
  "changefreq": "weekly",
  "priority": 0.8,
  "changeType": "new",
  "previousLastmod": null,
  "imageCount": 2,
  "alternates": [
    {
      "hreflang": "de",
      "href": "https://www.example.com/de/blog/crm-auswahl"
    }
  ],
  "site": "www.example.com",
  "sitemapUrl": "https://www.example.com/post-sitemap.xml",
  "statusCode": 200,
  "redirectsTo": null,
  "scrapedAt": "2026-11-11T07:00:00.000Z"
}
```

#### Output fields

- **changeType**: new, updated or removed in change-detection mode, otherwise null.
- **statusCode, redirectsTo**: Only when Check HTTP status is on.
- **alternates**: hreflang language versions listed in the sitemap.

### Use it from your code or tools

**Apify API (cURL)**: start a run and get the results in one call:

```bash
curl -X POST "https://api.apify.com/v2/acts/adaptive_labs~sitemap-url-extractor/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"startUrls": ["https://apify.com"], "maxUrlsPerSite": 500}'
```

**JavaScript / TypeScript**

```javascript
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });
const run = await client.actor('adaptive_labs/sitemap-url-extractor').call({
  "startUrls": [
    "https://apify.com"
  ],
  "maxUrlsPerSite": 500
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

**Python**

```python
from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("adaptive_labs/sitemap-url-extractor").call(run_input={
  "startUrls": [
    "https://apify.com"
  ],
  "maxUrlsPerSite": 500
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

**No-code and AI agents**

- **Make, Zapier, n8n, Google Sheets, Slack**: use the Apify integration for your tool, pick this Actor and map the dataset fields.
- **Schedules and webhooks**: add the Actor to an Apify schedule (for example every morning) and send results anywhere with a webhook.
- **AI agents and MCP**: this Actor works with the Apify MCP server, so Claude, ChatGPT, Cursor and other MCP clients can call it as a tool. Clean, flat JSON output is easy for LLMs to read.
- **Export**: download results as JSON, CSV, Excel, XML or HTML from the Storage tab.

### FAQ

**What if the site has no sitemap?**
The Actor checks robots.txt and the common sitemap locations. If none exists it finishes with a clear message. You can also pass a sitemap URL directly.

**Does it support huge sites?**
Yes. Sitemap indexes with hundreds of files are followed. Use Max URLs per site and Max sitemap files to control run time.

**How does change detection work?**
The Actor remembers each URL and its lastmod under your monitor name. The next run with the same key saves only URLs that are new, have a different lastmod, or were removed.

**Can I find broken links in my sitemap?**
Yes. Tick Check HTTP status to add the status code and redirect target of every URL.

**Does it crawl the pages?**
No. It only reads sitemap files (and sends a HEAD request when status checks are on), so it is fast and light on the site.

### Pricing

This Actor is **free to use**. You only pay for your own Apify platform usage (compute), and small runs use very little compute, so light use fits within the free monthly credit on Apify's free plan.

### Feedback and support

We build and maintain this Actor at **Adaptive Labs** and we read every message.

- If it helped you, please **leave a quick review** on the Actor page. It really helps other people find it.
- Feature requests, bugs or a source you would like added: email **support@adaptivelabs.app** or open an issue on the Issues tab.

### Responsible use

This Actor reads public robots.txt and sitemap files that websites publish for search engines. It does not log in or bypass access controls. Keep request volumes reasonable, especially with status checks on large sites.

***

If this Actor saved you time, a quick review on Apify Store would mean a lot. Ideas or problems? Email support@adaptivelabs.app.

# Actor input Schema

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

Domains, home pages or direct sitemap URLs, one per line, for example example.com or https://example.com/sitemap.xml. Sitemaps are found through robots.txt and the usual locations. Sitemap indexes and .xml.gz files are followed automatically.

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

Stop after this many URLs from each site.

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

Optional. Keep URLs that contain any of these texts, for example /blog/ or /products/. Wrap in slashes for a regular expression, for example //20(25|26)//.

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

Optional. Drop URLs containing any of these texts or regular expressions.

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

Send a quick HEAD request to every URL and add its status code and redirect target. Great for finding broken or redirected URLs in a sitemap. Slower on big sites.

## `includeImages` (type: `boolean`):

Add the image URLs listed in image sitemaps.

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

Upper limit of sitemap files read per site (indexes can list hundreds).

## `onlyNew` (type: `boolean`):

Compare with the previous run that used the same monitor key and save only new URLs, URLs whose lastmod changed, and removed URLs. Schedule it daily to track new pages on any site.

## `reportRemoved` (type: `boolean`):

In change-detection mode, also list URLs that disappeared from the sitemap since the last run.

## `monitorName` (type: `string`):

Name of the saved state for change detection. Use a different key for each watch.

## Actor input object example

```json
{
  "startUrls": [
    "https://apify.com",
    "https://crawlee.dev"
  ],
  "maxUrlsPerSite": 50,
  "includePatterns": [],
  "excludePatterns": [],
  "checkStatus": false,
  "includeImages": false,
  "maxSitemaps": 200,
  "onlyNew": false,
  "reportRemoved": true,
  "monitorName": "default"
}
```

# Actor output Schema

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

Sitemap URLs (overview view).

# 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://apify.com",
        "https://crawlee.dev"
    ],
    "maxUrlsPerSite": 50,
    "includePatterns": [],
    "excludePatterns": []
};

// Run the Actor and wait for it to finish
const run = await client.actor("adaptive_labs/sitemap-url-extractor").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://apify.com",
        "https://crawlee.dev",
    ],
    "maxUrlsPerSite": 50,
    "includePatterns": [],
    "excludePatterns": [],
}

# Run the Actor and wait for it to finish
run = client.actor("adaptive_labs/sitemap-url-extractor").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://apify.com",
    "https://crawlee.dev"
  ],
  "maxUrlsPerSite": 50,
  "includePatterns": [],
  "excludePatterns": []
}' |
apify call adaptive_labs/sitemap-url-extractor --silent --output-dataset

```

## MCP server setup

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

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/RPGr2xK54J4hYH2CC/builds/d6dSnbovD23v5e2Nb/openapi.json
