# Sitemap URL Extractor - All URLs from Any Website (`mcpkit/sitemap-urls-extractor`) Actor

Extract all page URLs from any website's sitemap.xml: finds sitemaps via robots.txt, follows sitemap indexes and .gz files, filters by path and lastmod, and can check status codes. Clean JSON, CSV or TXT for AI agents, crawlers, n8n and SEO audits. Pay per URL.

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

## Pricing

from $0.12 / 1,000 urls extracted

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/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

### What is Sitemap URL Extractor

**Sitemap URL Extractor** gets all page URLs from any website's sitemap in one run. Pass a domain like `example.com` or a sitemap URL. The Actor finds the sitemaps in `robots.txt` and at standard paths, follows sitemap indexes, unpacks `.gz` files, filters the URLs by path and `lastmod` date and returns clean JSON, CSV or TXT. It can also check the HTTP status of every URL, so you can find broken (404) and redirected pages.

It reads sitemaps only and does not crawl or render pages, so it is fast and cheap: a sitemap with 50,000 URLs takes seconds.

- **Automatic sitemap discovery**: `Sitemap:` lines in robots.txt, then `/sitemap.xml`, `/sitemap_index.xml`, `/sitemap-index.xml`, `/wp-sitemap.xml` and `/sitemap/sitemap.xml`.
- **Sitemap indexes and .gz files**: nested indexes up to 5 levels, loops are detected, gzip is unpacked as it streams.
- **Image, video and news sitemaps**: image and video count per URL, Google News title and publication date.
- **Filters**: include and exclude patterns (regular expressions or globs like `*.pdf`), `lastmod` date range or a relative age like `7 days`.
- **Status check** (optional): status code, final URL and redirect flag for every URL.
- **Bulk input**: many domains in one run; URLs are deduplicated across all sitemaps.
- **Broken sitemaps**: invalid XML (for example raw `&` in URLs) is recovered, text sitemaps (one URL per line) are supported.
- **Built for pipelines and AI agents**: stable flat JSON, file output for large sites, limited permissions, pay per URL.

#### What you can use it for

- Get all blog posts or product pages of a site for RAG, LLM training data or a crawler.
- Find all PDF files on a website and pass them to [PDF to Markdown](https://apify.com/mcpkit/pdf-to-markdown).
- Monitor new pages: run on a schedule with `lastmodFrom: "1 day"`.
- SEO audit: find broken, redirected or outdated URLs in the sitemap.
- Count the pages of competitor websites.

### How to use Sitemap URL Extractor

#### Apify Console

1. Open the Actor and enter domains or sitemap URLs in **Domains or sitemap URLs**, for example `apify.com`.
2. Optionally set **Include URL patterns** (for example `/blog/`), a **lastmod** date range or turn on **Check HTTP status**.
3. Click **Start**. The URLs are in the **Output** tab. The `OUTPUT` record shows which sitemaps were read per domain.

#### API

```bash
curl -X POST "https://api.apify.com/v2/acts/mcpkit~sitemap-urls-extractor/run-sync-get-dataset-items?token=<APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"urls": ["apify.com"], "includePatterns": ["/store/"], "lastmodFrom": "30 days"}'
```

#### Apify MCP for Claude and Cursor

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com/?tools=mcpkit/sitemap-urls-extractor",
      "headers": { "Authorization": "Bearer <APIFY_TOKEN>" }
    }
  }
}
```

Then ask: *"List all blog posts on example.com published in November."* The agent calls the tool with `urls`, `includePatterns` and `lastmodFrom`/`lastmodTo` and reads the dataset.

#### n8n and Make

Use an HTTP Request node: method `POST`, URL `https://api.apify.com/v2/acts/mcpkit~sitemap-urls-extractor/run-sync-get-dataset-items`, query parameter `token` = your Apify API token, JSON body:

```json
{ "urls": ["{{ $json.domain }}"], "lastmodFrom": "1 day", "excludePatterns": ["/tag/", "/author/"] }
```

Each output item is one URL, ready for the next node.

#### Use with PDF to Markdown

Extract all PDF links from a website, then convert them:

