# Sitemap URL Extractor - All URLs from robots.txt & sitemaps (`propped_cloak/sitemap-url-extractor`) Actor

Extract every URL of a website from its sitemaps: robots.txt discovery, sitemap indexes, .xml.gz, lastmod, hreflang. Filters by pattern and date. $0.20 per 1,000 URLs.

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

## Pricing

from $0.16 / 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 - All URLs from robots.txt & sitemaps

Get **every URL of a website** in seconds, straight from its sitemaps, with **last modified date, change frequency, priority and hreflang alternates**. Type a domain: the Actor finds the sitemaps, follows the sitemap indexes, unzips `.xml.gz` files and returns one clean row per URL.

- **Finds the sitemaps for you.** It reads the `Sitemap:` lines of robots.txt, then tries `/sitemap.xml`, `/sitemap_index.xml`, `/sitemap-index.xml`, `/wp-sitemap.xml` and `/sitemap.txt`. You can also give sitemap URLs directly.
- **Handles real-world sitemaps.** Nested sitemap indexes (up to 1,000 sitemaps per site), gzip files, CDATA, XML entities, text sitemaps (one URL per line) and files up to 60 MB.
- **Never fails silently.** When a site has no sitemap, or a sitemap returns 404, you get a row that says so. Error rows are free.
- **Fast and cheap.** Plain HTTP, no browser: 20,000 URLs from 56 sitemaps took 17 seconds in our test. **$0.20 per 1,000 URLs.**

### What can I use it for?

- **Crawl planning:** get the full URL list of a site before scraping or auditing it, and filter to the sections you need.
- **SEO audits:** find pages with an old `lastmod`, check hreflang coverage, or compare the URLs in the sitemap with the pages Google indexed.
- **Content monitoring:** schedule a daily run with `lastmodFrom` to get only the new or updated pages of a competitor's blog.
- **Link checking:** send the URLs to [Bulk URL Status Checker](https://apify.com/propped_cloak/bulk-url-status-checker) to find 404s and redirects.

### Input

```json
{
    "startUrls": ["wordpress.org", "https://example.com/post-sitemap.xml"],
    "maxUrls": 100000,
    "maxUrlsPerSite": 5000,
    "includePattern": "/news/",
    "excludePattern": "/tag/|/page/",
    "lastmodFrom": "2026-01-01"
}
```

A domain or a page URL is treated as a website, and its sitemaps are discovered from the root of the domain. Use `includePattern` to keep one section, for example `/news/`. With several websites, `maxUrlsPerSite` gives each one its share of `maxUrls`. URLs are deduplicated across all sitemaps and websites.

### Output

One row per URL. Example from a real run:

```json
{
    "url": "https://wordpress.org/about/privacy/cookies/",
    "lastmod": "2026-09-01T12:37:54Z",
    "changefreq": null,
    "priority": null,
    "sitemap": "https://wordpress.org/sitemap-1.xml",
    "site": "https://wordpress.org"
}
```

When a sitemap declares hreflang versions, the row also has `"alternates": [{ "hreflang": "fr", "href": "..." }]`. Error rows have `site`, `sitemap` and `error` only.

### Pricing

**$0.0002 per URL extracted ($0.20 per 1,000 URLs)**, plus Apify's small run-start fee. Error rows (no sitemap found, sitemap unreachable) are free. Use `maxUrls` to cap the cost of a run.

### Fair use and safety

The Actor only downloads robots.txt and sitemap files, which are published for robots. It never visits the pages themselves. Private and internal network addresses are refused.

### Use it from AI agents (MCP)

Add `sitemap-url-extractor` to the [Apify MCP server](https://mcp.apify.com) in your MCP client (Claude, Cursor, VS Code...), so your agent can list the pages of any website before reading them.

### Integrations

Apify API, schedules, webhooks, Make, Zapier, n8n. Export as JSON, CSV, Excel or HTML.

### FAQ

**The site has no sitemap. What can I do?** Some sites (python.org, for example) don't publish one. In that case, use a crawler such as Apify's Website Content Crawler.

**Why fewer URLs than the site really has?** A sitemap only lists the pages its owner chose to declare. Pages missing from it are not discovered.

**Something wrong or missing?** Open an issue on the Issues tab.

# Actor input Schema

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

A website (example.com): its sitemaps are found through robots.txt, then /sitemap.xml, /sitemap_index.xml and /wp-sitemap.xml. Or a sitemap URL directly (.xml, .xml.gz or .txt). Sitemap indexes are followed.

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

Stop after this many URLs (all websites together).

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

Optional. Stop each website after this many URLs, so that every website of the list gets its share of the run. Empty: no limit per website.

## `includePattern` (type: `string`):

Optional regular expression, case-insensitive. Example: /blog/

## `excludePattern` (type: `string`):

Optional regular expression, case-insensitive. Example: /tag/|/page/

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

Optional date (YYYY-MM-DD). URLs without a lastmod date are skipped when this is set.

## Actor input object example

```json
{
  "startUrls": [
    "apify.com"
  ],
  "maxUrls": 100000
}
```

# Actor output Schema

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

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

# 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"
    ]
};

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

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

```

## MCP server setup

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