# Sitemap URL Extractor - Fast Bulk Sitemap Scraper (`oddnectary/sitemap-url-extractor`) Actor

Extract every URL from any website's XML sitemap for crawlers, RAG pipelines and SEO audits. Auto-discovers sitemaps from robots.txt, follows nested indexes, reads .gz files, returns URL, lastmod, changefreq and priority. Filter by pattern or date. No browser, no proxy.

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

## Pricing

from $0.30 / 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.
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

### What does Sitemap URL Extractor do?

**Extract every URL from any website's sitemap** in seconds. Give this Actor a domain or a sitemap URL and it returns a clean list of all pages with `lastmod`, `changefreq` and `priority`. It discovers sitemaps automatically from `robots.txt`, follows nested sitemap indexes, reads gzipped files, and handles sites with hundreds of thousands of URLs - without a browser and without proxies.

| | |
|---|---|
| **Input** | Website domains or sitemap URLs |
| **Output** | One row per URL: `url`, `lastmod`, `changefreq`, `priority`, source sitemap. JSON, CSV, Excel or API |
| **Price** | from $0.30 per 1,000 URLs, pay per result, cheaper on higher Apify plans |
| **Needs** | No proxy, no login, no API key |

### How to extract sitemap URLs

1. Open Sitemap URL Extractor in Apify Console and click **Try for free**.
2. Add one or more websites (`https://docs.apify.com`) or direct sitemap URLs (`https://example.com/sitemap_index.xml`).
3. Optional: keep or drop URLs by pattern, keep only pages modified after a date, and set a maximum number of URLs.
4. Click **Start**. Most runs finish in a few seconds.
5. Open the **Output** tab and export the dataset as JSON, CSV or Excel, or read it through the API.

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

**Pay per result: from $0.30 to $0.50 per 1,000 URLs.** No monthly rental, no platform usage on top.

| Your Apify plan | Price per 1,000 URLs |
|---|---|
| Free | $0.50 |
| Starter (Bronze) | $0.45 |
| Scale (Silver) | $0.40 |
| Business (Gold) and above | $0.30 |

Results removed by your filters are free: you only pay for what you receive. Use the max items input to cap spending.

### Why this sitemap extractor

- **Auto-discovery**: pass `example.com` and the Actor reads `robots.txt`, then tries the usual locations (`/sitemap.xml`, `/sitemap_index.xml`, `/wp-sitemap.xml`, `.gz` variants).
- **Every sitemap flavour**: `<urlset>`, `<sitemapindex>` (nested to any depth), gzip, plain-text sitemaps, and RSS/Atom feeds used as sitemaps.
- **Tolerant parser**: survives BOMs, CDATA, XML entities, namespaces and slightly broken XML that strict parsers reject.
- **Useful filters**: include/exclude URL patterns, child-sitemap patterns (read only `product` sitemaps, skip `image` ones) and a last-modified date filter.
- **Honest failures**: unreachable or blocked sitemap files are listed in the run summary instead of failing the whole run.

### What can you do with a list of sitemap URLs

- **Feed a crawler or a RAG pipeline** - get the complete, canonical URL list of a site before crawling it (works great as the first step for Website Content Crawler).
- **SEO audits and migrations** - export all indexable URLs, compare before and after a migration, find sections missing from the sitemap.
- **Content monitoring** - schedule a run with `modifiedAfter` to get only pages changed since your last check.
- **Competitor research** - count products, categories, blog posts or locations a competitor publishes, and watch them grow.
- **Hreflang and image checks** - optionally export the language alternates and image URLs declared for each page.

### Sitemap URL Extractor input

| Field | Type | Description |
|---|---|---|
| `startUrls` (required) | array of strings | Websites (`example.com`) or direct sitemap URLs. Mix freely. |
| `includePatterns` | array | Keep only URLs matching any pattern. |
| `excludePatterns` | array | Drop URLs matching any pattern. |
| `modifiedAfter` | date | Keep only URLs with `lastmod` on or after this date. |
| `sitemapIncludePatterns` | array | In sitemap indexes, read only child sitemaps matching these. |
| `sitemapExcludePatterns` | array | In sitemap indexes, skip child sitemaps matching these. |
| `maxDepth` | integer | Levels of nested indexes to follow (default 5). |
| `maxSitemaps` | integer | Safety limit on sitemap files per run (default 5000). |
| `includeImagesAndAlternates` | boolean | Add `images` and hreflang `alternates` to each item. |
| `deduplicate` | boolean | Return each URL once (default `true`). |
| `maxItems` | integer | Hard cap for the run. |

**Pattern syntax**: plain text matches anywhere in the URL (`/blog/`), `*` is a wildcard (`*/product/*`, `*.pdf`), and the `regex:` prefix enables a regular expression (`regex:/p/\d+$`). Matching is case-insensitive.

#### Example input

```json
{
    "startUrls": ["https://docs.apify.com", "https://example.com/sitemap_index.xml"],
    "includePatterns": ["/platform/"],
    "excludePatterns": ["*.pdf"],
    "modifiedAfter": "2026-01-01",
    "maxItems": 10000
}
```

### Sitemap url data output

One item per URL:

```json
{
    "url": "https://docs.apify.com/platform/actors",
    "lastmod": "2026-11-18T00:00:00.000Z",
    "changefreq": "weekly",
    "priority": 0.5,
    "sitemapUrl": "https://docs.apify.com/sitemap_base.xml",
    "source": "https://docs.apify.com"
}
```

