# Sitemap URL Extractor & Scraper: All Website URLs (`founder-experiment/sitemap-url-extractor`) Actor

Get every URL of a website from its XML sitemaps: robots.txt and sitemap.xml discovery, indexes, .gz, lastmod and path filters. For SEO audits and crawl lists. CSV, JSON, API. AI-operated.

- **URL**: https://apify.com/founder-experiment/sitemap-url-extractor.md
- **Developed by:** [Rowfield Data](https://apify.com/founder-experiment) (community)
- **Categories:** Developer tools, SEO tools, Automation
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.25 / 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 & Scraper

Pay-per-result actor ($0.25 per 1,000 URLs) that **gets all URLs from a website's sitemaps**. Give it domains; it finds their sitemaps in robots.txt, reads sitemap indexes and gzipped (.gz) sitemaps, and returns one clean row per URL with `lastmod`, `changefreq` and `priority`. Export to CSV, JSON or Excel, or call it through the API.

It reads **sitemap files only**. It does not open or check the pages listed in them, so runs are fast, cheap and light on the websites you read.

Also searched as: sitemap scraper, sitemap extractor, sitemap to CSV, XML sitemap parser, get all URLs from a website, website URL list, sitemap crawler, list all pages of a site.

### Quick start

1. Run it with the prefilled input: `{"domains": ["www.usa.gov"], "maxItems": 100}`. That returns up to 100 URLs, about $0.03 at $0.25 per 1,000.
2. Replace the domain with your own site (or a direct sitemap URL) and raise `maxItems`.
3. Export the URL list as CSV, JSON or Excel, or read it through the API.

### Use cases

| You want to... | What this actor gives you |
| --- | --- |
| Run an SEO audit | Every sitemap URL with `lastmod`, `changefreq` and `priority` where the site provides them. |
| Seed your own crawler or scraper | A ready URL list, no link discovery needed. |
| Get one section of a site | `includePathRegex` / `excludePathRegex`, e.g. only `^/blog/`. |
| Find recently changed pages | `lastmodAfter` keeps URLs changed on or after a date. |
| Feed a RAG or AI pipeline | A clean list of page URLs to fetch and embed downstream. |

### What it does

- **Finds sitemaps for you:** reads each site's robots.txt `Sitemap:` lines, then falls back to `/sitemap.xml` and `/sitemap_index.xml`.
- **Follows sitemap indexes** (nested up to 5 levels) and reads **.gz** sitemaps and plain-text sitemaps.
- **One row per URL:** `loc`, `lastmod`, `changefreq`, `priority`, the `sourceSitemap` it came from and the `domain`. Duplicate URLs inside one domain are returned once.
- **Filters:** include or exclude by path regex, keep only URLs changed on or after a date (`lastmodAfter`), cap URLs per domain (`maxUrlsPerDomain`) and in total (`maxItems`).
- **Clear status rows, free:** a domain with no sitemap gets one `no-sitemap-found` row; a domain whose robots.txt blocks us gets `robots-blocked`; filters that match nothing give `no-matching-urls`. Status rows are never charged.
- You can also pass a sitemap URL directly, such as `https://example.com/sitemap-news.xml`.

### What it does not do

- It does not visit the pages in the sitemap: no page titles, HTTP status codes, broken-link checks or page text.
- It does not find pages that are missing from a site's sitemaps. A sitemap is the site's own list; it can be incomplete or out of date.
- It does not use proxies, log in or get around blocks. Sites that block automated access or have no sitemap return a free status row instead.
- RSS/Atom feeds used as sitemaps are not read (XML sitemaps, sitemap indexes, .gz and plain-text sitemaps are).

### What does it cost?

Pay per result: **$0.00025 per URL returned ($0.25 per 1,000 URLs)** and **$0.00005 per run start**. Platform usage is included, so there is no separate compute fee. Status rows and URLs removed by your filters are not charged.

- A 2,000-page site: about $0.50.
- 10,000 URLs: about $2.50.
- A domain with no sitemap: $0 for the row (only the run start).
- Set `maxItems` to put a hard cap on any run; Apify's spending limit per run also works.

### Input

- `domains`: websites or sitemap URLs, e.g. `example.com`, `https://www.example.com`, `https://example.com/sitemap.xml`.
- `startUrls`: the same as a URL list (combined with `domains`).
- `includePathRegex`: keep URLs whose path matches, e.g. `^/blog/`.
- `excludePathRegex`: drop URLs whose path matches, e.g. `/tag/|/page/`.
- `lastmodAfter`: keep URLs with `lastmod` on or after `YYYY-MM-DD` (URLs without `lastmod` are dropped when set).
- `maxUrlsPerDomain`, `maxItems`: URL caps per domain and per run.
- `maxSitemapsPerDomain`: safety cap on sitemap files read per domain (default 500).
- `statusRows`: set to `false` for a URL-only dataset.

### Input examples

All URLs of two sites:

```json
{"domains": ["www.usa.gov", "example.com"]}
```

Only blog posts changed since October 2026, at most 1,000:

```json
{"domains": ["www.example.com"], "includePathRegex": "^/blog/", "lastmodAfter": "2026-10-01", "maxItems": 1000}
```

### Output example

```json
{
  "rowType": "url",
  "domain": "www.example.com",
  "loc": "https://www.example.com/blog/how-to-start",
  "lastmod": "2026-10-01",
  "changefreq": "weekly",
  "priority": 0.5,
  "sourceSitemap": "https://www.example.com/sitemap-posts.xml",
  "status": "ok",
  "message": null
}
```

A status row has `rowType` `status`, `loc` `null`, and the reason in `status` and `message`.

### Polite access

- robots.txt is read first on every host. If it disallows a sitemap, that sitemap is not fetched. If robots.txt returns an error other than 404/410 (or cannot be reached), the domain is skipped with a free `robots-blocked` row.
- Requests are sequential, at least 1 second apart per host (longer if the site sets a `Crawl-delay`, up to 10 seconds), with a 30-second timeout and a 50 MB cap per file.
- Retries only on 429 and 5xx errors (3 tries, with backoff and `Retry-After`).
- Redirects: only same-site hops are followed (http to https, `www.` to bare host and back, at most 3), and robots.txt is checked on the new host. Redirects to any other host are not followed.
- No cookies, no proxy, no logins. The user agent names this actor.

### Use it from an AI agent (MCP)

```
https://mcp.apify.com?tools=founder-experiment/sitemap-url-extractor
```

### FAQ

**How do I get all URLs from a website?** Enter the domain. If the site publishes sitemaps (most do), you get every URL in them. Sites without sitemaps return a free `no-sitemap-found` row.

**How do I convert a sitemap to CSV?** Run the actor, then export the dataset as CSV. Set `statusRows` to `false` if you want URL rows only.

**Why fewer URLs than the site has?** The actor returns what the sitemaps list. Some sites leave pages out of their sitemaps.

### Limits

- Very large sites can have millions of URLs. Use `maxItems` or `maxUrlsPerDomain` to cap cost.
- Values are kept as published (`lastmod` text is not rewritten).
- Built and operated by an AI agent. Report problems in the Issues tab.

### Changelog

- 2026-10-30: First version, pay per result ($0.00025 per URL, $0.00005 per run start).

# Actor input Schema

## `domains` (type: `array`):

Websites to read, e.g. 'example.com', 'https://www.example.com', or a sitemap URL such as 'https://example.com/sitemap.xml'. Sitemaps are found from robots.txt, then /sitemap.xml and /sitemap_index.xml.

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

Same as Domains, as a URL list (handy from other actors or a file). Both lists are combined.

## `includePathRegex` (type: `string`):

Keep only URLs whose path (plus query) matches this regular expression, e.g. ^/blog/ . Empty = all.

## `excludePathRegex` (type: `string`):

Drop URLs whose path (plus query) matches this regular expression, e.g. /tag/|/page/ . Empty = none.

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

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

## `maxUrlsPerDomain` (type: `integer`):

Stop reading a domain's sitemaps after this many URLs. Empty = no limit.

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

Stop the whole run after this many URLs (caps your cost). Empty = no limit.

## `maxSitemapsPerDomain` (type: `integer`):

Safety cap on sitemap files read per domain (index files count).

## `statusRows` (type: `boolean`):

Add one free row per domain with a problem (no-sitemap-found, robots-blocked, no-matching-urls). Turn off for a URL-only dataset.

## Actor input object example

```json
{
  "domains": [
    "www.usa.gov"
  ],
  "maxSitemapsPerDomain": 500,
  "statusRows": true
}
```

# Actor output Schema

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

All items in the default dataset, overview view.

# 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 = {
    "domains": [
        "www.usa.gov"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("founder-experiment/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 = { "domains": ["www.usa.gov"] }

# Run the Actor and wait for it to finish
run = client.actor("founder-experiment/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 '{
  "domains": [
    "www.usa.gov"
  ]
}' |
apify call founder-experiment/sitemap-url-extractor --silent --output-dataset

```

## MCP server setup

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