# Sitemap URL Extractor (`pellucid_bird/sitemap-url-extractor`) Actor

Your go-to sitemap extractor for SEO audits and site migrations. Collect unique page URLs from XML sitemaps and nested indexes with gzip support and URL filters. Export available lastmod, frequency, priority and source sitemap as JSON or CSV.

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

## Pricing

from $0.05 / 1,000 unique url saveds

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

Turn public XML sitemaps into a deduplicated URL inventory with last-modified dates, change-frequency hints, priorities and the sitemap each URL came from. Export JSON, CSV, Excel or XML for SEO inventories, migration planning, content audits and inputs to a later crawl.

This Actor reads sitemap files and nested sitemap indexes. It does **not** request the listed pages or check their HTTP status. A listed URL may be outdated, redirected or unavailable.

### Quick start

Supply a direct sitemap or sitemap-index URL. This example reads the public Apify CLI documentation sitemap:

```json
{
  "sitemapUrls": ["https://docs.apify.com/cli/sitemap.xml"],
  "maxItems": 1000,
  "maxItemsPerInput": 1000,
  "maxEstimatedCostUsd": 1
}
```

Open **Dataset → Export** to download the rows. Read **OUTPUT → sitemaps** for visited documents, excluded entries, pending references and completion status. To traverse an index, use its direct URL, such as `https://docs.apify.com/sitemap.xml`.

### What you receive

| Field                    | Meaning                                                         |
| ------------------------ | --------------------------------------------------------------- |
| `url`                    | A unique page URL from the sitemap; never visited by this Actor |
| `lastmod`, `lastmodRaw`  | Valid source date or timestamp, and the original label          |
| `lastmodPrecision`       | `DATE` or `TIMESTAMP`; date-only values stay date-only          |
| `changefreq`, `priority` | Valid sitemap hints, or null when absent or invalid             |
| `rootUrl`, `sitemapUrl`  | Requested input and the document containing this URL            |
| `depth`                  | Number of index steps from the input; the root is depth zero    |
| `warnings`               | Invalid optional source metadata, without invented replacements |
| `scrapedAt`              | When this sitemap document was parsed                           |

URLs are deduplicated across the run. When several documents list the same URL, the first encountered row supplies its metadata. Query strings are retained. The Actor does not merge conflicting metadata or infer missing dates. Last-modified values are declarations by the website, not proof that content changed.

### Example result

This excerpt is from the public documentation sitemap collected on November 12, 2026. The full record is available in `examples/url.json`.

```json
{
  "url": "https://docs.apify.com/cli/blog",
  "lastmod": null,
  "lastmodPrecision": null,
  "changefreq": "weekly",
  "priority": 0.5,
  "sitemapUrl": "https://docs.apify.com/cli/sitemap.xml"
}
```

### Pricing

The price is **$0.0149 per started run + $0.049 per 1,000 saved URLs**, including Apify resources used during the run. Check the Pricing tab for the active tariff before running.

| Saved URLs in one run | Total price |
| --------------------- | ----------: |
| 0                     |     $0.0149 |
| 10                    |    $0.01539 |
| 100                   |     $0.0198 |
| 736                   |   $0.050964 |
| 1,000                 |     $0.0639 |
| 5,000                 |     $0.2599 |

The startup fee applies even when no URLs are returned. Only saved unique URL rows receive a result fee; index links and error reports do not count as paid results. Separate runs each have their own startup fee. Dataset exports and API usage after a run follow your Apify plan's rates.

Set Apify's **Maximum charge per run** to cap event fees. `maxEstimatedCostUsd` is an additional planning allowance; the stricter limit applies. Zero skips source collection and new rows, but does not waive an active startup fee. Allow at least $0.2599 for 5,000 rows at this tariff; the quick-start $1 allowance covers it. Spending and item limits are ceilings, not promises of complete results.

### Filters and coverage

- `urlIncludes` accepts up to 20 literal, case-sensitive URL substrings; any match includes a URL. `urlExcludes` takes precedence. These filters do not fetch or inspect page content.
- Accepts 1–10 direct HTTP(S) sitemap URLs, XML `urlset` documents and nested `sitemapindex` documents. Gzip files and HTTP gzip, deflate or Brotli encoding are supported within the response bounds.
- Saves at most **5,000 unique URLs per run**. `maxItemsPerInput` limits each input tree. The default is 1,000 for both limits.
- Visits at most **50 sitemap documents**, with a default of 20, and at most **5 index levels**, with a default of 3. Failed sitemap attempts also consume the document limit. Traversal is in input order and breadth-first within each tree.
- Every file must be UTF-8 XML with the standard sitemap namespace. Maximum file size is **2 MiB both compressed and decoded**, smaller than the general sitemap protocol's 50 MB limit. Oversized files stop with a reported error.
- Child sitemap requests stay on the final input origin. Listed page URLs must use the sitemap's hostname. Cross-origin references are counted and skipped. Homepage discovery, plain-text sitemap files, RSS sitemaps, image/video/news extensions and cross-site sitemap delegation are outside the supported scope.
- Public access and robots rules are required. Source errors, robots restrictions, long server delays, slow responses or repeated retries can stop collection early. The total run is bounded to five minutes.

