# Sitemap Extractor: Every URL from XML Sitemaps (`steadyscrape/sitemap-extractor`) Actor

Sitemap extractor: every URL of a website from its XML sitemaps (found in robots.txt, indexes and .gz followed) with lastmod, images, videos, news and hreflang. Filter by URL pattern or date, get only new URLs, check each URL's HTTP status. Export to JSON, CSV or Excel, or via API.

- **URL**: https://apify.com/steadyscrape/sitemap-extractor.md
- **Developed by:** [Steady Scrape](https://apify.com/steadyscrape) (community)
- **Categories:** SEO tools, Developer tools, Marketing
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.20 / 1,000 url from a sitemaps

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 Extractor — every URL of a website from its XML sitemaps

This **sitemap extractor** takes a list of websites — domains like `example.com`, any page of a site, a `robots.txt`
link or a sitemap link — finds each site's **XML sitemaps** and returns **every URL they list, one row per URL**: its
**lastmod** date, **changefreq** and **priority**, the **image, video and Google News** details the sitemap carries,
its **hreflang** language versions, the **sitemap file** it came from and the site. Sitemaps are found in robots.txt's
`Sitemap:` lines, the home page's `<link rel="sitemap">` and the usual paths (`/sitemap.xml`, `/sitemap_index.xml`,
`/wp-sitemap.xml`, `.xml.gz`, `/sitemap.txt`); **sitemap indexes are followed** to every child sitemap.

Filter by **URL pattern** or by **lastmod in the last N days**, ask for **only the URLs not delivered before** (new
pages or products of a competitor, run on a schedule), and optionally **check each URL's HTTP status** (status code,
final URL after redirects, content type). **You pay per URL delivered**; a site with no sitemap, a sitemap robots.txt
forbids, a broken file or a wall is a free row that says why.

### What the sitemap URL extractor is for

- **SEO audits and site migrations**: the full list of URLs a site tells Google about, with their lastmod, priority and
  hreflang alternates, and with the status check on: the 404s, redirects and removed pages still in the sitemap.
- **Competitor monitoring**: new products, articles or landing pages the day they appear in a competitor's sitemap —
  turn on **Only URLs not delivered before** and schedule the run daily; filter to `/products/` or `/blog/`.
- **Content freshness**: what a site changed in the last week (`lastmodWithinDays: 7`).
- **Crawl seeding for AI / RAG pipelines and scrapers**: a clean, deduplicated URL list to feed a crawler, a page
  scraper or an embedding job, instead of crawling link by link.
- **News and video monitoring**: Google News sitemaps give each article's title, language and publication date;
  video sitemaps give each video's title, thumbnail and publication date.

### How the sitemap extractor works

1. **Start URLs**, one per line: a domain or any page (the site's sitemaps are found), a `robots.txt` link (its
   `Sitemap:` lines are read), or a sitemap link (that file alone, and the sitemaps it points to). Repeated lines are
   read once; a line that is no website is a free `invalid` row.
2. **Discovery**: the site's **robots.txt** first; when it names no sitemap (or none it names can be read), the page's
   **`<link rel="sitemap">`**; then the usual paths, asked in order until one holds a sitemap.
3. **Reading**: XML urlsets, **sitemap indexes** (followed up to **Most nested sitemap index levels**, 5 by default),
   **gzipped sitemaps** (`.xml.gz`, however the server sends them), **RSS and Atom feeds** (the sitemap protocol
   accepts both) and **text sitemaps** (one URL per line). Files stream in as they download, so a 50 MB sitemap of
   50,000 URLs never sits whole in memory. Real-world sitemaps with unescaped `&`, CDATA, comments or namespace
   prefixes are still read.
4. **Each URL once per site**, even when two sitemaps list it, then your **filters**: patterns to keep or leave out,
   the lastmod window, and only-new. Reading stops at **Most URLs per site**.
5. **Optional status check**: each URL asked with HEAD (GET when the server refuses HEAD), redirects followed to the
   final page, at **Status checks per second, per site** (5 by default) so no site is hammered.

