# Sitemap URL Extractor: All Pages of Any Website (`spellzcode/sitemap-url-extractor`) Actor

List every page a website declares in its sitemaps. Finds the sitemaps automatically from robots.txt, follows sitemap indexes and gzipped files, and returns each address with its last-modified date. Filter by address and by modification date.

- **URL**: https://apify.com/spellzcode/sitemap-url-extractor.md
- **Developed by:** [Mårten Fitzback](https://apify.com/spellzcode) (community)
- **Categories:** SEO tools, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.21 / 1,000 page address returneds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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: All Pages of Any Website

Enter a website and get the full list of pages it declares in its sitemaps, each with its last-modified date. No crawling, so even sites with hundreds of thousands of pages finish in seconds to minutes.

**You pay only for page addresses returned**, after your filters are applied. Websites without a sitemap cost nothing.

### What it does

- **Finds the sitemaps for you** from the site's `robots.txt`, falling back to `/sitemap.xml` and `/sitemap_index.xml`. You can also give it a specific sitemap file.
- **Follows sitemap indexes** to any depth and reads gzipped sitemap files.
- **Removes duplicates** when the same page appears in several sitemaps.
- **Filters** by words in the address and by how recently the page changed.

### What you get for each page

| Field | What it is |
|---|---|
| `url` | The page address |
| `lastModified` | When the site says the page last changed, in standard date format |
| `changeFrequency`, `priority` | The sitemap's hints, where present |
| `website`, `sitemap` | The site and the sitemap file the entry came from |

### Input

```json
{
  "websites": ["https://docs.apify.com"],
  "urlContains": ["/academy/"],
  "modifiedWithinDays": 30,
  "maxUrlsPerWebsite": 5000
}
```

### Typical uses

- **Feed a scraper or AI pipeline:** get the exact list of pages to fetch, instead of crawling to discover them.
- **Content monitoring:** run daily with `modifiedWithinDays` set to 1 to see what a site published or changed.
- **SEO audits and migrations:** export every indexable address of a site, or compare two sites' structures.
- **Competitor research:** count a competitor's product, category or blog pages by filtering on the address.

### Pricing

$0.30 per 1,000 page addresses ($0.0003 each). One charge per page address returned.

A site with 20,000 pages costs $6. A filtered run that returns 500 addresses costs $0.15.

Each run also has a start charge of $0.00005. There is no separate charge for computing time. Apify's paid plans get 10% to 30% off these prices; the Pricing tab shows yours. Apify's free plan includes $5 of credit a month, which covers about 16,000 page addresses.

### Limits

- It lists what the website declares. Pages a site leaves out of its sitemaps are not found, and sites with no sitemap return nothing; those are listed in the run's `NO_SITEMAP` record.
- Last-modified dates are the site's own claims and are missing on some sites.

### Questions

#### Can I run it on a schedule?

Yes. Save your input as a task and add an Apify schedule, for example every morning.

#### How do I get the results into Excel or Google Sheets?

Every run's results can be downloaded as Excel, CSV or JSON from the run's Output tab. Apify's integrations with Make, Zapier, n8n and Google Sheets can pass them on automatically.

#### Can I call it from my own code or from an AI agent?

Yes. The API tab has ready-made code for Python, JavaScript and cURL, and the tool can be connected to AI agents through Apify's MCP server.

#### Something looks wrong or is missing

Open a report under the Issues tab and include the input you used.

# Actor input Schema

## `websites` (type: `array`):

One per line. Enter a website such as example.com and its sitemaps are found automatically, or enter the address of a specific sitemap file.

## `maxUrlsPerWebsite` (type: `integer`):

You are charged per address returned, so set this to cap the cost for very large sites.

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

Optional. Keep only addresses containing at least one of these, for example /blog/ or /product/.

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

Optional. Drop addresses containing any of these, for example /tag/ or ?page=.

## `modifiedWithinDays` (type: `integer`):

Optional. Keep only pages whose sitemap entry says they changed within this many days. Pages without a date are dropped when this is set.

## Actor input object example

```json
{
  "websites": [
    "https://docs.apify.com"
  ],
  "maxUrlsPerWebsite": 100000
}
```

# Actor output Schema

## `pages` (type: `string`):

One item per page address, with its last-modified date, change frequency, priority and the sitemap file it came from.

# 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 = {
    "websites": [
        "https://docs.apify.com"
    ]
};

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

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

```

## MCP server setup

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