# Sitemap URL Extractor – All URLs with lastmod (`kernfetch/sitemap-url-extractor`) Actor

Extract every URL from any website's sitemaps. Auto-discovers sitemaps via robots.txt, follows nested sitemap indexes and reads .xml, .xml.gz and .txt files. Returns lastmod, changefreq and priority, with date and regex filters. Fast, cheap and reliable: ideal for SEO audits and AI agents.

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

## Pricing

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

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 – get every URL of a website, with lastmod

Extract **all URLs listed in a website's sitemaps** in seconds. Just enter a domain: the Actor finds the sitemaps on its own (robots.txt + common locations), follows **nested sitemap indexes**, reads **.xml, .xml.gz and .txt** sitemaps and returns a clean list with `lastmod`, `changefreq` and `priority`.

Built for **SEO audits, content inventories, competitor monitoring, site migrations and feeding AI agents / RAG pipelines** with the full list of pages of a site.

### Why this Actor

- ⚡ **Fast and cheap** – sitemaps only, no page downloads. Thousands of URLs in a few seconds.
- 🔎 **Automatic discovery** – `Sitemap:` lines in robots.txt, then `/sitemap.xml`, `/sitemap_index.xml`, `/wp-sitemap.xml`, `/sitemap.txt`…
- 🧩 **Handles real-world sitemaps** – nested indexes (up to 5 levels), gzip, plain-text sitemaps, relative links, duplicates removed.
- 🗓️ **"Modified after" filter** – get only the pages changed since a date. Perfect to see **what a competitor published or updated recently**.
- 🎯 **Include / exclude regex** – e.g. keep only `/blog/`, drop `/tag/|/author/`.
- 🌐 **Many sites in one run** – with a global limit and an optional **per-site limit**.
- 📋 **Per-site report** – a `SUMMARY` record tells you, for every site, how many sitemaps and URLs were found, or why nothing was found (`no_sitemap`, `blocked`, `unreachable`).
- 🩺 **Lastmod quality check** – the report rates each site's dates (`good`, `partial`, `missing`, `suspicious`) and warns you when a site uses the same fake date for every page, so you know when the date filter can be trusted.
- ✅ **Reliable** – no fragile page parsing: sitemaps follow a stable standard.

### How to use

1. Add one or more **domains** (`example.com`) or **sitemap URLs** (`https://example.com/sitemap_index.xml`).
2. Optionally set limits and filters.
3. Click **Start** and download the results as JSON, CSV, Excel or via API.

#### Input example

```json
{
  "startUrls": [{ "url": "https://www.example.com" }],
  "maxUrls": 10000,
  "maxUrlsPerSite": 5000,
  "includePattern": "/blog/",
  "modifiedAfter": "2026-09-01"
}
```

#### Output example

```json
{
  "url": "https://www.example.com/blog/new-product-launch",
  "lastmod": "2026-09-18T09:12:00+00:00",
  "changefreq": "weekly",
  "priority": 0.8,
  "sitemapUrl": "https://www.example.com/post-sitemap.xml",
  "domain": "www.example.com",
  "extractedAt": "2026-09-27T18:00:00+00:00"
}
```

| Field | Description |
|---|---|
| `url` | Page URL as listed in the sitemap |
| `lastmod` | Last modification date declared by the site (if present) |
| `changefreq` | Declared change frequency (if present) |
| `priority` | Declared priority 0.0–1.0 (if present) |
| `sitemapUrl` | The sitemap file where the URL was found |
| `domain` | Website domain |
| `extractedAt` | Extraction timestamp (UTC) |

### Use with AI agents

This Actor is a good first step for agents that need to **know which pages a website has** before reading them:

- Call it with a domain and get the full list of URLs in one structured dataset (JSON).
- Use `modifiedAfter` to fetch only pages changed since the agent's last visit.
- Use `includePattern` to focus on a section (e.g. `/docs/` or `/blog/`).
- Every result has the same stable fields, so it is easy to pass to a scraper, a RAG pipeline or an LLM.

