# Sitemap & URL Extractor — Get Every URL of a Website (`dataquarry/sitemap-url-extractor`) Actor

Get every URL of a website: parses sitemap.xml and sitemap-indexes (discovered via robots.txt or the default location), with a same-site crawl fallback when there's no sitemap. Returns each URL + lastmod. No API key.

- **URL**: https://apify.com/dataquarry/sitemap-url-extractor.md
- **Developed by:** [Daniel Brenner](https://apify.com/dataquarry) (community)
- **Categories:** Developer tools, SEO tools, AI
- **Features:** Limited permissions
- **Stats:** 10 total users, 3 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## 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 — Get Every URL of a Website

**Free.** Give it a website (or a sitemap URL) and get back **every URL on the site** — parsed from `sitemap.xml` and sitemap-indexes (auto-discovered via `robots.txt` and the default location), with a **same-site crawl fallback** when a site has no sitemap. No API key.

Perfect for **feeding an LLM/RAG pipeline** (find every page to ingest), site audits, migrations, link checking, and SEO.

### What you get (per URL)

- `url` — the page URL (absolute, deduped)
- `lastmod` — last-modified date from the sitemap, when present (honest-null otherwise)
- `source` — `"sitemap"` or `"crawl"` (how the URL was found)
- `discoveredAt`

### How to use it

```json
{ "startUrls": ["https://example.com"], "maxResults": 5000 }
```

Pass a **site URL** (the sitemap is found automatically) or a **direct sitemap URL**. It handles **sitemap-indexes** (sites that split their sitemap into many files) by following each child sitemap, and if there's no sitemap at all it falls back to a polite, same-site **crawl**. It respects `robots.txt`, identifies itself, and fetches one request at a time.

### Pair it: discover → extract → audit

This is the **discover** step of a clean "feed-your-AI" toolkit by **dataquarry**:

1. **Discover** — *this actor*: every URL of a site.
2. **Extract** — [`dataquarry/website-to-markdown`](https://apify.com/dataquarry/website-to-markdown): turn those URLs into clean, LLM-ready Markdown.
3. **Audit** — [`dataquarry/website-seo-metadata-checker`](https://apify.com/dataquarry/website-seo-metadata-checker): SEO & metadata for each page.

Also see the [dataquarry OSM place-data scrapers](https://apify.com/dataquarry) and free guides at [openplacedata.com](https://openplacedata.com).

### Clean & honest

Reads only public `sitemap.xml`/`robots.txt` and (in fallback) public pages; respects `robots.txt`; sends a descriptive User-Agent; no logins, no PII. Missing values are `null`, never guessed.

### FAQ

**Do I need an API key?** No — give it a URL and run it. It's free.

**What if the site has no sitemap?** It crawls the site's own links (same-domain, bounded) so you still get a URL list.

**Does it handle huge sitemap-indexes?** Yes — it follows child sitemaps up to the `maxSitemaps` and `maxResults` caps you set.

***

⭐ **Found this useful?** A quick rating on this actor's Store page helps others discover it — and if something is off or you wish it did more, open an issue on the actor. I read every one.

# Actor input Schema

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

Site URLs (e.g. https://example.com) or direct sitemap URLs. For a site, the sitemap is auto-discovered via robots.txt and /sitemap.xml.

## `maxResults` (type: `integer`):

Maximum number of URLs to return.

## `crawlFallback` (type: `boolean`):

If a site has no sitemap, discover URLs by crawling its same-site links instead.

## `maxCrawlPages` (type: `integer`):

Hard cap on pages visited when using the crawl fallback.

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

Hard cap on sitemap files fetched (sitemap-indexes can reference many).

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

In crawl-fallback mode, skip URLs disallowed by robots.txt for our user-agent.

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

Optional politeness delay between requests, in milliseconds.

## Actor input object example

```json
{
  "startUrls": [
    "https://nodejs.org/"
  ],
  "maxResults": 5000,
  "crawlFallback": true,
  "maxCrawlPages": 100,
  "maxSitemaps": 50,
  "respectRobotsTxt": true,
  "requestDelayMs": 0
}
```

# 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://nodejs.org/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("dataquarry/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": ["https://nodejs.org/"] }

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

```

## MCP server setup

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