# Sitemap Extractor & Per-URL robots.txt Checker (`kopachelli/sitemap-extractor-robots-checker`) Actor

Give it a website. It reads robots.txt, finds and follows the sitemaps, and returns the listed URLs — up to the maxUrls cap — with last-modified dates, a page type, and whether robots.txt allows a crawler you name (Googlebot, GPTBot) to fetch it.

- **URL**: https://apify.com/kopachelli/sitemap-extractor-robots-checker.md
- **Developed by:** [Khristian Kopachelli](https://apify.com/kopachelli) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.20 / 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

**Give it a website. It reads the site's `robots.txt`, finds the sitemaps, follows sitemap
indexes, and returns the URLs the site lists — up to the `maxUrls` cap, and none at all from a
site whose `robots.txt` cannot be read. Each URL comes with its last-modified date, the sitemap
it came from, a simple page type, and a flag that says whether `robots.txt` allows a crawler you
name (for example `Googlebot` or `GPTBot`) to fetch it.**

It reads only the files that a site publishes for crawlers: `robots.txt` and sitemaps. It never
opens the pages themselves.

### What it is for

- **SEO audits.** Get the URL list of a site, up to `maxUrls` per run. Find URLs that the sitemap lists and `robots.txt` blocks.
- **Crawlers, RAG pipelines, site migrations.** Get the list of pages to fetch before you fetch anything.
- **AI crawler access.** See which listed pages a given AI crawler may read.
- **AI agents.** One call that answers "which pages does this site have?"

### Input

| Field | Default | Meaning |
|---|---|---|
| `startUrls` (required) | — | Websites or sitemap files, at most 10,000. For a website, the Actor reads `robots.txt` and finds the sitemaps itself. For the address of a page, the root of its site is used. For a sitemap file (`…/sitemap.xml`, `….xml.gz`, `….txt`), only that sitemap is read. |
| `maxUrls` | 1000 | The run stops when it has returned this many URLs. The largest value is 1,000,000. There is no "unlimited". |
| `robotsUserAgent` | `*` | The crawler for which every URL is checked against `robots.txt`. Give the name (`Googlebot`, `GPTBot`); a whole User-Agent string works too — the name after `compatible;` is used. |
| `includePatterns` | none | Regular expressions (at most 100, of 300 characters each). A URL is kept if it matches at least one — in its written form or its decoded form, so `/café/` also matches `/caf%C3%A9/`. |
| `excludePatterns` | none | Regular expressions (same limits). A URL that matches one is dropped. |
| `modifiedAfter` | none | A date (`YYYY-MM-DD`). Keeps URLs whose last-modified date is that day or later. The day starts at 00:00 UTC and the sitemap dates are compared in UTC. URLs without a date are dropped when this is set. |
| `discoverSitemaps` | `true` | When `robots.txt` names no sitemap, try the common addresses (see below). |
| `includeExtensions` | `false` | Add `images` and `alternates` (language versions) from the sitemap, at most 20 of each. |
| `maxSitemaps` | 500 | The run stops when it has read this many sitemap files; the common-path guesses and files that `robots.txt` closes for this Actor do not count. The largest value is 10,000. |

A wrong input ends the run at once, with a message that names the field — unless only some
start URLs are unusable: those are skipped, counted in the record `OUTPUT` and named in the
status message, and the run fails only when none is usable. A broken regular expression is
found before any request is made, and so is one the matching engine cannot run in guaranteed
linear time (look-ahead and look-behind are not accepted); every accepted pattern answers in
time proportional to the URL, so a pattern cannot hold the run.

### Example input

```json
{
    "startUrls": [{ "url": "https://docs.apify.com" }],
    "maxUrls": 1000,
    "robotsUserAgent": "GPTBot"
}
```

This is the prefill input with `robotsUserAgent` changed to `GPTBot`: it reads the sitemaps of
`docs.apify.com` and marks each URL with the `robots.txt` answer for GPTBot.

### Output

#### Dataset: one item per URL

```json
{
    "url": "https://docs.apify.com/api",
    "site": "https://docs.apify.com",
    "sitemapUrl": "https://docs.apify.com/sitemap_base.xml",
    "lastmod": null,
    "changefreq": "weekly",
    "priority": 0.5,
    "urlType": "docs",
    "robotsAllowed": true,
    "robotsRule": null
}
```

| Field | Meaning |
|---|---|
| `url` | A URL that the site lists in a sitemap. Every URL appears once per run, also after a restart. |
| `site` | Origin (scheme, host and port) of the start URL. |
| `sitemapUrl` | The sitemap file that lists the URL. |
| `lastmod` | The last-modified date from the sitemap, as ISO 8601 in UTC. `null` when the sitemap gives no valid date. |
| `changefreq`, `priority` | As the sitemap gives them. `null` when absent or not valid. |
| `urlType` | `home`, `product`, `category`, `article`, `docs`, `info`, `file` or `other`. A rule on the path and the host name of the URL (see below), not a guess about the content. |
| `robotsAllowed` | `true` or `false`: whether the site's `robots.txt` allows the crawler named in `robotsUserAgent`. `null` when it cannot be known: the URL has another scheme, host or port than the site — a `robots.txt` speaks only for its own origin. |
| `robotsRule` | The line of `robots.txt` that decided, for example `Disallow: /private/`. `null` when no rule matches. |
| `images`, `alternates` | Only with `includeExtensions`. |

#### Key-value store: the record `OUTPUT`

A summary of the run. For every site: the status of `robots.txt`, the sitemaps it names, the
crawl delay it asks for, and every sitemap file, with its type, its number of URLs,
how many of them went to the dataset, and its error if there was one. Then the totals, and the
reason if the run stopped early (`maxUrls`, `maxSitemaps`, or the spending limit).

A sitemap that cannot be read never fails the run. Its error is in the summary and the other
sitemaps are read — unless the host itself stopped answering: then the site is reported
`unavailable` and that host is not asked again in the run.

### How it finds the sitemaps

1. It reads `/robots.txt` of the site.
2. If `robots.txt` has `Sitemap:` lines, it reads those sitemaps.
3. If it has none, and `discoverSitemaps` is on, it tries these addresses in order and uses the
   first that holds a sitemap: `/sitemap.xml`, `/sitemap_index.xml`, `/sitemap-index.xml`,
   `/wp-sitemap.xml`, `/sitemap.xml.gz`, `/sitemap.txt`.
4. A sitemap index is followed up to five levels deep. No sitemap is read twice.

What it reads: XML sitemaps (`urlset`) and sitemap indexes, plain-text sitemaps (one URL per line),
and gzip files. Gzip is recognised by the content of the file, not by its name. An unescaped `&`
in a URL, the most common defect of real sitemaps, is repaired and counted. The `encoding` the XML
declaration names is honoured; a URL with bytes that no encoding could read is counted invalid,
not delivered as a changed address. A file that is no sitemap — an HTML page, a "not found" answer
in plain text or JSON — does not count, and the search for a sitemap goes on. A broken file gives
the URLs that were read before the break, and an error in the summary. RSS and Atom feeds are not read.

When `robots.txt` is missing — any 4xx answer that is not a block — everything is allowed. When it cannot be read (a server
error, no answer, or a block), the site is skipped and reported: what the site allows is then not known.

`robots.txt` may redirect, up to five hops. A hop to another host is followed only when that
host's own `robots.txt` allows it — it is read first — except a hop to `/robots.txt` itself.
When the redirect ends on `/robots.txt` of another host, that file is also that host's
`robots.txt`. When it ends on any other page, the page is read as the start site's
`robots.txt`, and the URLs of the other host get `robotsAllowed: null`: a page is not a
`robots.txt` and decides nothing for its own host.

### Page types

`urlType` is decided by these rules, in this order:

1. `home`: the root of the site, also behind leading language or region segments (`/en/`,
   `/de-at/`, `/es-419/`). A root path with a query is `other`, not `home`: `?p=123` and
   `index.php?route=…` route by the query.
2. `file`: the path ends in a file extension that is not a web page (`.pdf`, `.jpg`, `.zip`, `.xml`, …).
3. The first path segment that names a kind of page decides:
   - a shop segment (`products`, `product`, `item`, `dp`, `collections`, `category`, `shop`, `tag`, …):
     `product` when a product segment is followed by the product itself (`/products/blue-widget`),
     else `category` (`/products`, `/collections/shoes`). `/p/` counts as a product segment only
     when the segment after it holds a digit (`/p/12345`);
   - `article`: `blog`, `news`, `articles`, `posts`, `press`, `stories`, … — but `article` and
     `articles` give `docs` on a documentation host (rule 7);
   - `docs`: `docs`, `help`, `support`, `guides`, `api`, `reference`, `faq`, `kb`, `tutorials`, ….
4. `article`: the path starts with a year and a month (`/2026/03/…`).
5. `product`: the last segment ends in `-p` and a number (`/pricing-p2`, `/about-p1`).
6. `info`: the first segment is `about`, `contact`, `privacy`, `terms`, `legal`, `careers`,
   `pricing`, …, or starts with one of those words followed by `-` or `_` (`/about-us`,
   `/privacy-policy`). A page extension is ignored, so `/about.html` counts too.
7. `docs`: the host starts with `docs.`, `help.`, `support.`, `developer.` and the like. On such a
   host, shop segments and the `-p<number>` rule are not read as a shop or a product.
8. `other`: everything else.

### How it behaves on the web

- **It says who it is.** Every request carries the User-Agent
  `SitemapExtractorRobotsChecker/1.0 (+https://apify.com/kopachelli/sitemap-extractor-robots-checker)`.
  It does not pose as a browser or as another bot.
- **It obeys `robots.txt` for its own requests.** A sitemap that `robots.txt` closes for this Actor
  is not fetched, and the summary says so. To address this Actor in a `robots.txt`, use the name
  `SitemapExtractorRobotsChecker` — a version or comment after it (`SitemapExtractorRobotsChecker/1.0`)
  names the same crawler. There is no input that turns this off.
- **`robots.txt` is read by RFC 9309.** A `User-agent` line names a crawler by its product token;
  `Allow`/`Disallow` paths may hold `*` and a final `$`, and non-ASCII characters are compared in
  their percent-encoded form. A named group applies to the crawler of exactly that name; every
  other crawler gets the `*` groups.
- **It is slow on purpose.** It sends one request at a time, at least 250 ms between two
  request starts, and a `Crawl-delay` of the site is honoured up to 10 seconds.
- **It retries once at most**, on 429, on 503 and when there is no answer, and never sooner than
  the server asks. If the server asks to wait more than 30 seconds, or names a wait that cannot
  be read, it does not retry.
- **It never goes around a block.** On 401, 403, 451, a challenge answer (the headers
  `cf-mitigated: challenge` or `x-amzn-waf-action: challenge`, `captcha` or `signal`,
  whatever the status), or 429 after the one retry, it stops for
  that site and reports it. A block is remembered for the whole run: another start URL of the
  same site is not asked again. It uses no proxy.
- **It leaves a silent host alone.** When a host gives no answer or a server error three times
  in a row — a download that breaks off counts too — or asks for a wait longer than 30 seconds,
  it is not requested again in the run, and the site is reported `unavailable`.
- **It reads public addresses only**: `http` and `https`, and no address of a private network —
  written out in any form, including the IPv6 transition addresses (NAT64, 6to4, Teredo) that
  carry a private IPv4 address inside.
- **It never carries a password.** An address with a user name or a password — a `Sitemap:`
  line, a sitemap entry, a start URL or a redirect target — is read without them or refused,
  and the password reaches neither the dataset, the summary, the status message nor the log.

### Pricing

The Actor uses Apify's pay-per-event model. Three events are charged:

- `apify-actor-start` — once per run;
- `site-analyzed` — once per site whose `robots.txt` was read (a site that is skipped or blocked
  is not charged);
- `apify-default-dataset-item` — once per URL written to the dataset.

URLs dropped by the filters, duplicates and URLs of a site that could not be read are never
written and never charged. The current prices are set in Console and shown on this page.

### Limits

| What | Limit |
|---|---|
| `robots.txt` | the first 500 KB are read; a line cut at the limit is dropped; at most 1,000 `Sitemap:` lines are kept and the rest are counted in the summary |
| One sitemap | 60 MB after decompression; 256 KB between two markup events; a line or text node of 8,192 characters |
| Sitemap index depth | 5 levels |
| Waiting for an answer | 30 seconds; a pause of 30 seconds in a download ends it; one file may take 5 minutes |
| Redirects | 5 per request; every hop is checked against `robots.txt` |
| URLs per run | `maxUrls`, at most 1,000,000 |
| Sitemap files per run | `maxSitemaps`, at most 10,000 |

### When a run is interrupted

If the platform moves the run to another server, or the run is aborted gracefully, the Actor saves
where it is — and the summary of the work so far — before it stops. The restarted run continues
from there and does not return a URL twice.

### Questions and answers

**Does it fetch the pages the sitemap lists?**
No. It reads only `robots.txt` and sitemap files. Checking the pages themselves (status codes,
titles, `noindex`) is a different kind of tool.

**What does `robotsAllowed: null` mean?**
The URL is on another origin than the site — another scheme, host or port. A `robots.txt` speaks
only for its own origin, so no answer can be given. It is not "blocked" and not "allowed".

**What if the site has no `robots.txt`, or it is missing?**
A `robots.txt` that answers with a non-blocking 4xx (404 and the like) means everything is
allowed, and the sitemaps are still found. When `robots.txt` cannot be read at all — a server
error, no answer, or a block — the site is skipped and reported; what it allows is then unknown.

**Can I check several crawlers at once?**
One crawler per run: `robotsUserAgent` takes a name such as `Googlebot`, `GPTBot` or `ClaudeBot`,
or a whole User-Agent string (the name after `compatible;` is used). Run the Actor once per
crawler for several answers.

**Does it work on sites behind a CDN or a bot wall?**
If the site answers with a block — 401, 403, 451, a challenge page, or 429 after one retry — the
Actor stops for that site and reports it. It does not pose as a browser and uses no proxy.

### Support

Questions and bug reports: the **Issues** tab of this Actor's page. The version and the changelog
are on the Actor's page too.

# Actor input Schema

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

Websites (https://docs.apify.com) or sitemap files (https://docs.apify.com/sitemap.xml). For a website, the Actor reads robots.txt and finds the sitemaps itself. For the address of a page, the root of its site is used. For a sitemap file, only that sitemap is read.

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

The run stops when it has returned this many URLs. There is no "unlimited": the largest value is 1,000,000.

## `robotsUserAgent` (type: `string`):

Every returned URL says whether the site's robots.txt allows this crawler to fetch it, or that it cannot be known. Write the name of the crawler, for example Googlebot, Bingbot, GPTBot or ClaudeBot. A whole User-Agent string works too: the name after "compatible;" is used. The value \* means the rules for all crawlers.

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

Regular expressions, at most 100 of 300 characters each. A URL is kept if it matches at least one of them, in its written form or its decoded form: /café/ also matches /caf%C3%A9/. Expressions with look-ahead or look-behind are not accepted. Leave empty to keep all URLs.

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

Regular expressions, at most 100 of 300 characters each. A URL that matches one of them is dropped, in its written or decoded form. Example: ?page=\d+$ drops paginated lists.

## `modifiedAfter` (type: `string`):

Keep only URLs whose last-modified date in the sitemap is this day or later. The day starts at 00:00 UTC and the sitemap dates are compared in UTC. URLs for which the sitemap gives no date are dropped when this is set.

## `discoverSitemaps` (type: `boolean`):

When robots.txt names no sitemap, try /sitemap.xml, /sitemap_index.xml, /sitemap-index.xml, /wp-sitemap.xml, /sitemap.xml.gz and /sitemap.txt, and use the first that holds a sitemap.

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

Add the image addresses and the language versions (hreflang) that a sitemap gives for a URL, at most 20 of each.

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

The run stops when it has read this many sitemap files; the common-path guesses and files that robots.txt closes for this Actor do not count. The largest value is 10,000.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://docs.apify.com"
    }
  ],
  "maxUrls": 1000,
  "robotsUserAgent": "*",
  "includePatterns": [],
  "excludePatterns": [],
  "discoverSitemaps": true,
  "includeExtensions": false,
  "maxSitemaps": 500
}
```

# Actor output Schema

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

One item per URL: the URL, its site and sitemap, the last-modified date, a page type, and whether robots.txt allows the crawler named in the input.

## `summary` (type: `string`):

Per site: the status of robots.txt, the sitemaps it names, every sitemap that was read with its type, URL count and error, and the totals of the run.

# 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("kopachelli/sitemap-extractor-robots-checker").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("kopachelli/sitemap-extractor-robots-checker").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 kopachelli/sitemap-extractor-robots-checker --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,kopachelli/sitemap-extractor-robots-checker"
        }
    }
}
```

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/oXQdRWVL4Q5f3AurE/builds/7ZftBVFYljvxGh2Uq/openapi.json
