# Sitemap URL Extractor: Every URL From Any Website's Sitemaps (`evenwork/sitemap-url-extractor-all-urls`) Actor

Get every URL a website lists in its sitemaps. Finds sitemaps through robots.txt and common paths, reads index files and .gz files, and returns each URL with lastmod, changefreq, priority and hreflang alternates.

- **URL**: https://apify.com/evenwork/sitemap-url-extractor-all-urls.md
- **Developed by:** [Evenwork](https://apify.com/evenwork) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.30 / 1,000 url extracteds

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/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: Every URL From Any Website's Sitemaps

Give it a list of domains, sitemap URLs or any page on the site. It finds each site's sitemaps, reads every file they point to, and returns one row per URL with the lastmod date, change frequency, priority, image count and hreflang alternates.

Use it to get a full page list for an SEO audit or a site migration, to feed a crawler or a broken-link check, to see what a competitor has published, or to pick out pages changed since a date.

### How it finds sitemaps

1. If you give a sitemap URL (anything ending in `.xml`, `.xml.gz` or `.txt`, or with "sitemap" in the file name), it reads that file directly.
2. Otherwise it reads `robots.txt` and follows every `Sitemap:` line.
3. If robots.txt lists none, it tries `/sitemap.xml`, `/sitemap_index.xml`, `/sitemap-index.xml`, `/wp-sitemap.xml` and `/sitemap.txt`, and uses the first real sitemap it finds.

Sitemap index files are followed to the files they list, up to 5 levels deep, and each file is read once even if it is listed twice. When it looks for sitemaps and https:// can't be reached, it tries http://.

### What it reads

| Format | Notes |
|---|---|
| XML sitemaps and sitemap index files | Standard sitemaps.org format, with or without the namespace |
| Gzipped sitemaps (`.xml.gz`) | Decompressed automatically, up to the protocol's 50 MB limit |
| Plain text sitemaps | One URL per line |
| RSS 2.0 and Atom feeds | Both are allowed as sitemaps by the protocol |
| Image and hreflang extensions | Image count per URL and every `xhtml:link rel="alternate"` |
| Broken XML | If a file won't parse (an unescaped `&` is the usual cause), URLs are read from the `<loc>` tags one by one, and a note goes in the summary |

HTML pages served with a 200 status at `/sitemap.xml` (a common "soft 404") are recognised and skipped.

### Input

```json
{
  "startUrls": ["example.com", "https://www.example.co.uk/post-sitemap.xml"],
  "maxUrlsPerSite": 50000,
  "includeRegex": "/blog/",
  "excludeRegex": "\\?",
  "lastmodAfter": "2026-10-01",
  "includeAlternates": true
}
```

Only `startUrls` is required. Entries for the same site are merged into one job. `includeRegex`, `excludeRegex` and `lastmodAfter` are applied before anything is saved, so skipped URLs are not charged. With `lastmodAfter` set, URLs that have no lastmod are skipped. Each URL is returned once per site, even if several sitemaps list it.

### Output

One row per URL:

```json
{
  "site": "https://www.example.co.uk",
  "url": "https://www.example.co.uk/blog/winter-opening-hours/",
  "lastmod": "2026-11-20T09:14:00+00:00",
  "changefreq": "monthly",
  "priority": "0.6",
  "imageCount": 2,
  "sitemap": "https://www.example.co.uk/post-sitemap.xml",
  "alternates": [{"hreflang": "cy", "url": "https://www.example.co.uk/cy/blog/oriau-agor-y-gaeaf/"}]
}
```

`lastmod`, `changefreq` and `priority` are `null` when the sitemap leaves them out. A site where no sitemap could be found or read gets one row with `url: null` and an `error`, and that row is not charged.

The run's key-value store also holds a `SUMMARY` record with one entry per site: where the sitemaps came from (robots.txt, a guessed path or your input), how many sitemap files were found and read, the URL count, whether a limit cut the run short, and every file that failed with its reason.

### Pricing

Pay per event: $0.0003 for each URL returned, plus Apify's start charge of $0.00005 a run (once per GB of memory; the default is under 1 GB). 10,000 URLs cost $3. Rows for sites with no sitemap are not charged. Set a maximum charge for the run in Apify and the actor stops cleanly when it is reached.

### Limits

- It reads what the site's sitemaps list. Pages the site leaves out of its sitemaps won't appear, so it isn't a crawler.
- Up to 1,000,000 URLs and 10,000 sitemap files per site (defaults 50,000 and 1,000).
- Sitemap files over 50 MB, the protocol limit, are skipped and named in the summary.
- Some sites block automated requests. Those files show up as errors in the summary with the HTTP status.
- Only http and https files on the public internet are fetched. A sitemap or redirect that points at a private, loopback or reserved IP is skipped and named in the summary.

### Responsible use

The actor only requests robots.txt and sitemap files, which sites publish for automated readers. It doesn't open the pages themselves. You are responsible for how you use the URLs you collect.

# Actor input Schema

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

A domain (example.com), any page on the site, or a sitemap URL. For a domain or page, sitemaps are found through robots.txt, then common paths such as /sitemap.xml. A sitemap URL is read directly. Duplicates are removed.

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

1 to 1,000,000. Each URL returned is one charged result.

## `includeRegex` (type: `string`):

Optional regular expression, for example /blog/ or .pdf$. URLs that don't match are skipped and not charged.

## `excludeRegex` (type: `string`):

Optional regular expression. Matching URLs are skipped and not charged.

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

Optional date as YYYY-MM-DD. Uses the sitemap's lastmod. URLs with no lastmod are skipped when this is set.

## `includeAlternates` (type: `boolean`):

Add the hreflang alternate links listed for each URL.

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

1 to 10,000. Sitemap index files can point to thousands of files.

## `concurrency` (type: `integer`):

1 to 20.

## `timeoutSecs` (type: `integer`):

5 to 120.

## `userAgent` (type: `string`):

Optional. The User-Agent header sent with each request.

## Actor input object example

```json
{
  "startUrls": [
    "apify.com",
    "https://www.gov.uk/sitemap.xml"
  ],
  "maxUrlsPerSite": 50000,
  "includeAlternates": true,
  "maxSitemapsPerSite": 1000,
  "concurrency": 5,
  "timeoutSecs": 30
}
```

# Actor output Schema

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

One row per URL found in the site's sitemaps, with lastmod, changefreq, priority and the sitemap it came from.

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

Sitemaps read, URL counts and anything skipped, per site.

# 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": [
        "apify.com",
        "https://www.gov.uk/sitemap.xml"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("evenwork/sitemap-url-extractor-all-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": [
        "apify.com",
        "https://www.gov.uk/sitemap.xml",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("evenwork/sitemap-url-extractor-all-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": [
    "apify.com",
    "https://www.gov.uk/sitemap.xml"
  ]
}' |
apify call evenwork/sitemap-url-extractor-all-urls --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,evenwork/sitemap-url-extractor-all-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/ogralGh2Vz8p4A5gi/builds/jNx6u2wGLBK405yGs/openapi.json
