# Sitemap Extractor — Expand XML Sitemaps to URL Lists (`omao/sitemap-extractor`) Actor

Fetch any XML sitemap (or a domain) and get a clean list of all its URLs with lastmod, changefreq and priority. Follows sitemap indexes and gzipped sitemaps. Great for SEO and crawling.

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

## Pricing

from $0.72 / 1,000 sitemap 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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Sitemap Extractor — XML Sitemap URLs to Clean JSON

**Fetch any XML sitemap (or a whole domain) and get a clean list of all its URLs.** Point this actor at a sitemap or a domain and get back a tidy row per URL with `lastmod`, `changefreq` and `priority`. It follows sitemap indexes and unpacks gzipped sitemaps automatically. No setup, no anti-bot.

> AI-agent ready: this Actor is callable and payable by AI agents via [x402](https://docs.apify.com/platform/integrations/x402) (USDC on Base), no Apify account required.

The fast way to discover every URL on a site for SEO, crawling and migration.

### Who uses this

- 🔎 **SEO teams** — audit indexed URLs, `lastmod` freshness and priorities.
- 🕷️ **Crawlers & scrapers** — get a complete URL seed list before a crawl.
- 🔀 **Site migrations** — inventory every URL to map redirects.
- 🤖 **AI / LLM pipelines** — discover pages to ingest for a knowledge base.
- 🧑‍💻 **Developers** — a clean sitemap parser without handling XML/gzip yourself.

### What you get — one clean row per URL

| Field | Description |
|---|---|
| `loc` | The page URL |
| `lastmod` | Last-modified date |
| `changefreq` | Change frequency hint |
| `priority` | Priority hint (0.0–1.0) |
| `sitemap` | Source sitemap the URL came from |
| `ok`, `scrapedAt` | Status & provenance |

### Example

**Input**

```json
{ "sitemapUrls": ["https://www.apify.com/sitemap.xml"], "maxUrls": 5000 }
```

*(you can also pass a bare domain — the sitemap is discovered automatically)*

**Output (one item)**

```json
{
  "sitemap": "https://www.apify.com/sitemap.xml",
  "loc": "https://apify.com/store",
  "lastmod": "2026-07-01",
  "changefreq": "daily",
  "priority": 0.8
}
```

### Why this actor

- ✅ **Follows sitemap indexes** — expands nested sitemaps automatically.
- 🗜️ **Handles gzip** — unpacks `.xml.gz` sitemaps for you.
- 🌐 **Domain or sitemap URL** — pass either; it finds the sitemap.
- 🎯 **Cap the output** — set `maxUrls` for large sites.
- ⚡ **Fast & affordable** — pay only per URL returned. No setup, no anti-bot.

### Input options

- `sitemapUrls` *(required)* — sitemap URLs or bare domains.
- `maxUrls` — cap the total URLs returned (for very large sites).

### FAQ

**Does it follow sitemap index files?** Yes — nested sitemaps are expanded automatically.

**Gzipped sitemaps?** Yes — `.xml.gz` sitemaps are unpacked transparently.

**Can I pass a domain instead of a sitemap URL?** Yes — the sitemap is discovered from the domain.

**How fresh is the data?** Live — it fetches the sitemap in real time on every run.

**Can I export to CSV/Excel/Google Sheets?** Yes — the dataset exports to JSON, CSV, Excel and HTML, or pull it via the API.

**What does it cost?** Pay-per-URL — you're only charged for URLs actually returned.

***

*Tip: run this before a crawl to get a complete, deduplicated seed list of a site's pages.*

# Actor input Schema

## `sitemapUrls` (type: `array`):

Sitemap URLs (e.g. https://site.com/sitemap.xml) or bare domains (we try /sitemap.xml). Follows sitemap indexes and .gz.

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

Global cap on the number of URLs returned. Large sites publish sitemap indexes with hundreds of thousands of URLs, so this is capped by default — raise it if you need the full set.

## `healthCheckMode` (type: `boolean`):

Internal monitoring: expand a canary sitemap and FAIL if broken (no billing).

## Actor input object example

```json
{
  "sitemapUrls": [
    "https://www.apify.com/sitemap.xml",
    "example.com"
  ],
  "maxUrls": 1000,
  "healthCheckMode": false
}
```

# Actor output Schema

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

All URLs found in the sitemap(s) with lastmod, changefreq and priority.

# 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 = {
    "sitemapUrls": [
        "https://www.apify.com/sitemap.xml"
    ],
    "maxUrls": 1000
};

// Run the Actor and wait for it to finish
const run = await client.actor("omao/sitemap-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 = {
    "sitemapUrls": ["https://www.apify.com/sitemap.xml"],
    "maxUrls": 1000,
}

# Run the Actor and wait for it to finish
run = client.actor("omao/sitemap-extractor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "sitemapUrls": [
    "https://www.apify.com/sitemap.xml"
  ],
  "maxUrls": 1000
}' |
apify call omao/sitemap-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=omao/sitemap-extractor",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/uAzqRiIOGjBb4knat/builds/KD7IFtm0pcolO1aKW/openapi.json