Works with the Apify API, Apify MCP server, Make, Zapier, n8n and LangChain integrations.

### Pricing

Pay only for results: **$1.00 per 1,000 URLs**. No subscription. A run that returns 10,000 URLs costs about $10. Set **Maximum cost per run** in Run options to cap your spend.

### FAQ

**The site has no sitemap. What happens?**
The run ends normally and the `SUMMARY` record shows `no_sitemap` for that site. You are only charged for URLs actually returned.

**Some sites return "blocked".**
A few websites refuse automated access even to their sitemap. This Actor respects that and never tries to bypass protections: it moves on to the next site and reports `blocked`.

**Does it download the pages?**
No. It only reads robots.txt and sitemap files, which websites publish specifically for automated tools. That is why it is fast, cheap and gentle on websites.

**The date filter returns nothing (or everything) for a site. Why?**
The filter relies on the `<lastmod>` dates the site declares. Some sites don't declare them, or put the same date on every page. Check `lastmodQuality` in the `SUMMARY` record: `missing` or `suspicious` means the site's dates can't be trusted. Enable "Keep URLs without lastmod" to not lose undated pages.

**I need the latest articles, not all URLs.**
Use our **[RSS Feed Finder & Reader](https://apify.com/kernfetch/rss-feed-finder)**: it auto-discovers a site's RSS/Atom/JSON feeds and returns the newest articles with dates and summaries.

**How do I check that every sitemap URL still works?**
Copy the Dataset ID of this run into our **[Bulk URL Status & Redirect Checker](https://apify.com/kernfetch/url-status-redirect-checker)**: it returns the status code, redirect chain and final URL of every URL, and flags 404s, redirect loops and temporary redirects.

**How do I audit titles, meta descriptions and H1 of every page?**
Pass the Dataset ID of this run to our **[Bulk On-Page SEO Checker](https://apify.com/kernfetch/onpage-seo-checker)**: it audits every URL and flags missing or too long titles and descriptions, missing H1, noindex, canonical problems and duplicate titles.

**Can I run it on a schedule?**
Yes. Create a Task with your input and add a schedule (for example weekly with "Modified after" = last week) to monitor new and updated pages.

**Is it legal?**
Sitemaps are public files intended for crawlers, and the Actor respects robots.txt for any location it guesses. You are responsible for how you use the data.

### Related Actors by kernfetch

- [Bulk URL Status & Redirect Checker](https://apify.com/kernfetch/url-status-redirect-checker) – status codes, redirect chains and final URLs for thousands of URLs.
- [Bulk On-Page SEO Checker](https://apify.com/kernfetch/onpage-seo-checker) – titles, meta descriptions, H1, canonical, noindex, Open Graph and schema.org for thousands of pages, with ready-made SEO issues.
- [RSS Feed Finder & Reader](https://apify.com/kernfetch/rss-feed-finder) – discover the RSS, Atom and JSON feeds of any site and get the latest articles.

### Support

Found a site that doesn't work as expected? Open an issue on the **Issues** tab with the URL: fixes are usually shipped within days.

# Actor input Schema

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

Websites (example.com) or direct sitemap URLs (https://example.com/sitemap.xml). For a domain, sitemaps are discovered from robots.txt, then from common locations. Sitemap indexes, .xml.gz and .txt sitemaps are followed automatically.

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

Maximum number of URLs to return in total (all sites combined).

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

Optional limit for each site, useful when you process many domains in one run. Leave empty for no per-site limit.

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

Optional. Example: /blog/ or .html$

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

Optional. Example: /tag/|/author/

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

Optional. Keep only URLs whose sitemap <lastmod> is on or after this date (YYYY-MM-DD). Great to see what changed recently on a competitor's site.

## `includeUrlsWithoutLastmod` (type: `boolean`):

When a date filter is set, also keep URLs whose sitemap entry has no lastmod.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://apify.com"
    }
  ],
  "maxUrls": 10000,
  "includeUrlsWithoutLastmod": false
}
```

# 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": [
        {
            "url": "https://apify.com"
        }
    ]
};

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

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

```

## MCP server setup

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