With `includeImagesAndAlternates` enabled, each item also has `images` (array of image URLs) and `alternates` (array of `{ "hreflang", "href" }`).

A `RUN_SUMMARY` record in the key-value store reports sitemap files read, files that failed (with the reason), sites without a sitemap, URLs found and URLs saved.

### Limits and good to know

- The Actor reads sitemaps, it does not crawl pages. A site without a sitemap returns no URLs (and is reported in the summary).
- Some sites block datacenter traffic to their sitemap. The Actor reports those files as failed (for example `HTTP 403`) and does not try to bypass protections.
- Requests to the same host are spaced out and retried with backoff on `429` and `5xx`, so it stays polite on large sitemap trees.
- A single sitemap file larger than 60 MB uncompressed is skipped (the protocol limit is 50 MB).
- `lastmod`, `changefreq` and `priority` are returned as declared by the site; many sites omit them.

### FAQ about Sitemap URL Extractor

**Is this legal?** Sitemaps are files that websites publish specifically for automated readers. The Actor only reads `robots.txt` and sitemap files and collects no personal data.

**How do I crawl the pages afterwards?** Pass the resulting dataset to a crawler Actor (for example Website Content Crawler) as its start URLs.

**Can I use it through the API, with AI agents or in no-code tools?** Yes. Run it from the Apify API, the `apify-client` packages for JavaScript and Python, the Apify MCP server (Claude, ChatGPT, Cursor and other agents), or the Apify integrations for Make, n8n and Zapier. Schedules and webhooks are built into the platform.

**Which export formats are available?** JSON, JSON Lines, CSV, Excel, XML and RSS, from the dataset tab or the API.

**What happens when nothing is found or the input is wrong?** The run still finishes as succeeded, with a status message that says what was missing, and you are charged nothing for results that do not exist.

**Something is missing or broken?** Open an issue in the Issues tab of this Actor.

### More Actors from the same developer

| Actor | What it does |
|---|---|
| [Greenhouse Jobs Scraper](https://apify.com/oddnectary/greenhouse-jobs-scraper) | Get every open job from any company that hires through Greenhouse (Airbnb, Stripe, Anthropic and thousands more) via the official public Job Board API |
| [Ashby Jobs Scraper](https://apify.com/oddnectary/ashby-jobs-scraper) | Get every open job from any company that hires through Ashby (OpenAI, Notion, Ramp and thousands of startups) via the official public Job Postings API |
| [Lever Jobs Scraper](https://apify.com/oddnectary/lever-jobs-scraper) | Get every open job from any company that hires through Lever (jobs.lever.co), straight from the official public Postings API |
| [ATS Jobs Scraper](https://apify.com/oddnectary/ats-jobs-scraper) | Every open job at any company, in one run: type a company name and get all its open roles with title, team, location, posting date and pay range when published |
| [Remote Jobs Scraper](https://apify.com/oddnectary/remote-jobs-scraper) | Fresh remote jobs from 6 boards in one run |
| [Career Site Jobs Search](https://apify.com/oddnectary/career-site-jobs-search) | Search jobs on thousands of company career sites with one query, no company list: keywords, location, remote and date in, first-party jobs out |
| [Website Tech Stack Detector](https://apify.com/oddnectary/website-tech-stack-detector) | Detect the technologies behind any website in bulk |

### Disclaimer

This Actor is an independent tool. It is not affiliated with the websites whose sitemaps it reads, nor with any search engine or SEO product.

# Actor input Schema

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

Add a website (example.com) to auto-discover its sitemaps from robots.txt and the usual paths, or paste a direct sitemap URL (https://example.com/sitemap.xml, sitemap indexes and .gz files work too).

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

Keep only URLs that match at least one pattern. Use plain text (/blog/), a glob with \* (*/product/*) or a regular expression with the regex: prefix (regex:/p/\d+$).

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

Drop URLs that match any of these patterns (same syntax as above). Example: /tag/, \*.pdf

## `modifiedAfter` (type: `string`):

Keep only URLs whose lastmod is on or after this date. URLs without a lastmod are dropped when this filter is set.

## `sitemapIncludePatterns` (type: `array`):

When a sitemap index lists many child sitemaps, read only the ones matching these patterns (for example: product, post-sitemap). Saves time on large sites.

## `sitemapExcludePatterns` (type: `array`):

Do not read child sitemaps matching these patterns (for example: image, video, author).

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

How many levels of nested sitemap indexes to follow.

## `maxSitemaps` (type: `integer`):

Safety limit on the number of sitemap files fetched in one run.

## `includeImagesAndAlternates` (type: `boolean`):

Add the image URLs (image:loc) and language alternates (xhtml:link hreflang) listed for each page.

## `deduplicate` (type: `boolean`):

Return each URL once even when it appears in several sitemaps.

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

Hard cap for the whole run. Leave empty for no limit.

## Actor input object example

```json
{
  "startUrls": [
    "https://docs.apify.com"
  ],
  "maxDepth": 5,
  "maxSitemaps": 5000,
  "includeImagesAndAlternates": false,
  "deduplicate": true,
  "maxItems": 500
}
```

# Actor output Schema

## `results` (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://docs.apify.com"
    ],
    "maxItems": 500
};

// Run the Actor and wait for it to finish
const run = await client.actor("oddnectary/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": ["https://docs.apify.com"],
    "maxItems": 500,
}

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

```

## MCP server setup

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