**robots.txt is honoured for every file and page read**, as the [sitemap protocol](https://www.sitemaps.org/protocol.html)
and RFC 9309 ask: a sitemap or page robots.txt disallows is never requested, and while a site's robots.txt answers a
server error nothing of the site is read. The Actor identifies itself as `SteadyScrapeSitemaps`.

Measured on 2026-11-09: **ikea.com, 50,000 URLs from 12 sitemap files in 18 s**, every product with its 9 images and
its hreflang versions; the prefill (sitemaps.org and crawlee.dev, 50 URLs each) in about 2 s.

### Input example

```json
{
    "startUrls": ["allbirds.com", "https://www.bbc.com/sitemaps/https-index-com-news.xml"],
    "includeUrlPatterns": ["/products/", "/articles/"],
    "excludeUrlPatterns": ["*?variant=*"],
    "lastmodWithinDays": 7,
    "onlyNewUrls": true,
    "maxUrlsPerSite": 10000
}
```

Status check of a whole sitemap (broken links, redirects):

```json
{
    "startUrls": ["https://www.example.com/sitemap.xml"],
    "checkStatus": true,
    "statusChecksPerSecond": 5
}
```

**URL patterns**: text keeps URLs containing it (`/blog/`); `*` is a wildcard over the whole URL
(`https://shop.com/products/*`, `*.pdf`); `re:` starts a regular expression (`re:/p/\d+$`). Case is ignored. An
exclude pattern wins over an include pattern.

### Output example

One row per URL (a Shopify product sitemap):

```json
{
    "url": "https://www.allbirds.com/products/mens-wool-runners",
    "status": "ok",
    "reason": null,
    "site": "https://www.allbirds.com",
    "sitemapUrl": "https://www.allbirds.com/sitemap_products_1.xml?from=1878193471557&to=7369944137808",
    "lastmod": "2026-11-08T14:37:28-08:00",
    "changefreq": "daily",
    "priority": null,
    "images": [
        {
            "url": "https://cdn.shopify.com/s/files/1/1104/4168/files/Allbirds_WL_RN_SF_PDP_Natural_Grey_LAT.png?v=1751143404",
            "title": "Men's Wool Runner - Natural Grey (Light Grey Sole)",
            "caption": null
        }
    ],
    "videos": [],
    "news": null,
    "alternates": [],
    "statusCode": null,
    "finalUrl": null,
    "finalStatusCode": null,
    "contentType": null,
    "statusError": null,
    "input": "allbirds.com",
    "extractedAt": "2026-11-09T06:19:20.657Z"
}
```

A free row for a site without a sitemap:

```json
{
    "url": null,
    "status": "noSitemap",
    "reason": "No sitemap was found. Asked robots.txt and the page given: it names no sitemap, and none of /sitemap.xml, /sitemap_index.xml, /sitemap-index.xml, /wp-sitemap.xml, /sitemap.xml.gz, /sitemap.txt holds one; not charged",
    "site": "https://www.example.org",
    "input": "example.org"
}
```

The run's `SUMMARY` record (key-value store) gives, per site: how the sitemaps were found, files read, URLs listed and
delivered, and how many were left out by each filter, as duplicates or as already delivered.

### Output fields

| field | what it is |
|---|---|
| `url` | the page URL listed in the sitemap (`null` on a free row) |
| `status` | `ok` for a URL; free rows: `noSitemap`, `noUrls`, `notFound`, `robotsDisallowed`, `invalidSitemap`, `blocked`, `unreachable`, `invalid` |
| `reason` | why a free row has no URL |
| `site` | the site the start URL belongs to |
| `sitemapUrl` | the sitemap file the URL was listed in (or the file a free row is about) |
| `lastmod` | the last-modified date as the sitemap writes it (W3C datetime); for RSS/Atom feeds, the item's date in ISO 8601 |
| `changefreq`, `priority` | as the sitemap gives them (`priority` 0.0–1.0) |
| `images` | image sitemap entries: `url`, `title`, `caption` |
| `videos` | video sitemap entries: `title`, `description`, `thumbnailUrl`, `contentUrl`, `playerUrl`, `durationSeconds`, `publicationDate` |
| `news` | Google News: `publicationName`, `language`, `publicationDate`, `title`, `keywords` |
| `alternates` | hreflang versions: `hreflang`, `url` |
| `statusCode` | with the status check: the URL's own status code (301 for a redirect) |
| `finalUrl`, `finalStatusCode`, `contentType` | where redirects end, its status code and content type |
| `statusError` | why the check gave no status (no answer, robots.txt disallows the page, a private address) |
| `input`, `extractedAt` | the start line as given, and when the row was made (UTC) |

### Pricing

Pay per event, no start fee:

| event | price | when |
|---|---|---|
| `url` | US$0.0002 | each URL row delivered (US$0.20 per 1,000 URLs) |
| `url-with-status` | US$0.0006 | instead of `url`, when the status check is on and the site answered the URL |

Free rows are never charged, nor are URLs left out by your filters, repeated URLs, or URLs already delivered by an
earlier only-new run. A URL whose status check got no answer (or that robots.txt forbids checking) is charged the
plain `url` price. **Most URLs per site** and your run's spending limit cap the cost: at the limit the run stops and
says so. The first only-new run of a site delivers (and charges) every URL; the next ones only what is new.

### Related Actors

- [Website Contact Scraper](https://apify.com/steadyscrape/website-contact-scraper) — emails, phones and social
  profiles of the websites you find.
- [Lighthouse PageSpeed Checker](https://apify.com/steadyscrape/lighthouse-pagespeed-checker) — Core Web Vitals and
  Lighthouse scores of the URLs a sitemap lists.
- [Website Screenshot API](https://apify.com/steadyscrape/website-screenshot-api) — a screenshot of each page.
- [Semrush Website Traffic Checker](https://apify.com/steadyscrape/semrush-website-traffic-checker) — how much traffic
  each site gets.

### Free rows: walls, refusals and broken sitemaps

- A **bot check** (Cloudflare's "Just a moment", Shopify's "Verifying your connection"…) is a free `blocked` row: it
  is asked once and never solved. A plain refusal (403, 429, a server error, no answer) is asked once more, from
  another IP when one is available, before it becomes a free row.
- A sitemap link that answers a **web page** (an HTML "sitemap" page) or a file that is no sitemap is a free
  `invalidSitemap` row; a sitemap that answers **404** is `notFound`; a site with **no sitemap anywhere** is one
  `noSitemap` row naming what was asked.
- A sitemap whose **download breaks off** keeps the URLs read before it, plus a free row saying where it stopped.
- Links into **private networks** (localhost, 10.x, 192.168.x, cloud metadata) are refused without connecting.

### Limits

- Up to 5,000 start URLs per run and 1,000,000 URLs per site (`maxUrlsPerSite`, 100,000 by default).
- Up to 10,000 sitemap files per site (`maxSitemapsPerSite`, 1,000 by default) and 10 levels of nested indexes.
- A sitemap file is read up to 100 MB uncompressed (the protocol's limit is 50 MB); the status message says when one
  was cut.
- The only-new memory keeps the newest 1,500,000 URLs per site and set of URL patterns, in your account's key-value
  store `steadyscrape-sitemap-extractor-state` (opened only by only-new runs). Changing the patterns starts a new memory.
- URLs are taken as the sitemap lists them (relative links resolved against the sitemap file); pages that are not
  in any sitemap are not found — this Actor reads sitemaps, it does not crawl links.
- With the status check, 10,000 URLs at 5 checks per second take about 35 minutes: raise the run's timeout for big
  sites, or raise the pace for your own site.

### Is it legal?

Sitemaps and robots.txt are files a site publishes for crawlers to read, and this Actor reads nothing else (plus the
home page's head when robots.txt names no sitemap, and each page's status when you ask for it), honouring robots.txt
for every file and page. It does not log in, solve bot checks or read anything behind a wall. You are responsible for
how you use the URLs and for respecting each website's terms. This Actor is not affiliated with any of the websites
it reads, nor with sitemaps.org.

# Actor input Schema

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

One per line: a domain (<code>example.com</code>) or any page of the site, whose sitemaps are found in its robots.txt, its home page or the usual paths (<code>/sitemap.xml</code>, <code>/sitemap_index.xml</code>, <code>/wp-sitemap.xml</code>, <code>.xml.gz</code>, <code>/sitemap.txt</code>); a robots.txt link; or a sitemap link (XML, sitemap index, .gz, RSS/Atom feed or a text list of URLs) to read just that file and the sitemaps it points to. Up to 5,000 per run.

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

Reading stops once a site gave this many URLs (after the filters below). Each URL is one row and one charged event.

## `includeUrlPatterns` (type: `array`):

Keep a URL when it matches any of these. Text keeps URLs containing it (<code>/blog/</code>, <code>/products/</code>); <code>*</code> is a wildcard over the whole URL (<code>https://shop.com/products/*</code>, <code>\*.pdf</code>); <code>re:</code> starts a regular expression (<code>re:/p/\d+$</code>). Case is ignored. Leave empty to keep every URL.

## `excludeUrlPatterns` (type: `array`):

Leave a URL out when it matches any of these, written the same way as above (<code>/tag/</code>, <code>*?page=*</code>). An excluded URL is never charged.

## `lastmodWithinDays` (type: `integer`):

Keep only URLs whose sitemap <code>lastmod</code> date falls within this many days before the run, in whole days (7 keeps everything changed since midnight UTC seven days ago, so a date written without a time that day counts). URLs whose sitemap gives no lastmod are left out when this is set, and counted in the status message. Leave empty for every date.

## `onlyNewUrls` (type: `boolean`):

Remember every URL delivered for each site (and these URL patterns) in your own key-value store <code>steadyscrape-sitemap-extractor-state</code>, and on later runs deliver only URLs not seen before: a competitor's new pages, products or articles. The first run delivers (and charges) everything; schedule the next ones.

## `checkStatus` (type: `boolean`):

Ask every URL (a HEAD request, GET when the server refuses HEAD) and add its status code, the final URL after redirects, the final status code and the content type: broken links, redirects and removed pages in a sitemap. robots.txt is honoured for each page. Charged as url-with-status instead of url.

## `statusChecksPerSecond` (type: `integer`):

The pace of the status check on each site's host, so no site is hammered (1 to 20). 5 checks 10,000 URLs in about 35 minutes.

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

Sitemap files read per site, indexes and probes of the usual paths included (1 to 10,000).

## `maxSitemapDepth` (type: `integer`):

How deep sitemap indexes that point to other indexes are followed (0 reads only the files given or found, without following their indexes).

## Actor input object example

```json
{
  "startUrls": [
    "https://www.sitemaps.org",
    "https://crawlee.dev"
  ],
  "maxUrlsPerSite": 50,
  "onlyNewUrls": false,
  "checkStatus": false,
  "statusChecksPerSecond": 5,
  "maxSitemapsPerSite": 1000,
  "maxSitemapDepth": 5
}
```

# Actor output Schema

## `rows` (type: `string`):

No description

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

No description

# 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": [
        "https://www.sitemaps.org",
        "https://crawlee.dev"
    ],
    "maxUrlsPerSite": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("steadyscrape/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 = {
    "startUrls": [
        "https://www.sitemaps.org",
        "https://crawlee.dev",
    ],
    "maxUrlsPerSite": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("steadyscrape/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 '{
  "startUrls": [
    "https://www.sitemaps.org",
    "https://crawlee.dev"
  ],
  "maxUrlsPerSite": 50
}' |
apify call steadyscrape/sitemap-extractor --silent --output-dataset

```

## MCP server setup

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