# Sitemap URL Extractor — Every URL from sitemap.xml, Fast (`fabrikit/sitemap-extractor`) Actor

Lists every URL a website publishes in its XML sitemaps: finds them via robots.txt and common paths, follows nested indexes and .gz files, outputs url, lastmod, changefreq, priority, image and hreflang data per row. Filters by pattern and date. No browser.

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

from $0.95 / 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.
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 — Every URL from sitemap.xml, Fast

Sitemap URL Extractor extracts every URL a website publishes in its XML sitemaps, from any site, over plain HTTP. Give it domains, page URLs or direct sitemap links: it finds the sitemaps through `robots.txt` and the usual locations, follows nested sitemap indexes, unpacks `.gz` files and saves one clean row per URL with `lastmod`, `changefreq`, `priority`, the sitemap it came from and the image, video and hreflang data attached to it. No browser, no crawling of the pages themselves: a site with 50,000 URLs is a handful of requests.

**Pricing:** pay per URL row; listing the sitemap files only (`onlySitemapList`) is charged per sitemap file instead. See the Pricing tab for current prices; paid Apify plans get lower rates.

### What you get

One row per URL:

| Field | Meaning |
|---|---|
| `url` | The page URL (`<loc>`) |
| `site` | Website the row belongs to (host without `www.`) |
| `sitemapUrl`, `sitemapType`, `depth` | File it was read from (`urlset`, `text`, `rss`, `atom`) and how deep in the index tree it sits |
| `lastmod` | `<lastmod>` normalised to ISO 8601 UTC (any offset or date-only value), or `null` |
| `changefreq`, `priority` | As published (`priority` as a number) |
| `imageCount`, `videoCount`, `alternateCount` | How many `<image:image>`, `<video:video>` and `hreflang` alternates the entry carries |
| `images`, `videos`, `alternates`, `news` | The full lists and Google News tags, when `includeDetails` is on |
| `title` | Entry title, for RSS / Atom feeds listed as sitemaps |

With **`onlySitemapList`** you get one row per sitemap file instead: `sitemapUrl`, `type` (index, urlset, text, rss, atom), `urlCount`, `sitemapCount`, `lastmod`, `depth`, `parentSitemapUrl`, `discoveredVia` (robots.txt, common-path, input, index), `statusCode`, `compressed`, `bytes` and `error`. Rows for files that could not be read are saved for free.

The key-value store also receives `SUMMARY` (counts, requests, stop reason) and `SITEMAPS` (per site: how the sitemaps were found, every file read with its type, URL count and size, and the reason when a site has no sitemap).

### How it works

1. **Discovery.** For a domain or page URL the Actor reads `robots.txt` and uses its `Sitemap:` lines. When there are none, it tries `/sitemap.xml`, `/sitemap_index.xml`, `/sitemap-index.xml`, `/wp-sitemap.xml` and `/sitemap.xml.gz` and stops at the first real sitemap. Direct sitemap, feed or `robots.txt` URLs are used as given.
2. **Indexes.** Sitemap indexes are followed recursively up to `maxDepth` levels and `maxSitemapsPerSite` files. Page sitemaps are read before image / video sitemaps, which only repeat page URLs.
3. **Formats.** XML `urlset` (with image, video, news and `xhtml:link hreflang` extensions), sitemap indexes, gzip files (both `.gz` bodies and `Content-Encoding: gzip`), RSS 2.0 and Atom feeds, plus plain-text URL lists.
4. **Filters and limits.** `includePatterns` / `excludePatterns` (glob, `/regex/` or substring), `lastmodFrom`, `maxUrlsPerSite` and an exact `maxItems`; duplicates are removed by URL.
5. **Politeness.** One request at a time per site with a short pause, timeouts, retries with backoff on 429 / 503 / 5xx, hard size limits (32 MB on the wire, 64 MB uncompressed per file).

### Input examples

All URLs of two sites (the default):

```json
{ "websites": ["https://nodejs.org", "https://apify.com"], "maxItems": 500 }
```

Blog posts changed this year, without release notes, with hreflang details:

```json
{
  "websites": ["nodejs.org"],
  "includePatterns": ["*/blog/*"],
  "excludePatterns": ["/\\/blog\\/release\\//"],
  "lastmodFrom": "2026-01-01",
  "includeDetails": true,
  "maxItems": 5000
}
```