1. Run this Actor with `{"urls": ["example.com"], "includePatterns": ["*.pdf"]}`.
2. Pass the `url` values to [PDF to Markdown](https://apify.com/mcpkit/pdf-to-markdown) as `{"urls": [...]}`.

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `urls` | array | required | Domains, page URLs or sitemap URLs (`.xml`, `.xml.gz`, `.txt`). Scheme, `www` and duplicates are normalized. |
| `includePatterns` | array | `[]` | Keep only URLs matching any pattern. Regex is searched anywhere in the URL; a pattern with `*` and no other regex syntax is a glob. Case-insensitive. |
| `excludePatterns` | array | `[]` | Drop URLs matching any pattern. |
| `lastmodFrom` | string | `""` | Keep URLs with `lastmod` on or after this date: `2026-11-01`, `2026-11-01T12:00:00Z` or `7 days`. |
| `lastmodTo` | string | `""` | Keep URLs with `lastmod` on or before this date (a date includes the whole day). |
| `requireLastmod` | boolean | `false` | With a date filter, drop URLs that have no `lastmod`. By default they are kept. |
| `maxUrls` | integer | `100000` | Stop after this many URLs (after filters and deduplication). Up to 1,000,000. |
| `checkStatus` | boolean | `false` | Request every URL (HEAD, then GET if needed) and add `statusCode`, `finalUrl`, `redirected`. |
| `outputTo` | string | `dataset` | `dataset`, `file` (only a file and one summary item) or `both`. |
| `outputFile` | string | `none` | `csv`, `txt` (one URL per line) or `jsonl`. CSV is used if `outputTo` needs a file and none is chosen. |

#### Input example

```json
{
  "urls": ["apify.com", "https://example.com/sitemap_index.xml"],
  "includePatterns": ["/blog/", "*.pdf"],
  "excludePatterns": ["/tag/"],
  "lastmodFrom": "2026-11-01",
  "checkStatus": false,
  "outputTo": "dataset"
}
```

### Output

#### Dataset

One item per URL. All fields are always present (`null` when there is no data):

```json
{
  "url": "https://apify.com/store/categories",
  "lastmod": "2026-11-30",
  "changefreq": "daily",
  "priority": 0.8,
  "imageCount": 0,
  "videoCount": 0,
  "newsTitle": null,
  "newsPublicationDate": null,
  "sitemapUrl": "https://apify.com/sitemap/pages.xml",
  "source": "apify.com",
  "statusCode": null,
  "finalUrl": null,
  "redirected": null,
  "success": true,
  "error": null
}
```

- `lastmod`, `changefreq`, `priority`: values from the sitemap, as written there.
- `sitemapUrl`: the sitemap file the URL came from; `source`: your input entry.
- `statusCode`, `finalUrl`, `redirected`: filled when `checkStatus` is on. A 404 URL is still a normal item with `statusCode: 404`; if the check itself fails, `error` says why.
- If no sitemap can be read for an input, you get one item with `success: false` and an `error` that says what to fix, for example `No sitemap found for example.com: checked robots.txt and /sitemap.xml, ...`. Error items are free.

#### File output (`outputTo: "file"`)

For large sites, use `"outputTo": "file"` with `"outputFile": "txt"` or `"csv"`. The URLs go to a file in the key-value store and the dataset holds one summary item with `resultFileUrl`, `urlsWritten`, `urlsFound`, `urlsFilteredOut`, `duplicatesRemoved`, `sitemapsRead`, `failedSources` and `error`. No dataset rows are written, so the run is faster.

#### OUTPUT report

The `OUTPUT` record in the key-value store has the totals and, per input: the robots.txt URL, sitemaps read and failed, URLs found and written, and the first errors (for example a child sitemap that returned HTTP 404).

### How much does it cost to extract URLs from a sitemap?

The Actor uses pay-per-event pricing. You pay for URLs in the result, not for URLs removed by filters or duplicates.

| Event | Free plan | Bronze | Silver | Gold |
|---|---|---|---|---|
| Actor start | $0.00005 | $0.00005 | $0.00005 | $0.00005 |
| URL extracted (`url`) | $0.0002 | $0.00018 | $0.00015 | $0.00012 |
| URL status checked (`status-check`, only with `checkStatus`) | $0.0003 | $0.00027 | $0.00024 | $0.0002 |

Examples on the Free plan:

- **100 URLs**: 100 × $0.0002 = **$0.02** (with status check: $0.05).
- **1,000 URLs**: **$0.20** (with status check: $0.50).
- **10,000 URLs**: **$2.00** (with status check: $5.00).

Set **Maximum cost per run** in the run options: the Actor stops at the limit and keeps everything extracted so far.

### FAQ

#### What if a site has no sitemap?

You get one free error item that lists what was checked. This Actor reads sitemaps only. Most CMS (WordPress, Shopify, Wix, Squarespace, Webflow) publish one automatically; try the sitemap URL directly if it is not linked from robots.txt.

#### How many URLs can it handle?

Up to 1,000,000 URLs per run (`maxUrls`). Sitemaps are parsed as they stream, so memory stays low; sitemap files over 50 MB (the protocol limit) are skipped with an error. For more than 100,000 URLs use `outputTo: "file"`.

#### Does it crawl pages?

No. It only reads sitemap files, which is why it is fast and cheap. With `checkStatus` it sends one HEAD request per URL to get the status code, without downloading the page.

#### How do I extract only PDFs or blog posts?

Use `includePatterns`: `["*.pdf"]` for PDF files, `["/blog/"]` for blog posts. Combine with `excludePatterns`, for example `["/blog/tag/", "/blog/page/"]`.

#### How do I get only new or updated pages?

Set `lastmodFrom` to a date or a relative age such as `"7 days"` and schedule the run. Note that some sites do not set `lastmod`; such URLs are kept unless `requireLastmod` is true.

#### Why did a site return HTTP 403 or 429?

Some sites block automated requests. The Actor identifies itself with an honest user agent, retries politely and does not bypass protection. The error is shown in the error item or in `OUTPUT`.

#### How is it different from other sitemap extractors?

It finds sitemaps itself, follows indexes and `.gz` files, recovers broken XML, filters by path and date, and charges only for URLs you keep. The status check is optional and charged separately, so a plain URL list costs less.

### Other tools from mcpkit

- [PDF to Markdown & Text Extractor for LLM & RAG](https://apify.com/mcpkit/pdf-to-markdown): PDF, Word, Excel, PowerPoint and scans (OCR) to Markdown, JSON tables and RAG chunks.
- [Website Tech Stack Detector & Technology Lookup](https://apify.com/mcpkit/tech-stack-detector): CMS, frameworks, analytics, hosting, email provider and SaaS tools of any website.
- [Merge, Dedupe & Transform Datasets to CSV & JSON](https://apify.com/mcpkit/merge-dedup-datasets): merge datasets and files, remove duplicates, filter and export CSV, JSONL or XLSX.

# Changelog

This Actor's version history is a separate document: https://apify.com/mcpkit/sitemap-urls-extractor/changelog.md

# Actor input Schema

## `urls` (type: `array`):

Domains, page URLs or sitemap URLs. For a domain or page URL the sitemaps are found via robots.txt and standard paths such as /sitemap.xml; a sitemap URL (.xml, .xml.gz, .txt) is read directly. Scheme, www and duplicates are normalized. Example: \["apify.com", "https://example.com/sitemap.xml"]

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

Keep only URLs matching any of these patterns (case-insensitive). A regular expression is searched anywhere in the URL; a pattern with \* and no other regex syntax is a glob. Example: \["/blog/", "\*.pdf"]

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

Drop URLs matching any of these patterns, same syntax as includePatterns. Example: \["\\.(jpg|png)$", "/tag/"]

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

Keep URLs whose sitemap lastmod is on or after this date: ISO date, ISO datetime or a relative age for scheduled runs. URLs without lastmod are kept unless requireLastmod is true. Example: "2026-11-01" or "7 days"

## `lastmodTo` (type: `string`):

Keep URLs whose sitemap lastmod is on or before this date (a date includes the whole day). Same formats as lastmodFrom. Example: "2026-11-30"

## `requireLastmod` (type: `boolean`):

When lastmodFrom or lastmodTo is set, drop URLs that have no lastmod in the sitemap. Example: false

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

Safety limit: stop after this many URLs are kept (after filters and deduplication). Example: 100000

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

Request every kept URL (HEAD, then GET if needed) and add statusCode, finalUrl and redirected: finds broken (404) and redirected URLs for SEO audits. Slower; charged per checked URL. Example: false

## `outputTo` (type: `string`):

dataset: one dataset item per URL. file: only a CSV, TXT or JSONL file in the key-value store plus one summary item with the file link (fast and cheap for large sites). both: dataset and file. Example: "dataset"

## `outputFile` (type: `string`):

Format of the result file when outputTo is file or both; csv is used if none is chosen. txt is one URL per line. Example: "csv"

## Actor input object example

```json
{
  "urls": [
    "https://apify.com/sitemap/pages.xml"
  ],
  "includePatterns": [
    "/store/"
  ],
  "excludePatterns": [],
  "lastmodFrom": "",
  "lastmodTo": "",
  "requireLastmod": false,
  "maxUrls": 100000,
  "checkStatus": false,
  "outputTo": "dataset",
  "outputFile": "none"
}
```

# Actor output Schema

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

No description

## `report` (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 = {
    "urls": [
        "https://apify.com/sitemap/pages.xml"
    ],
    "includePatterns": [
        "/store/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("mcpkit/sitemap-urls-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 = {
    "urls": ["https://apify.com/sitemap/pages.xml"],
    "includePatterns": ["/store/"],
}

# Run the Actor and wait for it to finish
run = client.actor("mcpkit/sitemap-urls-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 '{
  "urls": [
    "https://apify.com/sitemap/pages.xml"
  ],
  "includePatterns": [
    "/store/"
  ]
}' |
apify call mcpkit/sitemap-urls-extractor --silent --output-dataset

```

## MCP server setup

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