`sourceExhausted: true` means every supported sitemap reference encountered within the input tree was processed without a scope exclusion or interruption. It does not mean every page on the website is listed or reachable. Read `errors`, `invalidEntries`, `crossOriginReferences`, `pendingSitemaps` and `depthLimitedSitemaps` before interpreting coverage as complete. A partial document can leave one pending reference even if some of its rows were saved.

Cycles and repeated sitemap references are reported and skipped. Invalid optional dates, priorities or frequency values produce warnings and null fields. Invalid required URLs are counted without creating fabricated rows.

### API and AI workflows

Input: direct public sitemap URLs, optional literal URL filters and explicit limits. Output: one row per unique sitemap-listed URL, source sitemap, declared modification metadata and a separate coverage report. Suitable tasks include sitemap-to-spreadsheet exports, URL inventory snapshots, content-migration planning and preparation of a later crawl.

An AI assistant should read `OUTPUT.sitemaps` alongside dataset rows and verify `sourceExhausted` before describing the inventory as complete. For reachability checks or article content, pass selected URLs to a separate page-fetching workflow.

### Recovery and support

A compatible resumed run re-reads sitemap files and skips confirmed saved URLs. It retains the original cumulative resource and time limits. Changing input requires a fresh run. If a dataset append has an uncertain outcome, automatic continuation stops to avoid duplicate rows or result fees.

When reporting an issue, include the run URL, input sitemap URL and relevant `OUTPUT` error code. The Actor has no login or proxy input.

# Actor input Schema

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

1–10 direct public XML sitemap or sitemap-index URLs. Does not discover sitemaps from a homepage. Child sitemaps stay on the final root origin.

## `maxItems` (type: `integer`):

Saved unique URLs across all inputs. Default: 1,000.

## `maxItemsPerInput` (type: `integer`):

Saved unique URLs attributable to one input sitemap tree. Default: 1,000.

## `maxSitemaps` (type: `integer`):

Sitemap fetch attempts across all inputs, including indexes. Robots, redirects and retries have separate bounded request accounting. Default: 20.

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

Root depth is zero. Children beyond this limit are reported as unvisited. Default: 3.

## `requestTimeoutSecs` (type: `integer`):

Timeout per physical request including DNS and body. Default: 15 seconds; at most 20.

## `maxRetries` (type: `integer`):

Additional attempts for temporary errors; bounded Retry-After is honored. Default: 1.

## `requestDelayMs` (type: `integer`):

Minimum delay between requests to one origin. Robots crawl-delay can increase it. Default: 1,000 ms.

## `urlIncludes` (type: `array`):

Optional case-sensitive literal URL substrings. Keep a URL if any matches. No regular expressions.

## `urlExcludes` (type: `array`):

Optional case-sensitive literal URL substrings. Any match excludes a URL, overriding includes.

## `maxEstimatedCostUsd` (type: `number`):

Additional spending allowance; zero skips source work and output but does not waive an active startup fee. Also set Apify Maximum charge per run for event charges. Resources are included in the selected event tariff. Default: $1.

## Actor input object example

```json
{
  "sitemapUrls": [
    "https://docs.apify.com/cli/sitemap.xml"
  ],
  "maxItems": 1000,
  "maxItemsPerInput": 1000,
  "maxSitemaps": 20,
  "maxDepth": 3,
  "requestTimeoutSecs": 15,
  "maxRetries": 1,
  "requestDelayMs": 1000,
  "maxEstimatedCostUsd": 1
}
```

# Actor output Schema

## `items` (type: `string`):

No description

## `report` (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 = {
    "sitemapUrls": [
        "https://docs.apify.com/cli/sitemap.xml"
    ],
    "maxItems": 1000,
    "maxItemsPerInput": 1000,
    "maxSitemaps": 20,
    "maxDepth": 3,
    "requestTimeoutSecs": 15,
    "maxRetries": 1,
    "requestDelayMs": 1000,
    "maxEstimatedCostUsd": 1
};

// Run the Actor and wait for it to finish
const run = await client.actor("pellucid_bird/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 = {
    "sitemapUrls": ["https://docs.apify.com/cli/sitemap.xml"],
    "maxItems": 1000,
    "maxItemsPerInput": 1000,
    "maxSitemaps": 20,
    "maxDepth": 3,
    "requestTimeoutSecs": 15,
    "maxRetries": 1,
    "requestDelayMs": 1000,
    "maxEstimatedCostUsd": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("pellucid_bird/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 '{
  "sitemapUrls": [
    "https://docs.apify.com/cli/sitemap.xml"
  ],
  "maxItems": 1000,
  "maxItemsPerInput": 1000,
  "maxSitemaps": 20,
  "maxDepth": 3,
  "requestTimeoutSecs": 15,
  "maxRetries": 1,
  "requestDelayMs": 1000,
  "maxEstimatedCostUsd": 1
}' |
apify call pellucid_bird/sitemap-url-extractor --silent --output-dataset

```

## MCP server setup

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