# Sitemap URL Extractor & SEO Health Checker (`thriving_adder/sitemap-url-health`) Actor

Find every URL in a site's robots.txt and XML sitemaps, then check status codes, redirects, canonical, noindex and SEO tags. Pay per URL.

- **URL**: https://apify.com/thriving_adder/sitemap-url-health.md
- **Developed by:** [Adrian LHH](https://apify.com/thriving_adder) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.80 / 1,000 url checkeds

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 & SEO Health Checker

Give it a website. It reads the site's **robots.txt and XML sitemaps** (including sitemap indexes and `.gz` files), lists every URL, and checks each one: **HTTP status, redirects, canonical tag, noindex, title, meta description and H1**. You get a clean table plus a per-site issue summary. Pay per URL.

### What does it do?

- Finds sitemaps automatically from `robots.txt`, or falls back to `/sitemap.xml`.
- Lists every URL with `lastmod`, `changefreq` and `priority`.
- Optionally fetches each URL and reports:
  - status code, final URL and the full redirect chain
  - response time
  - X-Robots-Tag and meta robots (noindex)
  - canonical URL and whether it points elsewhere
  - title (flagged if missing or longer than 60 characters), meta description, H1 count, hreflang count, language and word count
- Tags each problem with a simple issue code (e.g. `HTTP_404`, `REDIRECT_CHAIN`, `META_NOINDEX`, `CANONICAL_POINTS_ELSEWHERE`) and writes a per-site `SUMMARY`.

### What data does it collect?

Only technical, page-level SEO data that the website publishes openly: URLs, HTTP headers, and standard HTML head tags. It does **not** collect personal data, emails or contact details. It does not log in, and it respects robots.txt by default. Disallowed URLs are listed but not fetched, and a site's `Crawl-delay` is honoured. Requests identify themselves with an honest user agent (`SitemapUrlHealthBot`), and a `429 Too Many Requests` answer is respected before one polite retry.

### How much does it cost?

| Event | Price |
|---|---|
| URL listed from a sitemap (no fetch) | $0.0002 |
| URL fetched and checked | $0.0008 |

Apify also adds its standard tiny start fee (about $0.00005 per run). For example, checking a 1,000-page site costs about $0.80, and only listing it costs $0.20. URLs skipped because of robots.txt are charged only as "listed". Use **Max URLs per site** and the run's "Maximum cost per run" to cap spending: the Actor never starts work it cannot bill within your limit.

### Input example

```json
{ "startUrls": [{ "url": "https://example.org" }], "maxUrlsPerSite": 5000, "checkUrls": true, "extractSeo": true }
```

### Output example

Three dataset views: **URL health**, **Problems only**, and **Sitemap inventory**. A per-site `SUMMARY` record (issue counts, sitemaps read, crawl-delay) is saved in the key-value store.

```json
{
  "url": "https://data.gov.my",
  "sitemap": "https://data.gov.my/sitemap-0.xml",
  "lastmod": "2026-10-25T05:48:07.104Z",
  "statusCode": 200,
  "finalUrl": "https://data.gov.my",
  "redirectChain": [],
  "responseMs": 120,
  "title": "data.gov.my",
  "metaDescription": "Your one-stop interface to browse Malaysia's wealth of open data!",
  "canonical": null,
  "h1Count": 0,
  "isIndexable": true,
  "issues": ["MISSING_H1", "MISSING_CANONICAL"]
}
```

### Use cases

- A technical SEO health check before or after a migration.
- Finding broken (4xx/5xx) or redirected URLs that are still in your sitemap.
- Spotting noindexed or wrongly canonicalised pages that waste crawl budget.
- Feeding a site's full URL inventory into other Actors or AI agents (screenshots, content extraction, monitoring).

### FAQ

**My site has no sitemap.** The run reports 0 URLs and lists the sitemap locations it tried. A link-crawl fallback is planned.

**Can I run it on competitors' sites?** Sitemaps are published for crawlers, and the Actor respects robots.txt. Still, follow each site's terms, and keep concurrency low on small sites.

**Problems?** Open an issue in the Issues tab. We respond within 2 business days.

# Actor input Schema

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

Homepage (or any URL) of each site. Sitemaps are read from robots.txt, falling back to /sitemap.xml and /sitemap_index.xml.

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

Caps cost per site.

## `checkUrls` (type: `boolean`):

Off = only list sitemap URLs (cheaper event).

## `extractSeo` (type: `boolean`):

Title, meta description, canonical, robots meta, H1, hreflang, lang, word count.

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

Do not fetch URLs that robots.txt disallows for our user agent (they are still listed, charged as 'URL listed'). Crawl-delay is honoured (concurrency drops to 1).

## `includeUrlPattern` (type: `string`):

Only keep URLs matching this regular expression (JavaScript syntax), e.g. /blog/.

## `excludeUrlPattern` (type: `string`):

Drop URLs matching this regular expression, e.g. ?page=.

## `maxConcurrency` (type: `integer`):

Parallel requests per site. Keep low for small sites.

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

Per request.

## `userAgent` (type: `string`):

Identifies the bot to site owners. robots.txt rules are matched against the token after 'compatible;'.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://apify.com"
    }
  ],
  "maxUrlsPerSite": 20,
  "checkUrls": true,
  "extractSeo": true,
  "respectRobotsTxt": true,
  "maxConcurrency": 10,
  "requestTimeoutSecs": 20,
  "userAgent": "Mozilla/5.0 (compatible; SitemapUrlHealthBot/1.0; +https://apify.com/thriving_adder/sitemap-url-health)"
}
```

# Actor output Schema

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

One row per sitemap URL with status, redirects, indexability and issues.

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

Issue counts, sitemaps read and crawl-delay per site.

# 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://apify.com"
        }
    ],
    "maxUrlsPerSite": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("thriving_adder/sitemap-url-health").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://apify.com" }],
    "maxUrlsPerSite": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("thriving_adder/sitemap-url-health").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://apify.com"
    }
  ],
  "maxUrlsPerSite": 20
}' |
apify call thriving_adder/sitemap-url-health --silent --output-dataset

```

## MCP server setup

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

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/nw4bfyQc5f3Jk1Yaw/builds/aBJBA7pAaEKDE2dXC/openapi.json