Inventory of the sitemap files of several sites, 100 URLs per site at most:

```json
{
  "websites": ["www.gov.uk", "https://www.nytimes.com/sitemaps/new/sitemap.xml.gz", "https://ma.tt"],
  "onlySitemapList": true,
  "maxSitemapsPerSite": 100
}
```

A news sitemap or a feed as the source:

```json
{ "websites": ["https://www.theguardian.com/sitemaps/news.xml", "https://nodejs.org/en/feed/blog.xml"], "includeDetails": true }
```

### Output example

```json
{
  "url": "https://www.theguardian.com/business/live/2026/oct/21/uk-inflation-jump-rising-motor-fuels-cost-jackdaw-gas-field-latest-news-updates",
  "site": "theguardian.com",
  "sitemapUrl": "https://www.theguardian.com/sitemaps/news.xml",
  "sitemapType": "urlset",
  "depth": 0,
  "lastmod": "2026-10-21T07:18:00.000Z",
  "changefreq": "hourly",
  "priority": null,
  "title": null,
  "imageCount": 1,
  "videoCount": 0,
  "alternateCount": 0,
  "images": [{ "url": "https://i.guim.co.uk/img/media/0c7cfe3a3b22a5d0036436b1cf48014fee362edb/126_0_3780_3024/master/3780.jpg?width=1200&quality=85&auto=format&fit=max&s=a00f300ea7a6ce30a4b0fef14155ee74", "title": null, "caption": null }],
  "videos": [],
  "alternates": [],
  "news": { "publication": "The Guardian", "language": "en", "publicationDate": "2026-10-21T07:11:08.000Z", "title": "UK inflation jumps to 3.5% on rising motor fuels costs; UK approves Jackdaw gasfield – business live" },
  "scrapedAt": "2026-10-21T07:20:56.854Z"
}
```

### Use cases

