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

Extract URLs from XML sitemaps, sitemap indexes, robots.txt, and gzip files. Filter pages and optionally check HTTP status codes for SEO audits.

- **URL**: https://apify.com/scrapesignal\_labs/sitemap-url-extractor.md
- **Developed by:** [ScrapeSignal Labs](https://apify.com/scrapesignal_labs) (community)
- **Categories:** Developer tools, Automation, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.08 / 1,000 sitemap urls

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#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

## XML Sitemap URL Extractor & Checker

Extract a clean website URL inventory from `sitemap.xml`, sitemap indexes, gzipped sitemaps, `robots.txt` declarations, or a bare website root. Preserve sitemap metadata, filter URLs before delivery, and optionally check every page's live HTTP status.

Use it for SEO audits, website migrations, broken-link checks, crawl planning, content inventories, monitoring, datasets, and AI-agent workflows.

### Common use cases

- Extract every URL from an XML sitemap or sitemap index
- Follow nested sitemap indexes and gzip files recursively
- Find broken, redirected, or non-HTML URLs before a migration
- Filter product, category, documentation, or blog URLs
- Build a complete URL inventory for SEO, analytics, or crawling
- Give an AI agent structured access to a website's published URL set

### What the Actor returns

Each unique URL row can include:

- page URL and source sitemap
- sitemap nesting depth
- `lastmod`, `changefreq`, and priority metadata
- live HTTP status code when checking is enabled
- redirect destination and content type
- status-check error and extraction timestamp

### Quick start

```json
{
  "startUrls": ["https://apify.com/sitemap.xml"],
  "includeNested": true,
  "maxDepth": 5,
  "maxUrls": 1000,
  "includePatterns": [],
  "excludePatterns": ["?preview="],
  "lastModifiedAfter": "",
  "checkStatus": false,
  "statusConcurrency": 20
}
```

You can also submit a website root. The Actor checks `robots.txt` for declared sitemaps and falls back to `/sitemap.xml` when no declaration is available.

### AI agent and API usage

This Actor is intentionally straightforward for tool-calling agents:

- `startUrls` is the only required input
- website roots, XML, gzip, and robots.txt inputs use the same interface
- `maxUrls` is a hard result and price ceiling
- filters run before rows are delivered
- status checking is explicit and disabled by default to keep first runs fast
- output has a stable, documented dataset view

Use the API, OpenAPI, MCP, Python, JavaScript, CLI, or integration examples in the Actor's **API** tab. A safe agent test uses one sitemap, `maxUrls: 20`, and `checkStatus: false`.

### Example workflows

#### Audit a small set of sitemap pages for HTTP errors

```json
{
  "startUrls": ["https://apify.com/sitemap.xml"],
  "includeNested": true,
  "maxUrls": 25,
  "checkStatus": true,
  "statusConcurrency": 10
}
```

#### Extract only selected URL paths

```json
{
  "startUrls": ["https://example.com/sitemap.xml"],
  "includeNested": true,
  "maxUrls": 10000,
  "includePatterns": ["/products/", "/blog/"],
  "excludePatterns": ["?preview=", "/tag/"],
  "checkStatus": false
}
```

### Pricing

Delivered URL rows cost **$0.00008 each ($0.08 per 1,000)** plus a **$0.00005 Actor-start event** and any platform usage shown by Apify before the run. Nested sitemap files and filtered-out entries are not dataset rows and do not create result charges.

### Limits and responsible use

This Actor reads only the public sitemap and page endpoints supplied by the user. A sitemap is a discovery hint, not permission for every downstream use. Respect each site's terms, robots policies, rate limits, copyright, and applicable privacy law.

# Actor input Schema

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

Paste sitemap.xml, sitemap.xml.gz, robots.txt, or website-root URLs. Website roots are resolved through robots.txt and then /sitemap.xml when needed.

## `includeNested` (type: `boolean`):

Recursively open sitemap indexes and collect URLs from their child sitemap files. Keep enabled for complete website inventories.

## `maxDepth` (type: `integer`):

Limit how many nested sitemap-index levels the Actor follows.

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

Hard output and price ceiling for the run. The Actor stops after this many unique, filtered URL rows.

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

Optional case-insensitive substrings. A URL must match at least one.

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

Optional case-insensitive substrings such as /tag/ or ?preview=.

## `lastModifiedAfter` (type: `string`):

Optional YYYY-MM-DD filter. Entries without lastmod are kept.

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

Make lightweight requests to each extracted page and add the HTTP status code, redirect destination, content type, and any check error. Enable for broken-link and migration audits.

## `statusConcurrency` (type: `integer`):

Limit simultaneous URL requests when live status checking is enabled.

## Actor input object example

```json
{
  "startUrls": [
    "https://apify.com/sitemap.xml"
  ],
  "includeNested": true,
  "maxDepth": 5,
  "maxUrls": 10000,
  "includePatterns": [],
  "excludePatterns": [],
  "lastModifiedAfter": "",
  "checkStatus": false,
  "statusConcurrency": 20
}
```

# Actor output Schema

## `dataset` (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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapesignal_labs/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 = {}

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

```

## MCP server setup

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