# Robots Policy Change and URL Auditor (`danielmichalek/robots-txt-sitemap-monitor`) Actor

Supplied robots files reveal blocked URLs for selected crawlers. Compare a previous policy and inspect matched rule lines in JSON and CSV. Send your files and URLs through the input to review changes.

- **URL**: https://apify.com/danielmichalek/robots-txt-sitemap-monitor.md
- **Developed by:** [Daniel Michałek](https://apify.com/danielmichalek) (community)
- **Categories:** SEO tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$30.00 / 1,000 complete robots policy reports

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

## Robots Policy Change and URL Auditor

### What it does

Review supplied robots.txt snapshots against important site URLs and exact crawler product tokens. The report contains an allow or disallow decision, the winning rule and its original line number. A supplied previous snapshot enables comparison of URL decisions, rule counts and sitemap declarations.

SEO teams can inspect whether a proposed robots deployment blocks product pages. Teams preparing content for search and AI crawlers can inspect the policy for each selected token. Decisions describe the supplied text. Actual crawler behavior and live server availability require a separate check.

### Input

Pass documents with unique id, robotsUrl, content and urls. robotsUrl must be an absolute HTTP or HTTPS URL at the origin root /robots.txt with no query, fragment or credentials. baselineContent is optional. An empty supplied content string is evaluated as an empty policy. Provide userAgents as exact product tokens such as Googlebot and GPTBot. Tokens accept letters, underscores and hyphens, or the generic \* token. Case is ignored for agent selection and preserved for path matching.

Limits cover 10 documents, 200 supplied URLs total, 10 crawler tokens, 1000 valid rule directives across current and previous files, 10000 lines per file, 500000 bytes per file, 2048 bytes per line and URL, and 2000000 bytes for the serialized input. At most 2000 URL and crawler combinations are emitted. Duplicate tokens are removed within each policy group. Aggregate expanded rule assignments are capped at 10000 before parser allocation. A conservative 50000000 matching work budget rejects expensive combinations before matching. Compact JSON output is capped at 6000000 bytes. These limits interact, so an input using every maximum can be rejected.

### Output

One complete dataset record contains documents, decisions, findings and aggregate counts. Each current or previous policy carries a SHA256 text hash, group inventory, rule count and sitemap line references. Decision changes distinguish BECAME_ALLOWED, BECAME_DISALLOWED, UNCHANGED, UNKNOWN, OUT_OF_SCOPE and NO_BASELINE. Rule differences preserve duplicate counts and normalized pattern identity.

ROBOTS_AUDIT holds JSON, DECISIONS_CSV holds the complete URL decision table and REPORT holds a readable Markdown review with the first 100 evaluations. The JSON and CSV include all evaluations. CSV text beginning with spreadsheet formula characters is prefixed with an apostrophe. Machine consumers should use JSON for unchanged raw values.

### Matching contract

The existing pinned robots-parser 3.0.1 matching engine receives explicitly parsed groups through its public addRule API. Specific groups matching the complete product token are merged. An existing empty specific group suppresses the generic fallback. Unsupported directives, comments and sitemap lines preserve group membership. Empty Allow and Disallow values are ignored. Supported patterns include prefix rules, \* wildcards and a terminal $ anchor. The longest matching normalized pattern wins, with Allow winning a tie. Query strings participate and fragments are excluded.

UTF8 paths are percent encoded. Percent hex digits are uppercase and encoded unreserved ASCII characters are decoded before comparison. Encoded reserved characters remain encoded. Absolute URLs use the WHATWG URL parser, including its dot segment normalization. The selected crawler input is a product token. Full browser user agent strings and partial product token matching are outside the contract.

Malformed policy lines, orphan rules, invalid tokens or invalid rule encodings produce line-bound ERROR findings. A policy with ERROR findings yields UNKNOWN for its same-origin URLs. Unsupported directives and invalid sitemap URLs produce warnings. URLs of another origin yield OUT_OF_SCOPE. A complete report means processing completed. Its qualityStatus records whether review is required.

### Pricing and cost control

The current price is shown on the Pricing tab. The unit is one complete robots-policy-report for the bounded input, rather than one event for every URL or crawler. A near-limit cloud sample has been measured on the FREE tier. That sample does not establish a universal maximum cost, equivalent costs on paid tiers, customer demand or realized margin.

The runtime permits one report and zero content requests. The single report delivery journal binds input, runtime, pricing, CSV, Markdown and the physical dataset record. A verified COMPLETE replay reuses the report. A PREPARED or conflicting record requires reconciliation before retry.

### Limitations and fair use

This product audits text supplied by the user. Network fetching, robots HTTP status and redirects, robots cache lifetime, response encoding detection, scheduled monitoring, sitemap fetching and search indexing are outside the current execution scope. It does not configure crawler access or a website. It evaluates supplied baseline snapshots and has no server-side historical archive.

Use source text you are authorized to process. The output can contain submitted URLs, including query parameters, so remove private parameters before providing input. Files stay in the run dataset and key value store under the account storage policy. The algorithm makes no AI inference calls and executes no supplied code.

### Example

examples/input.json compares a shop policy for Googlebot and GPTBot against three URLs. The example distinguishes a private path, an explicit public exception and a newly blocked crawler. examples/output.json is generated by the actual local SDK entry point.

### Build and tests

Dependencies are exact pins with a lockfile. npm ci --offline --ignore-scripts --no-audit --no-fund was verified locally. Docker uses npm ci with lifecycle scripts disabled. The Docker image has been built in Apify Cloud, and the SDK entry point has completed a source-verified private run. npm test runs the local unit and delivery integration suite. npm start runs src/main.mjs with the normal Apify SDK lifecycle.

# Actor input Schema

## `documents` (type: `array`):

Objects with unique id, absolute root robotsUrl, content, urls and optional baselineContent. Up to 10 documents, 200 supplied URLs total, 2 MB input.

## `userAgents` (type: `array`):

Exact product tokens such as Googlebot or GPTBot, using letters, underscores and hyphens. Use \* for the generic group. Case insensitive.

## `maxItems` (type: `integer`):

One bounded policy report per run.

## Actor input object example

```json
{
  "documents": [
    {
      "id": "shop",
      "robotsUrl": "https://example.com/robots.txt",
      "content": "User-agent: *\nDisallow: /private\nAllow: /private/help\nSitemap: https://example.com/sitemap.xml\n\nUser-agent: GPTBot\nDisallow: /\n",
      "baselineContent": "User-agent: *\nDisallow: /private\n",
      "urls": [
        "https://example.com/products/widget",
        "https://example.com/private/order",
        "https://example.com/private/help"
      ]
    }
  ],
  "userAgents": [
    "Googlebot",
    "GPTBot"
  ],
  "maxItems": 1
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `csv` (type: `string`):

No description

## `report` (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 = {
    "documents": [
        {
            "id": "shop",
            "robotsUrl": "https://example.com/robots.txt",
            "content": "User-agent: *\nDisallow: /private\nAllow: /private/help\nSitemap: https://example.com/sitemap.xml\n\nUser-agent: GPTBot\nDisallow: /\n",
            "baselineContent": "User-agent: *\nDisallow: /private\n",
            "urls": [
                "https://example.com/products/widget",
                "https://example.com/private/order",
                "https://example.com/private/help"
            ]
        }
    ],
    "userAgents": [
        "Googlebot",
        "GPTBot"
    ],
    "maxItems": 1
};

// Run the Actor and wait for it to finish
const run = await client.actor("danielmichalek/robots-txt-sitemap-monitor").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 = {
    "documents": [{
            "id": "shop",
            "robotsUrl": "https://example.com/robots.txt",
            "content": """User-agent: *
Disallow: /private
Allow: /private/help
Sitemap: https://example.com/sitemap.xml

User-agent: GPTBot
Disallow: /
""",
            "baselineContent": """User-agent: *
Disallow: /private
""",
            "urls": [
                "https://example.com/products/widget",
                "https://example.com/private/order",
                "https://example.com/private/help",
            ],
        }],
    "userAgents": [
        "Googlebot",
        "GPTBot",
    ],
    "maxItems": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("danielmichalek/robots-txt-sitemap-monitor").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 '{
  "documents": [
    {
      "id": "shop",
      "robotsUrl": "https://example.com/robots.txt",
      "content": "User-agent: *\\nDisallow: /private\\nAllow: /private/help\\nSitemap: https://example.com/sitemap.xml\\n\\nUser-agent: GPTBot\\nDisallow: /\\n",
      "baselineContent": "User-agent: *\\nDisallow: /private\\n",
      "urls": [
        "https://example.com/products/widget",
        "https://example.com/private/order",
        "https://example.com/private/help"
      ]
    }
  ],
  "userAgents": [
    "Googlebot",
    "GPTBot"
  ],
  "maxItems": 1
}' |
apify call danielmichalek/robots-txt-sitemap-monitor --silent --output-dataset

```

## MCP server setup

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

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/8a36lMOlF8SbeHnnV/builds/0eFBw7Q5qPvRSMioa/openapi.json
