# Sitemap URL Extractor - All URLs from Any Website's Sitemaps (`ennobling_spray/sitemap-urls`) Actor

Get every URL a website publishes in its XML sitemaps, with lastmod, changefreq and priority. Finds sitemaps via robots.txt, follows sitemap indexes and gzipped sitemaps. Pay only per URL returned.

- **URL**: https://apify.com/ennobling_spray/sitemap-urls.md
- **Developed by:** [Conor Wilson](https://apify.com/ennobling_spray) (community)
- **Categories:** SEO tools, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.20 / 1,000 urls

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

Get every URL a website publishes in its XML sitemaps, with `lastmod`, `changefreq` and `priority`. Give it a homepage and it finds the sitemaps itself through robots.txt, follows sitemap indexes, and reads gzipped and plain-text sitemaps.

**$0.20 per 1,000 URLs.** Websites with no sitemap are reported, never charged.

### Why this one

- **Automatic discovery.** Reads the `Sitemap:` lines in robots.txt, then falls back to `/sitemap.xml` and `/sitemap_index.xml`.
- **Handles real-world sitemaps.** Nested sitemap indexes, `.xml.gz` files, plain-text sitemaps, namespaces, and de-duplication across files.
- **Filters that save money.** Keep only URLs containing `/blog/` or `/products/`, or only pages modified since a date, and you're charged only for what's kept.
- **Reliable.** Built-in retries with backoff, safety caps on files and URLs, and one clear error row per website if something goes wrong.

### Quick start

```json
{
    "startUrls": [{ "url": "https://apify.com" }],
    "urlFilter": ["/blog/"],
    "modifiedSince": "2026-01-01",
    "maxUrls": 50000
}
```

### Use cases

- SEO audits and content inventories
- Feeding a crawler or URL-to-Markdown pipeline with every page of a site
- Monitoring a competitor's newly published pages with a daily schedule and `modifiedSince`
- Migration checks: compare old and new site URL lists

### Output

| Field | Description |
| --- | --- |
| `url` | Page URL listed in the sitemap |
| `lastmod`, `changefreq`, `priority` | As published by the site |
| `sitemap` | The sitemap file it came from |
| `website` | The website you supplied |
| `ok`, `error` | A per-website error row appears only if nothing could be read (free) |

### Input options

| Option | Default | Notes |
| --- | --- | --- |
| `startUrls` | required | Homepages or direct sitemap URLs |
| `urlFilter` | `[]` | Keep URLs containing any of these strings |
| `modifiedSince` | - | `YYYY-MM-DD`; URLs without `lastmod` are dropped when set |
| `maxUrls` | `50000` | Per website |
| `maxSitemaps` | `500` | Safety cap on sitemap files per website |

### Good use

Sitemaps are published so machines can read them. The actor still obeys robots.txt for its user agent `WilsDataTools` and never bypasses access controls.

### Pricing

Pay per event: one event per URL saved to the dataset after your filters.

# Actor input Schema

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

A homepage (sitemaps are discovered via robots.txt and /sitemap.xml) or a direct sitemap / sitemap index URL.

## `urlFilter` (type: `array`):

Keep only URLs that contain any of these strings, e.g. /blog/ or /products/.

## `modifiedSince` (type: `string`):

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

## `maxUrls` (type: `integer`):

Stop after this many URLs per website.

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

Safety cap on sitemap files followed per website.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://apify.com"
    }
  ],
  "urlFilter": [],
  "maxUrls": 50000,
  "maxSitemaps": 500
}
```

# Actor output Schema

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

Get every URL a website publishes in its XML sitemaps, with lastmod, changefreq and priority.

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

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

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

```

## MCP server setup

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

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/suzcAhL3Wh2hfAs8Z/builds/hob6XEZKPu358Xac0/openapi.json
