# Sitemap Extractor — Get All Website URLs from sitemap.xml (`plumbline-data/sitemap-url-extractor`) Actor

Sitemap extractor & sitemap.xml parser: get all URLs of any website. Auto-finds sitemaps via robots.txt, follows nested indexes and .gz, returns lastmod, images, hreflang, news/video data, optional status check. CSV/JSON/Excel or API. $0.50 per 1,000 URLs.

- **URL**: https://apify.com/plumbline-data/sitemap-url-extractor.md
- **Developed by:** [Plumbline Data](https://apify.com/plumbline-data) (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.25 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 & sitemap.xml parser — get every URL of a website

### What does Sitemap URL Extractor do?

**Sitemap URL Extractor** gives you **every URL a website publishes in its sitemaps** — as a clean table you can download as CSV, Excel or JSON, or pull via API. Enter a homepage like `https://example.com` and the Actor finds the sitemaps for you: it reads `robots.txt`, checks the usual locations (`/sitemap.xml`, `/sitemap_index.xml`, `/wp-sitemap.xml`, `.gz` files…), follows **nested sitemap indexes**, and returns one row per page with `lastmod`, `changefreq`, `priority`, **images, hreflang alternates, Google News and video** data.

It's built to **just work** on messy real-world sitemaps: gzip, plain-text sitemaps, RSS/Atom feeds, broken XML, sitemaps that return an HTML 404 page, rate-limited servers. When something goes wrong you get a clear **error row that you are never charged for**.

**Try it:** paste a website into *Websites or sitemap URLs* and click **Start**.

### Why use this sitemap scraper?

- 🔎 **Auto-discovery** — robots.txt `Sitemap:` lines + common paths; no need to know where the sitemap lives
- 🪆 **Nested sitemap indexes** — Shopify, WordPress/Yoast, Next.js, news sites with hundreds of child sitemaps
- 🗜️ **Every format** — XML, `.xml.gz`, `sitemap.txt`, RSS 2.0 and Atom feeds
- 🖼️ **Extensions** — image URLs, hreflang language alternates, Google News title/date, video metadata
- 🎯 **Filters** — include/exclude regex, *only URLs modified since* a date, max URLs per site, path scoping (`https://example.com/blog/` → only `/blog/` URLs)
- ✅ **Optional status check** — HTTP status code, redirects and final URL for each page (robots.txt-aware)
- 💸 **Error rows are free** — "no sitemap found", 404s and blocked sitemaps are reported but not charged
- 🤝 **Polite by default** — identifies itself, respects robots.txt for probes and checks, slows down automatically on 429/503

### Who uses it?

- **SEO specialists** — audit indexable pages, find orphaned or redirected URLs, compare sitemaps before/after a migration
- **AI / RAG builders** — get a complete URL list to feed into a crawler or [Website Content Crawler](https://apify.com/apify/website-content-crawler) instead of crawling blind
- **Competitive intelligence** — monitor competitors' new product, blog or landing pages daily with *Only URLs modified since*
- **E-commerce teams** — list every product URL of a Shopify/WooCommerce store, with product images
- **Content teams** — export a full content inventory with last-modified dates

### How to extract all URLs from a website's sitemap

1. Open the Actor and add one or more websites (or direct sitemap URLs) to **Websites or sitemap URLs**.
2. Optional: add **Include only URLs matching**, e.g. `/blog/`, or set **Only URLs modified since**.
3. Optional: turn on **Check HTTP status of each URL** for an SEO health check.
4. Click **Start** and download your data as CSV, JSON, Excel, or connect it via API, Make, Zapier or Google Sheets.
5. Schedule it (daily/weekly) in Apify to monitor new pages automatically.

### Input example

```json
{
  "startUrls": [
    { "url": "https://www.allbirds.com" },
    { "url": "https://wordpress.org/news/" },
    { "url": "https://docs.apify.com/sitemap.xml" }
  ],
  "includeUrlPatterns": ["/products/"],
  "lastmodFrom": "2026-09-01",
  "maxUrlsPerSite": 0,
  "checkStatus": false
}
```

### Output example

```json
{
  "url": "https://www.allbirds.com/products/mens-wool-runners",
  "site": "https://www.allbirds.com",
  "domain": "www.allbirds.com",
  "lastmod": "2026-10-06T09:52:08-07:00",
  "changefreq": "daily",
  "priority": null,
  "sourceSitemap": "https://www.allbirds.com/sitemap_products_1.xml?from=1878193471557&to=7369944137808",
  "sitemapType": "urlset",
  "foundVia": "sitemap-index",
  "sitemapDepth": 1,
  "images": ["https://cdn.shopify.com/s/files/1/1104/4168/files/Allbirds_WL_RN_SF_PDP_Natural_Grey_LAT.png?v=1751143404"],
  "imageCount": 1,
  "alternates": [],
  "videos": [],
  "news": null
}
```

With **status check** on, each row also gets `statusCode`, `redirected`, `finalUrl` and `robotsAllowed`. A per-site summary (sitemaps found/failed, URL count) is saved to the key-value store as `SUMMARY`.

Error rows look like this (not charged):

```json
{ "site": "https://www.python.org", "isError": true, "error": "NO_SITEMAP_FOUND",
  "errorMessage": "No sitemap found in robots.txt or common locations. Try passing the sitemap URL directly." }
```

### How much does it cost to extract sitemap URLs?

This Actor uses **pay per result**: you pay **$0.50 per 1,000 URLs** extracted (plus a tiny Apify start fee of $0.00005 per run). Error rows are free. Examples:

| Job | URLs | Cost |
|---|---|---|
| Small business site | 300 | ~$0.15 |
| Shopify store (products, collections, blog) | 2,500 | ~$1.25 |
| News site, last 30 days only (`lastmodFrom`) | 5,000 | ~$2.50 |
| Large site, full inventory | 100,000 | ~$50 |

Apify's free plan includes monthly credits, so you can try it at no cost. Set **Maximum cost per run** in the run options and the Actor stops cleanly when it's reached.

### Tips

- **Big sites:** use *Include only URLs matching* or *Only URLs modified since* to get just what you need (and pay less).
- **Sub-sections:** enter `https://example.com/blog/` to get only blog URLs.
- **Monitoring:** schedule a daily run with *Only URLs modified since* set to yesterday's date via the API, or compare datasets between runs.
- **Feeding a crawler:** use the dataset as start URLs for [Website Content Crawler](https://apify.com/apify/website-content-crawler) or your own scraper.

### Use it via API (Python, JavaScript, Make, Zapier, n8n)

Run the Actor and get results in one HTTP call (replace `YOUR_TOKEN` with your [Apify API token](https://console.apify.com/settings/integrations)):

```bash
curl -X POST "https://api.apify.com/v2/acts/plumbline-data~sitemap-url-extractor/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"startUrls":[{"url":"https://docs.apify.com"}],"maxUrlsPerSite":1000}'
```

Python:

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_TOKEN")
run = client.actor("plumbline-data/sitemap-url-extractor").call(run_input={"startUrls":[{"url":"https://docs.apify.com"}],"maxUrlsPerSite":1000})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

You can also **schedule** it (e.g. daily at 7 am) in Apify Console and send results to Google Sheets, Slack, a webhook or your database with built-in integrations.

### FAQ

#### Is it legal to scrape sitemaps?

Sitemaps are files website owners publish specifically so that crawlers can discover their pages. This Actor only reads those files (and, if you enable it, sends lightweight HEAD requests to check status codes). It honours robots.txt for probes and status checks and identifies itself with a clear User-Agent. Always make sure your downstream use of the URLs complies with the target site's terms.

#### The Actor says NO_SITEMAP_FOUND — what now?

Some sites have no sitemap, or keep it at an unusual path. If you know the URL, paste it directly (e.g. `https://example.com/sitemaps/main.xml`). You are not charged for error rows.

#### Why did I get HTTP_403 for a sitemap?

Some sites block automated access to their sitemaps. We don't disguise the Actor as a browser to get around blocks — you'll see a free error row instead.

#### Does it crawl the pages themselves?

No — it reads sitemaps only, which is why it's fast and cheap. Turn on *status check* for a HEAD request per URL. For page content, chain it with a content crawler.

#### Can I use it via API, Python or Make/Zapier?

Yes. Every Apify Actor has a REST API, Python/JS clients, webhooks and integrations with Make, Zapier, n8n, Google Sheets, Airbyte and more.

#### Other Actors by Plumbline Data

- [RSS & Atom Feed Reader](https://apify.com/plumbline-data/rss-feed-reader) — turn site feeds into clean JSON for monitoring and automations
- [Wayback Machine URLs](https://apify.com/plumbline-data/wayback-machine-urls) — list archived URLs for a domain, then compare with today's sitemap
- [LEI Lookup & Company Search (GLEIF)](https://apify.com/plumbline-data/gleif-lei-lookup) — match company names to Legal Entity Identifiers, parents and addresses
- [UK Public Tenders — Find a Tender + Contracts Finder](https://apify.com/plumbline-data/uk-public-tenders) — every UK public-sector tender in one clean feed

Found a sitemap that doesn't parse? Open an issue on the Actor's **Issues** tab — we aim to fix parser edge cases quickly.

# Changelog

This Actor's version history is a separate document: https://apify.com/plumbline-data/sitemap-url-extractor/changelog.md

# Actor input Schema

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

Homepages (https://example.com) or direct sitemap links (https://example.com/sitemap.xml, .xml.gz, .txt, RSS/Atom). One row per URL found is returned.

## `discoverFromRobotsTxt` (type: `boolean`):

Read the site's robots.txt and follow every `Sitemap:` line.

## `tryCommonLocations` (type: `boolean`):

If robots.txt lists nothing usable, probe /sitemap.xml, /sitemap_index.xml, /wp-sitemap.xml, /sitemap.xml.gz, /sitemap.txt and similar.

## `restrictToInputPath` (type: `boolean`):

If you enter a sub-path such as https://example.com/blog/, return only URLs under /blog/ (and look for /blog/sitemap.xml first). Has no effect for homepages or direct sitemap URLs.

## `maxSitemapsPerSite` (type: `integer`):

Safety cap on how many sitemap files (including nested ones) are downloaded per site.

## `includeUrlPatterns` (type: `array`):

Keep only URLs matching at least one of these regular expressions, e.g. `/blog/` or `\.pdf$`. Leave empty to keep everything.

## `excludeUrlPatterns` (type: `array`):

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

## `lastmodFrom` (type: `string`):

Keep only URLs whose <lastmod> is on/after this date (YYYY-MM-DD). Great for monitoring new or updated pages.

## `skipUrlsWithoutLastmod` (type: `boolean`):

When 'Only URLs modified since' is set, also drop URLs that have no <lastmod> value.

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

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

## `deduplicate` (type: `boolean`):

Return each URL only once per site even if it appears in several sitemaps.

## `includeExtensions` (type: `boolean`):

Extract image, hreflang alternate, Google News and video sitemap extensions.

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

Send a lightweight HEAD request to each URL and return status code and final (redirected) URL. Pages disallowed by robots.txt are skipped. Slower on large sites.

## `statusCheckConcurrency` (type: `integer`):

Parallel status checks (1–50). Requests per host are additionally capped by 'Max concurrency per host'.

## `respectRobotsTxt` (type: `boolean`):

Skip status checks and sitemap probes that robots.txt disallows. Sitemaps explicitly listed in robots.txt are always read.

## `maxConcurrencyPerHost` (type: `integer`):

Maximum parallel requests to one host. The Actor also slows down automatically when a site answers 429/503.

## `delayBetweenRequestsMs` (type: `integer`):

Optional pause between requests to one host.

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

Timeout per HTTP request.

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

Retries for timeouts, 429 and 5xx responses (exponential backoff, honours Retry-After).

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://docs.apify.com"
    }
  ],
  "discoverFromRobotsTxt": true,
  "tryCommonLocations": true,
  "restrictToInputPath": true,
  "maxSitemapsPerSite": 1000,
  "includeUrlPatterns": [],
  "excludeUrlPatterns": [],
  "skipUrlsWithoutLastmod": false,
  "maxUrlsPerSite": 0,
  "deduplicate": true,
  "includeExtensions": true,
  "checkStatus": false,
  "statusCheckConcurrency": 10,
  "respectRobotsTxt": true,
  "maxConcurrencyPerHost": 2,
  "delayBetweenRequestsMs": 0,
  "requestTimeoutSecs": 30,
  "maxRetries": 3
}
```

# Actor output Schema

## `urls` (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": [
        {
            "url": "https://docs.apify.com"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("plumbline-data/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": [{ "url": "https://docs.apify.com" }] }

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

```

## MCP server setup

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