# Sitemap URL Extractor & Checker (`tidyfold/sitemap-url-extractor`) Actor

Get every URL from a site's sitemaps: auto-finds them via robots.txt, walks sitemap indexes, reads .gz/text/RSS sitemaps, filters by pattern or lastmod, and can flag 404s and redirects. Pay per URL.

- **URL**: https://apify.com/tidyfold/sitemap-url-extractor.md
- **Developed by:** [Tidyfold Tools](https://apify.com/tidyfold) (community)
- **Categories:** SEO tools, Developer tools
- **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 & Checker

Give it a domain and get back every page URL listed in the site's sitemaps, with `lastmod`, `changefreq`, `priority`, image counts and hreflang languages. Optionally check each page's HTTP status to catch 404s, redirects and server errors hiding in your sitemap.

### Why this one

- **Finds sitemaps for you:** reads `Sitemap:` lines in robots.txt, then tries the common paths (`/sitemap.xml`, `/sitemap_index.xml`, `/wp-sitemap.xml`, `.gz`, `.txt`)
- **Walks sitemap indexes** of any depth, de-duplicates URLs, and keeps going when one child sitemap is broken (errors are listed in the run summary)
- **Reads every format:** XML, gzipped `.xml.gz`, plain-text sitemaps, and RSS/Atom feeds
- **Filters before you pay:** include/exclude regex patterns, "modified after" date, and a per-site cap, so you're only charged for the URLs you keep
- **Optional status check** with HEAD and automatic GET fallback for servers that reject HEAD

### Output

| Field | Example |
|---|---|
| site | https://docs.apify.com |
| url | https://docs.apify.com/platform/actors |
| lastmod, changefreq, priority | 2026-10-12, weekly, 0.7 |
| images, hreflang | 3, \["en","de"] |
| sitemap | The sitemap file the URL came from |
| httpStatus, finalUrl | 200 / 301 / 404, and the URL after redirects (status check only) |

A summary per site (how the sitemap was found, sitemaps read, URL count, errors) is saved in the run's key-value store.

### Use cases

Feeding a clean URL list to a crawler or RAG pipeline, SEO audits (404s and redirects in the sitemap), monitoring competitors' new pages with "modified after", content inventories and site migrations.

### Input example

```json
{
  "startUrls": ["docs.apify.com", "https://example.com/sitemap_index.xml"],
  "includePatterns": ["/blog/"],
  "modifiedAfter": "2026-09-01",
  "checkStatus": false
}
```

# Actor input Schema

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

A domain (we find its sitemaps via robots.txt and common paths) or a direct sitemap / sitemap index URL. XML, .xml.gz, plain-text and RSS/Atom sitemaps all work.

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

Stop after this many URLs per site. 0 = no limit.

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

Keep only URLs matching at least one of these regular expressions, e.g. /blog/ or /products/.

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

Drop URLs matching any of these regular expressions, e.g. /tag/ or ?page=.

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

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

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

Send a HEAD request (GET fallback) to every URL and add httpStatus and finalUrl, to find 404s, redirects and errors listed in your sitemap. Priced per checked URL instead of per extracted URL.

## `sameDomainOnly` (type: `boolean`):

When the sitemap was found automatically, skip URLs on other domains.

## Actor input object example

```json
{
  "startUrls": [
    "docs.apify.com"
  ],
  "maxUrlsPerSite": 200,
  "checkStatus": false,
  "sameDomainOnly": true
}
```

# Actor output Schema

## `results` (type: `string`):

URLs returned by the run (one item per row).

# 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": [
        "docs.apify.com"
    ],
    "maxUrlsPerSite": 200
};

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

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

```

## MCP server setup

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