- **SEO audits and migrations:** export the full URL inventory of a site, compare it with crawl data or Search Console, find orphan sections, check `lastmod` hygiene and hreflang coverage.
- **Content monitoring:** run it on a schedule with `lastmodFrom` to get the pages changed since yesterday from news sites, documentation or competitors.
- **Seed lists for crawlers and AI pipelines:** feed the URLs to [Website to Markdown Scraper](https://apify.com/fabrikit/website-to-markdown-scraper) (the same HTTP core this Actor is built on) or to any other scraper, filtered to the sections you care about.
- **Competitive research:** count product, category or article URLs across competitors in one run.

### Pricing

Pay per event, no subscription: one event per URL row, and one per sitemap row in list mode. See the Pricing tab for current prices; paid Apify plans get lower rates. The Apify platform adds its usual compute cost, which is small because the Actor only downloads XML files: the default run (500 URLs) takes a few seconds. `maxItems` is exact and the Actor also respects the run's maximum charge.

### Compared with alternatives

| | This Actor | Generic sitemap tools | Full website crawlers |
|---|---|---|---|
| Discovery | robots.txt + 5 common paths + nested indexes | often one fixed URL | crawl the HTML |
| Formats | XML, indexes, .gz, image / video / news / hreflang, RSS, Atom, text | usually XML only | n/a |
| Output | flat rows + per-site report | flat rows | page content |

Use a crawler when you need the page content; use this Actor when you need the list of URLs and their sitemap metadata.

### Integrations

Run it from the Apify API, the JavaScript and Python clients, the CLI, schedules and webhooks, and connect the dataset to Google Sheets, Make, Zapier, n8n, Airbyte or your own code. The Actor also works through the Apify MCP server, so an AI agent can ask for "all the documentation URLs of example.com changed this month".

### FAQ

**Is this legal?** Sitemaps are published by site owners precisely so that automated clients can read them; the Actor only downloads those public XML files and never loads the pages. Respect each site's terms for what you do with the data.

**Do I need a proxy?** Usually not: the default is direct requests. Choose Apify datacenter proxies in `proxyConfiguration` if a site rate-limits you. Residential proxies are refused on purpose, because sitemap files are large and their bandwidth would cost more than the rows.

**A site returns no rows.** Look at the `SITEMAPS` record: it tells whether `robots.txt` had no `Sitemap:` line and none of the common paths answered, whether the file was HTML or blocked, or whether your filters removed everything. Give the sitemap URL directly when you know it.

**Limits?** Up to 10,000 inputs per run, 2,000,000 rows, 5,000 sitemap files per site, 64 MB per file after decompression. Very large sites (hundreds of sitemap files) need `maxSitemapsPerSite` raised.

**URLs without `lastmod` and `lastmodFrom`.** They are dropped when the date filter is set, because nothing says when they changed.

### En español

Extrae todas las URL publicadas en los sitemaps XML de un sitio: descubre los sitemaps por `robots.txt` y rutas comunes, sigue índices anidados y archivos `.gz`, y entrega una fila por URL con `lastmod` (ISO), `changefreq`, `priority`, imágenes, vídeos y alternates hreflang. Filtra por patrón y fecha. Consulta la pestaña Pricing para ver los precios actuales; los planes de pago de Apify tienen tarifas más bajas.

### Changelog

- **0.1 (October 2026):** first release. Discovery via robots.txt and common paths, nested indexes, gzip, image / video / news / hreflang extensions, RSS / Atom feeds, text sitemaps, pattern and date filters, sitemap list mode, per-site report.

# Actor input Schema

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

One per line: a domain (example.com), a page URL (https://example.com/blog), a robots.txt URL, or a direct sitemap / feed URL (https://example.com/sitemap.xml, sitemap_index.xml, sitemap.xml.gz, sitemap.txt, RSS/Atom). Up to 10,000 lines per run.

## `onlySitemapList` (type: `boolean`):

Save one row per sitemap file found (type, URL count, child sitemaps, lastmod, size) instead of one row per URL. Charged per sitemap row ('sitemap-result') and much cheaper for a site inventory.

## `maxItems` (type: `integer`):

Stop after this many rows in total (URLs, or sitemaps in list mode). Exact: the run never saves or charges more.

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

Stop reading a site after this many of its URLs were saved. 0 = no per-site limit (only 'Maximum rows' applies).

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

How many sitemap files (indexes and children) to download per site. Large sites publish hundreds; raise it when you need the whole site.

## `maxDepth` (type: `integer`):

How many levels of nested sitemap indexes to follow (0 = read only the sitemaps given or listed in robots.txt, do not open indexes).

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

Keep only URLs matching at least one pattern: a glob (https://example.com/blog/\*, \* matches anything), a /regular expression/ (//product/\d+/) or a plain substring (/docs/). Case-insensitive. Empty = keep everything.

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

Drop URLs matching any pattern (same syntax as above), for example */tag/* or /.(pdf|jpg)$/.

## `lastmodFrom` (type: `string`):

Keep only URLs whose <lastmod> is on or after this date (YYYY-MM-DD or ISO 8601). URLs without lastmod are dropped when this is set.

## `includeDetails` (type: `boolean`):

Add the full lists: images (URL, title, caption), videos (URL, title, thumbnail, duration), hreflang alternates and Google News tags. Counts (imageCount, videoCount, alternateCount) are always included. Same price.

## `maxConcurrency` (type: `integer`):

How many websites are read at the same time. Within one site the requests are sequential and paced (polite by design).

## `proxyConfiguration` (type: `object`):

Sitemaps are public files, so the default is no proxy. Pick Apify datacenter proxies if your runs hit rate limits. Residential proxies are refused (large files, bandwidth would cost more than the rows).

## Actor input object example

```json
{
  "websites": [
    "https://nodejs.org",
    "https://apify.com"
  ],
  "onlySitemapList": false,
  "maxItems": 500,
  "maxUrlsPerSite": 0,
  "maxSitemapsPerSite": 50,
  "maxDepth": 5,
  "includeDetails": false,
  "maxConcurrency": 4,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

All rows collected during the run (one per URL, or one per sitemap file with onlySitemapList)

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

Counts of sites, sitemap files, URLs found, filtered and saved, requests and stop reason

## `sitemaps` (type: `string`):

For every input site: how its sitemaps were discovered, each file read (type, URL count, size) 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 = {
    "websites": [
        "https://nodejs.org",
        "https://apify.com"
    ],
    "maxItems": 500,
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("fabrikit/sitemap-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://nodejs.org",
        "https://apify.com",
    ],
    "maxItems": 500,
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("fabrikit/sitemap-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://nodejs.org",
    "https://apify.com"
  ],
  "maxItems": 500,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call fabrikit/sitemap-extractor --silent --output-dataset

```

## MCP server setup

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