# Sitemap URL Extractor (`1mp/sitemap-urls`) Actor

Give a website or sitemap URL; get every URL its sitemaps list, one row each, with lastmod, changefreq, priority and source sitemap. Finds sitemaps via robots.txt, follows indexes, reads .xml.gz and text. $1 per 1,000 URLs.

- **URL**: https://apify.com/1mp/sitemap-urls.md
- **Developed by:** [Jesse Hawkins](https://apify.com/1mp) (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

$1.00 / 1,000 results

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

Every URL a website's sitemaps list. Give it a website or a sitemap
URL; it returns one row per URL, with `lastmod`, `changefreq`,
`priority` and the sitemap that listed it. Optionally, it checks each
URL's HTTP status.

It finds sitemaps the way search engines do: the `Sitemap:` lines in
`robots.txt` first, then `/sitemap.xml`, `/sitemap_index.xml` and
`/sitemap-index.xml`. It follows sitemap indexes to any depth, reads
`.xml`, `.xml.gz` and plain-text sitemaps, and streams them, so a
50,000-URL file needs little memory. No browser.

### What you get

One row per URL:

| Field | Example |
|---|---|
| `url` | `https://angular.dev/ai` |
| `lastmod` | `2026-10-02T19:38:17.519Z`, as the sitemap gives it |
| `changefreq` | `daily` |
| `priority` | `1.0`, a number from 0 to 1, or `null` |
| `sitemapUrl` | `https://angular.dev/sitemap.xml`, the file that lists it |
| `site` | `https://angular.dev`, the start URL's site |
| `status`, `redirectTo` | `301`, `https://.../about/`, when the status check is on |
| `statusError` | why a status check got no answer, else `null` |
| `imageUrls`, `videoUrls` | from Google's image and video sitemap extensions |
| `alternates` | `[{"hreflang": "et-ee", "href": "..."}]`, hreflang links |
| `newsTitle`, `newsPublicationDate` | from Google's news sitemap extension |

### Input

```json
{
  "startUrls": ["https://apify.com", "https://example.com/sitemap.xml"],
  "maxUrls": 1000,
  "urlFilterInclude": "/blog/",
  "urlFilterExclude": "/tag/",
  "checkPageStatus": false
}
```

- **startUrls**: websites, sitemap URLs, sitemap indexes, `.xml.gz`
  or `.txt` sitemaps, or a `robots.txt` URL. A bare `example.com`
  works. A sitemap URL that does not answer falls back to finding
  the site's sitemaps.
- **maxUrls**: stop after this many URLs across all start URLs. `0`
  returns every URL. This is your cost control. The form starts at
  100, so a first run on a large site does not read all of it:
  apify.com alone lists 676,119.
- **urlFilterInclude**, **urlFilterExclude**: regular expressions,
  case-insensitive. URLs they drop are not billed.
- **checkPageStatus**: one `HEAD` request per URL returned, adding
  `status` and `redirectTo`. Off by default.
- **followSitemapIndexes**: on by default. Off returns the sitemap
  files an index lists instead of reading them.
- **proxyConfiguration**: off by default. Sitemaps are published
  for crawlers, and most sites serve them to anyone.

The input also takes `startUrls` as `[{"url": "..."}]` objects and
`sitemapUrls`, the field names other sitemap Actors use, so an
existing input runs unchanged.

### Output

```json
{
  "url": "https://www.shopify.com/about",
  "lastmod": "2026-10-02",
  "changefreq": "daily",
  "priority": 0.8,
  "sitemapUrl": "https://www.shopify.com/sitemap.xml",
  "site": "https://www.shopify.com",
  "status": 301,
  "redirectTo": "https://www.shopify.com/about/",
  "statusError": null,
  "imageUrls": [],
  "videoUrls": [],
  "alternates": [],
  "newsTitle": null,
  "newsPublicationDate": null
}
```

### Price

**$1.00 per 1,000 URLs** ($0.001 each), charged per URL returned.
Nothing else is charged: no per-run fee, no charge for sitemaps that
fail, and none for duplicates or filtered-out URLs. A URL listed in
two sitemaps is returned once. The status check costs nothing extra.

### Speed and size

Measured 2026-10-03, outside Apify: all of apify.com's sitemaps, 17
files and 676,119 URLs, read in 15 seconds at a peak of 158 MB. The
default 256 MB is enough for a site of that size; for a site with
several million URLs, give the run 1 GB.

### Limits, honestly

- **Sitemaps only.** It does not crawl pages or follow links, so a
  page missing from a site's sitemaps is missing here too.
- **robots.txt is respected** for the sitemap files themselves. A
  sitemap that `robots.txt` disallows is skipped and counted. If
  `robots.txt` answers with a server error, that site's sitemaps are
  not read, as RFC 9309 requires.
- **A site with no sitemap** returns no rows. The run succeeds and
  its status message says which places were tried.
- **A sitemap cut short** (a broken connection, or invalid XML part
  way through) keeps the URLs read up to that point, and the status
  message says how many files ended early.
- **One host at a time**, with a pause between sitemap files, and
  back-off when a site answers 429 or 503.
- **Up to 20,000 sitemap files** and six index levels per run.

### What it will not do

It reads `robots.txt` and sitemap files, plus one `HEAD` per URL when
asked. It does not read the pages themselves, sign in, solve
CAPTCHAs, or collect personal data.

### Support

Open an issue on this Actor's **Issues** tab. Reported issues are
fixed within 14 days.

# Actor input Schema

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

A website (https://apify.com), a sitemap (https://apify.com/sitemap.xml), a sitemap index, a .xml.gz or .txt sitemap, or a robots.txt URL. A website is searched for its sitemaps. A sitemap URL that does not answer falls back to searching its site.

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

Stop after this many URLs across all start URLs. 0 returns every URL the sitemaps list. Each URL returned is one billed result.

## `urlFilterInclude` (type: `string`):

Optional. Return only URLs that match this regular expression (Python syntax, case-insensitive), e.g. /blog/ or \[.]pdf$. URLs filtered out are not billed.

## `urlFilterExclude` (type: `string`):

Optional. Drop URLs that match this regular expression (Python syntax, case-insensitive), e.g. /tag/|/page/\[0-9]+. Applied after the include filter. Not billed.

## `checkPageStatus` (type: `boolean`):

On: send one HEAD request to every URL returned and add its status code and redirect target. Slower; same price per URL. Off by default.

## `followSitemapIndexes` (type: `boolean`):

On (default): read every sitemap a sitemap index lists. Off: return the listed sitemap files themselves as the rows.

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

Timeout for one request. Failed requests are retried twice with back-off.

## `proxyConfiguration` (type: `object`):

Off by default: sitemaps are published for crawlers and most sites serve them to anyone. Turn on Apify Proxy only if a site refuses the requests.

## Actor input object example

```json
{
  "startUrls": [
    "https://apify.com",
    "https://www.usa.gov"
  ],
  "maxUrls": 100,
  "checkPageStatus": false,
  "followSitemapIndexes": true,
  "requestTimeoutSecs": 30,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `urls` (type: `string`):

Every URL found, one item each, as JSON from the run's default dataset.

## `overview` (type: `string`):

The same URLs in the dataset's overview view: URL, last modified, change frequency, priority, status and source sitemap.

# 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://apify.com",
        "https://www.usa.gov"
    ],
    "maxUrls": 100,
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("1mp/sitemap-urls").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://apify.com",
        "https://www.usa.gov",
    ],
    "maxUrls": 100,
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("1mp/sitemap-urls").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://apify.com",
    "https://www.usa.gov"
  ],
  "maxUrls": 100,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call 1mp/sitemap-urls --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,1mp/sitemap-urls"
        }
    }
}
```

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/EHzLHxM56h3f8jBcO/builds/sK59soz6LbgQ9HoOa/openapi.json
