# Sitemap URL Extractor & Validator (`helveticlabs/sitemap-extractor`) Actor

Get every URL a website lists in its sitemaps, with last-modified dates. Finds sitemaps through robots.txt, reads sitemap indexes and .gz files, and reports invalid or oversized sitemaps.

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

## Pricing

from $0.30 / 1,000 url extracteds

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 & Validator

Get every URL a website lists in its sitemaps, with last-modified dates, in one run. Give
it a site and it finds the sitemaps itself, or give it a sitemap URL directly.

### What you get

- **Every URL** from XML sitemaps, sitemap indexes (nested), gzip sitemaps (`.xml.gz`) and plain-text sitemaps
- **lastmod, changefreq and priority** for each URL, when the site provides them
- **The sitemap** each URL came from
- **A validation report** per sitemap in the key-value store (`SUMMARY`): where the sitemaps were found, how many URLs each one has, and warnings such as more than 50,000 URLs, dates not in W3C format, or URLs on another host

Typical uses: building a URL list for an SEO audit or a link check, monitoring which pages
a site adds or changes, feeding a crawler or an AI pipeline with a site's pages.

### How it works

1. It reads the site's `robots.txt` and follows its `Sitemap:` lines.
2. Without them, it tries `/sitemap.xml` and `/sitemap_index.xml`.
3. It follows sitemap indexes down to the URL lists and stops at your URL limit.

It only reads the sitemaps, never the pages themselves. Image, video and news sitemap
extensions (titles, captions, descriptions) are left out. It respects `robots.txt` and sends
one request at a time per host. XML with a DOCTYPE is refused for safety.

### Input

```json
{
  "startUrls": ["https://www.sitemaps.org/", "https://example.com/sitemap.xml"],
  "maxUrlsPerSite": 10000,
  "timeoutSecs": 30
}
```

### Output

One item per URL:

```json
{
  "url": "https://example.com/blog/first-post",
  "lastmod": "2026-09-30",
  "changefreq": "weekly",
  "priority": 0.8,
  "sitemap": "https://example.com/sitemap-posts.xml",
  "site": "https://example.com/"
}
```

### Pricing

You pay per URL extracted. The validation report is free. Set a maximum cost for the run,
and the extractor stops at your limit.

### Use it from code or AI agents

Run it through the Apify API, schedule it, connect it to Make, Zapier or n8n, or call it
from AI agents through Apify's MCP server. Pair it with the URL Status & Redirect Checker
from the same author to find broken pages.

### FAQ

**The site has no sitemap.** Then the report says which locations were tried. The
extractor does not crawl pages to guess URLs.

**Does it read sitemaps behind a login?** No. Only public sitemaps.

### Provider, privacy and fair use

**Provider:** HelveticLabs, sole proprietorship of Marvin Krieg, c/o SwissMailBox 170,
12 Rue Le Corbusier, 1208 Genève, Switzerland. E-mail: contact@helveticlabs.org.
Imprint: https://www.helveticlabs.org/imprint

**Privacy:** This Actor runs on the Apify platform, in your Apify account. It processes only
the URLs or domains you enter and the public technical data the checked servers return
(status codes, headers, certificates, DNS records, sitemap URLs, links). It does not collect
personal data: it never stores or returns page text (where a page's HTML is read, it is read
in memory only, to find links and measure tags), and it leaves out e-mail addresses, cookie
names and values and similar values. Your input and results stay in your Apify account and are
stored by Apify under its own terms (https://apify.com/privacy-policy). The provider sees
only the usage statistics Apify shows to Actor authors (such as the number of users and
runs), not your input or results, unless you share a run for support. Questions about
privacy: contact@helveticlabs.org.

**Fair use:** Check only sites you own or may check. Do not use the results to attack
systems or people. The Actor respects robots.txt, identifies itself, and keeps a polite
pace per site.

**No warranty:** The results are automated checks and can be incomplete. They are not a
penetration test, legal advice or a compliance certificate.

# Actor input Schema

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

A site (https://example.com) to find its sitemaps through robots.txt, or a sitemap URL (https://example.com/sitemap.xml).

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

Stop after this many URLs for one site.

## `timeoutSecs` (type: `integer`):

How long to wait for each sitemap download.

## Actor input object example

```json
{
  "startUrls": [
    "https://www.sitemaps.org/"
  ],
  "maxUrlsPerSite": 10000,
  "timeoutSecs": 30
}
```

# 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://www.sitemaps.org/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("helveticlabs/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 = { "startUrls": ["https://www.sitemaps.org/"] }

# Run the Actor and wait for it to finish
run = client.actor("helveticlabs/sitemap-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://www.sitemaps.org/"
  ]
}' |
apify call helveticlabs/sitemap-extractor --silent --output-dataset

```

## MCP server setup

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