# Sitemap URL Extractor: All Pages from robots.txt & Sitemaps (`dataforgehq/sitemap-urls`) Actor

Extract every URL a website publishes in its XML sitemaps: robots.txt discovery, nested indexes, gzip, hreflang, images, news. Fast and cheap — no browser. $0.30 per 1,000 URLs.

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

## Pricing

from $0.30 / 1,000 urls

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: All Website Pages from robots.txt & XML Sitemaps

Turn any domain into a **complete list of sitemap URLs** — every page the site publishes in its XML sitemaps, with `lastmod`, `changefreq`, `priority`, hreflang alternates, image/video counts and Google News titles. No browser needed: it only reads `robots.txt` and sitemap files, so it is fast (~170k URLs / 30s in our tests) and cheap.

**$0.30 per 1,000 URLs** ($0.0003 each). Error rows are free.

### What it handles

- **Discovery** from `robots.txt` `Sitemap:` lines, then common fallbacks (`/sitemap.xml`, `/sitemap_index.xml`, `/wp-sitemap.xml`, `.gz`, `.txt`)
- Nested **sitemap indexes** (up to 6 levels), gzip, plain-text, RSS/Atom-as-sitemap
- Extensions: hreflang, image, video, news title
- Include/exclude globs or regex, *modified after* date, **only-new** monitoring mode

### Fast free-tier try

Prefill uses a tiny sitemap and a low URL cap so a Try Actor run finishes in seconds:

```json
{
  "startUrls": ["https://www.sitemaps.org/sitemap.xml"],
  "maxUrlsTotal": 50,
  "maxUrlsPerSite": 50
}
```

### Example output

| Field | Example |
|---|---|
| `url` | `https://www.example.com/products/123` |
| `lastmod` | `2026-10-27T22:49:48.000Z` |
| `changefreq` / `priority` | `daily` / `0.8` |
| `imageCount` / `videoCount` | `1` / `0` |
| `newsTitle` | Headline when present |
| `sitemap` | Source sitemap URL |
| `site` | Origin |

```json
{
  "url": "https://www.nytimes.com/2026/10/27/opinion/example.html",
  "lastmod": "2026-10-27T22:49:48.000Z",
  "imageCount": 1,
  "videoCount": 0,
  "newsTitle": "Example headline",
  "sitemap": "https://www.nytimes.com/sitemaps/new/news.xml.gz",
  "site": "https://www.nytimes.com",
  "error": null
}
```

### Pricing

Actor start + **$0.0003 per URL** written. Default safety cap `maxUrlsTotal=100000` (set `0` for no limit). Use *Maximum cost per run* to stop cleanly.

### Limits

- Only URLs listed in sitemaps (not a full crawler)
- `lastmod` is whatever the site reports
- Follows robots.txt Disallow when probing fallback paths

### Related Actors

#### SEO & web suite

- [SEO Audit Crawler](https://apify.com/dataforgehq/seo-audit-crawler)
- [Broken Link Checker](https://apify.com/dataforgehq/broken-link-checker)
- [Bulk Redirect Checker](https://apify.com/dataforgehq/redirect-checker)
- [Website Metadata / Open Graph Extractor](https://apify.com/dataforgehq/website-metadata-extractor)
- [Website Screenshot](https://apify.com/dataforgehq/website-screenshot)
- [Website Image Extractor](https://apify.com/dataforgehq/website-image-extractor)
- [SSL Certificate Checker](https://apify.com/dataforgehq/ssl-certificate-checker)
- [Subdomain Finder](https://apify.com/dataforgehq/subdomain-finder)
- [DNS & Email Security Checker (SPF/DKIM/DMARC)](https://apify.com/dataforgehq/dns-email-security-checker)
- [WHOIS Domain Lookup](https://apify.com/dataforgehq/whois-domain-lookup)
- [Domain Availability Checker](https://apify.com/dataforgehq/domain-availability-rdap)
- [Tech Stack Detector](https://apify.com/dataforgehq/tech-stack-detector)

#### Documents suite

- [PDF Text Extractor](https://apify.com/dataforgehq/pdf-text-extractor)
- [Scanned PDF & Image OCR](https://apify.com/dataforgehq/pdf-image-ocr)
- [Article Extractor](https://apify.com/dataforgehq/article-extractor)
- [URL & HTML to PDF Converter](https://apify.com/dataforgehq/url-to-pdf)

#### Jobs suite

- [Greenhouse Jobs API](https://apify.com/dataforgehq/greenhouse-jobs-api)
- [Lever Jobs API](https://apify.com/dataforgehq/lever-jobs-api)
- [Ashby Jobs API](https://apify.com/dataforgehq/ashby-jobs-api)
- [Workday Jobs API](https://apify.com/dataforgehq/workday-jobs-api)
- [Company Jobs API (10 ATS)](https://apify.com/dataforgehq/ats-jobs-api)
- [Remote Jobs Aggregator](https://apify.com/dataforgehq/remote-jobs-aggregator)

#### Also by us

- [Wayback Machine Snapshots](https://apify.com/dataforgehq/wayback-machine-snapshots)
- [RSS Feed Reader](https://apify.com/dataforgehq/rss-feed-reader)
- [Website Contact Details Scraper](https://apify.com/dataforgehq/website-contact-details-scraper)

# Actor input Schema

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

Domains (example.com), any page on the site (https://example.com/blog), or direct sitemap URLs (https://example.com/sitemap.xml, .xml.gz or .txt). For a domain, sitemaps are discovered from robots.txt, then common locations.

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

Keep only URLs matching at least one pattern. Use \* as a wildcard (e.g. */blog/*), or wrap in slashes for a regex (//products/\d+/).

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

Drop URLs matching any of these patterns (same syntax as include).

## `lastmodAfter` (type: `string`):

Keep only URLs whose <lastmod> is on or after this date (YYYY-MM-DD). URLs without lastmod are kept unless 'Require lastmod' is on.

## `requireLastmod` (type: `boolean`):

When filtering by date, drop URLs that have no <lastmod>.

## `onlyNew` (type: `boolean`):

Monitoring mode: remembers returned URLs (per start-URL list) and outputs only new ones on later runs. Great for tracking new pages, products or articles on a competitor's site.

## `includeAlternates` (type: `boolean`):

Add the xhtml:link hreflang alternates listed for each URL.

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

0 = no limit.

## `maxUrlsTotal` (type: `integer`):

Safety cap on URLs output per run (default 100,000). Set 0 for no limit. Big sites can list millions of URLs; you can also cap spend with the run's Maximum cost setting.

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

Safety limit on sitemap files followed per site (indexes included).

## Actor input object example

```json
{
  "startUrls": [
    "https://www.sitemaps.org/sitemap.xml"
  ],
  "requireLastmod": false,
  "onlyNew": false,
  "includeAlternates": true,
  "maxUrlsPerSite": 50,
  "maxUrlsTotal": 50,
  "maxSitemapsPerSite": 1000
}
```

# Actor output Schema

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

All sitemap URLs in the default dataset, shown with the 'overview' table view.

# 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://www.sitemaps.org/sitemap.xml"
    ],
    "maxUrlsPerSite": 50,
    "maxUrlsTotal": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("dataforgehq/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://www.sitemaps.org/sitemap.xml"],
    "maxUrlsPerSite": 50,
    "maxUrlsTotal": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("dataforgehq/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://www.sitemaps.org/sitemap.xml"
  ],
  "maxUrlsPerSite": 50,
  "maxUrlsTotal": 50
}' |
apify call dataforgehq/sitemap-urls --silent --output-dataset

```

## MCP server setup

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