# XML Sitemap Health & Freshness Auditor (`afkdigital/xml-sitemap-health-freshness-auditor`) Actor

Inspect sitemap XML, index coverage, duplicate URLs and declared dates. Optionally check sampled pages using HTTP.

- **URL**: https://apify.com/afkdigital/xml-sitemap-health-freshness-auditor.md
- **Developed by:** [AFK Digital](https://apify.com/afkdigital) (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

from $5.00 / 1,000 sitemap processeds

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

## XML Sitemap Health & Freshness Auditor

Audit public sitemap files and indexes before a site migration, after a release, or on a scheduled SEO review. Export the dataset as JSON or CSV. Filter by recordType = summary to see how much of the submitted inventory was examined.

### Quick start

Run the prefilled inline example to get a repeatable duplicate-URL and future-date report. For a live audit, clear sitemapFiles and submit:

```json
{"sitemapUrls":["https://www.sitemaps.org/sitemap.xml"],"maxSitemaps":5,"maxUrls":200,"checkUrlStatus":true,"sampleSize":5,"timeoutSeconds":8,"concurrency":3}
```

Supply up to 100 combined roots. sitemapFiles accepts objects containing content (XML text) or base64 (XML or gzipped bytes). Uploaded bytes are identified by SHA-256. Root URLs and absolute index children are fetched over HTTP(S). No browser, proxy, robots discovery, or page-link crawling. Each redirect is resolved, checked for non-public addresses and connected by validated IP with TLS hostname verification. Up to five redirects per request.

### Reading the dataset

Each sitemap row reports the original location, parent of first discovery, final location, HTTP status if applicable and structural findings. Entry rows preserve declaredLastmod. Duplicate rows point to the first sitemap. Index cycle rows identify the closing edge. Page-check rows distinguish HTTP success, restriction (403/429), missing (404/410), other HTTP errors, and inconclusive transport failures. Failed HEAD requests and error statuses other than restrictions trigger one bounded GET. Only response headers are needed. A server may respond differently for other clients, times or regions. A 2xx response does not establish page content quality or indexability.

Namespaces are matched by URI, including prefixed documents. The XML parser rejects DTDs, disables external entities and bounds depth and field length. Both sitemapindex and urlset are supported. Sitemap protocol limits are 50,000 entries and 50 MiB uncompressed per file. Operational limits here are 8 MiB received and 16 MiB expanded per file. Gzip is detected from its signature. A size rejection is an audit limitation. Extensions are not audited. This is a structural audit, not full XSD or search-engine validation.

lastmod is a publisher declaration. Page entries refer to the page, index entries to the child sitemap. The auditor compares calendar dates against asOfDate (UTC today by default), independently of HTTP Last-Modified. Invalid and future dates have separate finding codes. Old dates alone generate no finding. Search engines decide whether and when to fetch a page.

### Coverage

maxSitemaps limits unique locations admitted in breadth-first order. maxUrls limits page entries reviewed including duplicates; sampleSize limits optional checks to the first distinct reviewed URLs. Sampling is deterministic and order-dependent. concurrency applies to page checks. Read the final coverage row and the OUTPUT key-value record. A failed or deferred child can hide an unknown number of pages. pageEntriesInParsedMaps counts only entries in successfully parsed files. uncheckedReviewedUrls have unknown status.

### Automation examples

**n8n** — Use Schedule Trigger → HTTP Request (POST) → Split Out or filter dataset items. Use Header Auth with Authorization: Bearer YOUR_APIFY_TOKEN stored in credentials. POST the sample JSON above to https://api.apify.com/v2/acts/afkdigital~xml-sitemap-health-freshness-auditor/run-sync-get-dataset-items . Set the HTTP Request timeout above the expected run time. Filter findingType for duplicateUrl or recordType for summary.

**Make** — Schedule an HTTP “Make a request” module. POST to https://api.apify.com/v2/acts/afkdigital~xml-sitemap-health-freshness-auditor/runs with the sample JSON as application/json. Store the bearer token in a credential. Use an Apify run-success webhook to trigger a second scenario. Read the run's defaultDatasetId and GET https://api.apify.com/v2/datasets/DATASET_ID/items?clean=true\&format=json . Iterate the resulting array. Handle failed or timed-out runs separately.

### Pricing

One sitemap-processed unit per distinct successfully parsed file location (inline input deduplicated by content); one url-checked unit per distinct final page URL yielding an HTTP response in optional checks. A restriction or confirmed missing page is a completed HTTP observation. Unchecked pages, transport failures, duplicate references, HEAD fallback and retries incur no extra event. Prices: $0.005 per sitemap and $0.0005 per page check. Ten files with 200 checks would cost $0.15; ten files with checks disabled would cost $0.05. There is no start fee, dataset-row charge or additional platform fee.

### References

- https://www.sitemaps.org/protocol.html
- https://developers.google.com/search/docs/crawling-indexing/sitemaps/build-sitemap
  Discovery tracking is capped at 50,000 distinct sitemap locations across the run. When discoveryCountIsLowerBound is true, discovered and skipped totals are lower bounds.

# Actor input Schema

## `sitemapUrls` (type: `array`):

Absolute public HTTP(S) sitemap URLs.

## `sitemapFiles` (type: `array`):

Objects with content (UTF-8 XML) or base64 (XML or gzip). Remove demo when supplying your own roots.

## `checkUrlStatus` (type: `boolean`):

Test the first sampled unique page URLs using HTTP.

## `asOfDate` (type: `string`):

UTC calendar date YYYY-MM-DD. Defaults to today.

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

Maximum distinct sitemap inputs admitted.

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

Maximum page entries examined, including duplicates.

## `sampleSize` (type: `integer`):

Maximum unique pages to check.

## `timeoutSeconds` (type: `integer`):

Timeout in seconds per HTTP method.

## `concurrency` (type: `integer`):

Maximum parallel page checks.

## Actor input object example

```json
{
  "sitemapFiles": [
    {
      "content": "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"><url><loc>https://example.org/</loc><lastmod>2024-06-01</lastmod></url><url><loc>https://example.org/</loc></url><url><loc>https://example.org/about</loc><lastmod>2099-01-01</lastmod></url></urlset>"
    }
  ],
  "checkUrlStatus": false,
  "maxSitemaps": 10,
  "maxUrls": 1000,
  "sampleSize": 20,
  "timeoutSeconds": 10,
  "concurrency": 4
}
```

# Actor output Schema

## `report` (type: `string`):

No description

## `summary` (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 = {
    "sitemapFiles": [
        {
            "content": "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"><url><loc>https://example.org/</loc><lastmod>2024-06-01</lastmod></url><url><loc>https://example.org/</loc></url><url><loc>https://example.org/about</loc><lastmod>2099-01-01</lastmod></url></urlset>"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("afkdigital/xml-sitemap-health-freshness-auditor").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 = { "sitemapFiles": [{ "content": "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"><url><loc>https://example.org/</loc><lastmod>2024-06-01</lastmod></url><url><loc>https://example.org/</loc></url><url><loc>https://example.org/about</loc><lastmod>2099-01-01</lastmod></url></urlset>" }] }

# Run the Actor and wait for it to finish
run = client.actor("afkdigital/xml-sitemap-health-freshness-auditor").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 '{
  "sitemapFiles": [
    {
      "content": "<urlset xmlns=\\"http://www.sitemaps.org/schemas/sitemap/0.9\\"><url><loc>https://example.org/</loc><lastmod>2024-06-01</lastmod></url><url><loc>https://example.org/</loc></url><url><loc>https://example.org/about</loc><lastmod>2099-01-01</lastmod></url></urlset>"
    }
  ]
}' |
apify call afkdigital/xml-sitemap-health-freshness-auditor --silent --output-dataset

```

## MCP server setup

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

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/gE8gtrayjDP1ldyra/builds/mzo7VRfvwWkuccRCy/openapi.json
