# Sitemap URL Extractor: Bulk, Nested, With Status Check (`mossfetch/sitemap-url-extractor`) Actor

List every URL in sitemap.xml, nested sitemap indexes and .gz sitemaps for many domains. Finds sitemaps through robots.txt. Returns lastmod, changefreq, priority; optional status check per URL. $0.50 per 1,000 URLs.

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

## Pricing

Pay per event

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: Bulk, Nested, With Status Check

Sitemap.xml extractor: list every URL in sitemap.xml, nested sitemap indexes and .gz sitemaps for many domains. Use it when you need the full URL inventory of a site for an SEO audit, a crawl seed list or change monitoring. Give it domains; get every URL listed in their sitemaps. No login, no API key.

### Who it's for

- SEO teams building a URL list for an audit or a crawl.
- Developers who need a seed list for a crawler.
- Anyone monitoring a site for new or changed pages through `lastmod`.

### What it does

- Finds sitemaps through `robots.txt` (`Sitemap:` lines), then falls back to `/sitemap.xml` and `/sitemap_index.xml`.
- Follows sitemap indexes (nested up to 5 levels) and reads `.xml.gz` files.
- Returns `url`, `lastmod`, `changefreq`, `priority` and the sitemap file each URL came from. Also reads plain-text sitemaps.
- Optional status check: one request per URL adds `status`, `finalUrl` and `redirectCount`.
- Duplicate URLs within a site are removed.

### Input

| Field | Default | Notes |
|---|---|---|
| `sites` | required (empty runs a free 10-URL demo) | `example.com`, `https://example.com`, or a direct sitemap URL |
| `checkStatus` | off | adds the status-check price per URL |
| `stripQueryStrings` | on | removes `?query` from output URLs |
| `respectRobotsTxt` | on | applies to status checks |
| `maxUrlsPerSite` | 100000 | |
| `maxSitemapsPerSite` | 500 | |
| `maxItems` | none (prefilled with 50 on the Store form) | total cap, e.g. 1000 |

### Output example

```json
{"site":"nodejs.org","url":"https://nodejs.org/en/download/alpha","lastmod":"2026-11-22T15:14:57.313Z","changefreq":"always","priority":null,"sitemapUrl":"https://nodejs.org/sitemap.xml","status":200,"finalUrl":"https://nodejs.org/en/download/alpha","redirectCount":0,"statusError":null}
```

Set `checkStatus` to also get each URL's HTTP status. A run summary (sitemap files read, errors per site, why the run stopped) is saved as `RUN_SUMMARY` in the key-value store.

### Pricing

Pay per event: **$0.50 per 1,000 URLs extracted** (a 10,000-URL site costs $5, or $10 with the status check), plus **$0.50 per 1,000 URLs** if you turn on the status check. Status checks that fail (no HTTP answer) or are blocked by robots.txt are not charged. Set a spending limit on the run and the actor stops when it is reached.

### Fetch limits (read this)

- Only `robots.txt` and sitemap files of the sites you list (and the sitemap URLs inside them) are fetched. Pages are fetched only if you turn on the status check, and then with HEAD (GET if HEAD is refused). Page content is never stored.
- Identifying User-Agent `IncomeLabBot/1.0`. At most 5 requests in flight per host.
- With the status check on, URLs that `robots.txt` disallows for us are skipped (`statusError: blocked_by_robots`).
- Sitemaps larger than 60 MB unpacked are rejected. Redirects on sitemap files are followed up to 5 times; status checks follow up to 5.
- Localhost and private-network addresses are refused.
- Query strings are stripped by default.
- A site can still block our IP; the error appears in `RUN_SUMMARY`. We do not bypass CAPTCHAs, logins or blocks.
- Sitemaps list what the site owner wants indexed; they are not a complete crawl of the site.

### FAQ

**What if no sitemap is found?** The site gets an error entry in `RUN_SUMMARY` and no rows, so nothing is charged. You can also pass a direct sitemap URL.

**Is the first run cheap?** The Store form is prefilled with `nodejs.org` and `maxItems: 50`, so a trial costs at most $0.025.

### Use it from code (API)

```bash
curl -X POST "https://api.apify.com/v2/acts/mossfetch~sitemap-url-extractor/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"sites":["nodejs.org"],"maxItems":1000}'
```

Or with the JavaScript client: `await new ApifyClient({ token }).actor('mossfetch/sitemap-url-extractor').call(input)`, then read `defaultDatasetId`.

### Use in Make, n8n or Zapier

Run this Actor from Make, n8n or Zapier with an Apify account: add the Apify "Run Actor" step and select or enter the Actor `mossfetch/sitemap-url-extractor` (Actor ID `QwNNpjiOVPlooj955`). Pass the input as JSON, then read the dataset in the next step. Nothing else to install.

# Actor input Schema

## `sites` (type: `array`):

Domains (example.com), site URLs, or direct sitemap URLs (https://example.com/sitemap.xml.gz). For a domain the actor reads robots.txt, uses the Sitemap lines, and falls back to /sitemap.xml and /sitemap_index.xml.

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

Send one HEAD request (GET if HEAD is refused) per URL and add status, finalUrl and redirectCount. Adds the status-check price per URL. Respects robots.txt.

## `stripQueryStrings` (type: `boolean`):

Remove ?query parts from output URLs. On by default because query strings can hold personal data.

## `respectRobotsTxt` (type: `boolean`):

Skip status checks for URLs that robots.txt disallows for our user agent. Sitemap files themselves are always read.

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

Stop reading a site after this many unique URLs.

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

Safety cap for very large sitemap indexes.

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

Hard cap across all sites. Leave empty for no cap (the run's spending limit still applies). Example: 1000.

## `requestTimeoutSecs` (type: `integer`):

How long to wait for each HTTP response before giving up.

## Actor input object example

```json
{
  "sites": [
    "nodejs.org"
  ],
  "checkStatus": false,
  "stripQueryStrings": true,
  "respectRobotsTxt": true,
  "maxUrlsPerSite": 100000,
  "maxSitemapsPerSite": 500,
  "maxItems": 50,
  "requestTimeoutSecs": 15
}
```

# Actor output Schema

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

Every unique URL found in the sitemaps.

## `runSummary` (type: `string`):

Per-site sitemap counts, errors and why the run stopped.

# 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 = {
    "sites": [
        "nodejs.org"
    ],
    "maxItems": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("mossfetch/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 = {
    "sites": ["nodejs.org"],
    "maxItems": 50,
}

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

```

## MCP server setup

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