# Sitemap URL Extractor (`properscraper/sitemap-url-extractor`) Actor

List every page a website publishes in its sitemaps. Finds the sitemaps from robots.txt, follows sitemap indexes and gzip files, and returns each URL with its last-modified date.

- **URL**: https://apify.com/properscraper/sitemap-url-extractor.md
- **Developed by:** [jake mcclure](https://apify.com/properscraper) (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

from $0.05 / 1,000 url saveds

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 URL Extractor

List every page a website publishes in its sitemaps. Give it a website and it finds the sitemaps, follows them all the way down, and returns each URL with its last-modified date.

Sitemaps are files a website publishes so that search engines and other programs can discover its pages. This Actor reads those files; it does not crawl the site's pages.

Use it to:

- get a complete list of a site's pages before crawling or auditing it
- find new or recently changed pages by their last-modified date
- count and compare the content of sites (how many products, articles, docs pages)
- feed URLs into another scraper

### Input

| Field | What it does |
|---|---|
| **Websites or sitemaps** | One per line. A website (`docs.apify.com`) or the address of one sitemap file (`https://example.com/sitemap.xml`). |
| **Maximum URLs per website** | Stop after this many matching URLs per website. 0 means no limit. |
| **URL contains** | Keep only URLs containing one of these pieces of text, for example `/blog/`. |
| **URL does not contain** | Drop URLs containing any of these, for example `/tag/`. |
| **Modified on or after** | Keep only URLs modified since this date, according to the sitemap. |

For a website, the Actor reads `robots.txt` to find the sitemaps the site names. If there are none, it tries `/sitemap.xml`, `/sitemap_index.xml` and `/wp-sitemap.xml`.

```json
{
    "sites": ["https://docs.apify.com", "https://example.com/sitemap-products.xml"],
    "urlContains": ["/academy/"],
    "modifiedAfter": "2026-10-01"
}
```

### Output

One record per URL:

```json
{
    "site": "docs.apify.com",
    "url": "https://docs.apify.com/academy/web-scraping-for-beginners",
    "lastModified": "2026-11-03T00:00:00.000Z",
    "changeFrequency": "weekly",
    "priority": 0.5,
    "sitemap": "https://docs.apify.com/sitemap.xml",
    "scrapedAt": "2026-11-11T20:00:00.000Z"
}
```

`lastModified`, `changeFrequency` and `priority` are whatever the site put in its sitemap, and are `null` when it left them out. `sitemap` is the file the URL was found in.

A `SUMMARY` record in the run's key-value store lists, for each website, how many sitemap files were read, how many could not be read, how many URLs were found and saved, and any error.

### What it handles

- sitemap index files, nested up to five levels
- gzip-compressed sitemaps (`.xml.gz`)
- plain-text sitemaps (one URL per line)
- several sitemaps named in `robots.txt`
- the same URL appearing in more than one sitemap (returned once)
- a broken sitemap among working ones (skipped and counted, the rest still read)

### Pricing

Pay per result. You are charged once for each URL saved to the dataset, at the per-result price shown on this page.

You are not charged for URLs removed by your filters or for websites with no sitemap. The run stops as soon as it reaches the maximum charge you set for it.

### Limits

- Only pages the site lists in its sitemaps are returned. Pages a site leaves out of its sitemaps will not appear.
- Not every website has a sitemap. For those the run reports that none was found.
- Last-modified dates are only as accurate as the site makes them.
- At most 1,000 sitemap files are read per website.
- Sitemap files of one website are fetched one at a time with a short pause, so a site with hundreds of sitemap files takes a few minutes.

### Is this allowed?

Sitemaps are published for programs to read. The Actor fetches only `robots.txt` and the sitemap files, without logging in, at a gentle pace. You are responsible for how you use the data.

# Actor input Schema

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

One per line. A website (docs.apify.com), whose sitemaps are found from robots.txt, or the address of one sitemap file (https://example.com/sitemap.xml).

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

Stop after this many matching URLs for each website. 0 means no limit.

## `urlContains` (type: `array`):

Only keep URLs containing at least one of these pieces of text, for example /blog/ or /products/. Not case sensitive.

## `urlExcludes` (type: `array`):

Drop URLs containing any of these pieces of text, for example /tag/ or ?page=.

## `modifiedAfter` (type: `string`):

Only keep URLs whose sitemap entry says they were modified on or after this date (YYYY-MM-DD). URLs with no date are left out when this is set.

## Actor input object example

```json
{
  "sites": [
    "https://docs.apify.com"
  ],
  "maxUrlsPerSite": 0
}
```

# Actor output Schema

## `urls` (type: `string`):

Every URL saved by the run, one record per URL.

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

Totals for the run and, for each website, how many results were saved and any error.

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

// Run the Actor and wait for it to finish
const run = await client.actor("properscraper/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 = { "sites": ["https://docs.apify.com"] }

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

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,properscraper/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/AIPiPozinKw3kZsUF/builds/ec4Q8U61B6RSmn1Wi/openapi.json
