# Sitemap Inventory Intel: URL Count, Freshness & Health (`54m_music/sitemap-inventory-intel`) Actor

Analyse any website's XML sitemaps and get one row per site: URL count, top sections, lastmod coverage, freshness bands, publishing velocity, hreflang languages, duplicates and a 0-100 sitemap health score. Public sitemaps, no login, no proxy.

- **URL**: https://apify.com/54m_music/sitemap-inventory-intel.md
- **Developed by:** [Sam](https://apify.com/54m_music) (community)
- **Categories:** SEO tools, Marketing, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $15.00 / 1,000 analysed sites

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 Inventory Intel: URL Count, Freshness & Health

Give this Actor a website and it reads the site's public XML sitemaps and returns **one analysed row**:
how many URLs the site lists, which sections hold them, how much of it has a trustworthy last-modified
date, how fresh or stale the content is, how fast the site publishes, which languages and media it
declares, how many entries are duplicates, and a 0-100 **sitemap health score**. Use it for SEO audits,
competitor content tracking, migration checks, lead research and feeding an AI agent a site profile
instead of 50,000 raw URLs.

### What you get for each site

| Field | What it means |
| --- | --- |
| `site`, `sitemapUrls`, `sitemapCount` | The site and the sitemap files that were read (first 20 listed) |
| `declaredInRobots` | `true` when robots.txt has a `Sitemap:` line. Otherwise the Actor tries `/sitemap.xml`, `/sitemap_index.xml`, `/sitemap.xml.gz` |
| `urlCount` | Distinct URLs listed |
| `duplicateUrls` | Entries beyond the first for a URL already listed (scheme and host letter case are folded together; paths and query strings are compared as written) |
| `offHostUrls` | URLs that point to a different host than the site |
| `topSections`, `sectionCount` | The 10 biggest sections by first path segment, each with `urls` and `pct`, and the number of sections |
| `lastmodCoveragePct` | Share of URLs that have a valid `lastmod` date |
| `freshUnder30d`, `aged30to365d`, `staleOver365d` | URLs with `lastmod` less than 30 days old, 30 to 365 days old, and over 365 days old |
| `staleSharePct` | `staleOver365d` divided by URLs that have a `lastmod`, as a percent |
| `updatedLast30d`, `updatesPerDay30d` | URLs added or updated in the last 30 days (a sitemap shows only the latest `lastmod`, so added and updated cannot be told apart), and that count divided by 30 |
| `newestLastmod`, `oldestLastmod` | The date range of `lastmod` values |
| `lastmodUniform` | `true` when over 90% of dated URLs share one `lastmod` date (ten or more dated URLs). Generators often stamp every URL with the build date, so freshness is not reliable |
| `hasImageSitemap`, `hasVideoSitemap`, `hasNewsSitemap` | Whether any URL carries image, video or Google News extension tags |
| `hreflangLanguages`, `hreflangUrlPct` | Language codes from `xhtml:link hreflang` tags (up to 50) and the share of URLs that have them |
| `truncated` | `true` when a file, URL or depth cap stopped the read. Counts then cover part of the site |
| `sitemapHealth` | 0-100 score, formula below |
| `healthIssues` | Plain-language reasons the score lost points |

#### Sitemap health formula

`sitemapHealth` is the sum of five parts, rounded:

| Part | Points | How |
| --- | --- | --- |
| Discovery | 20 | 20 when robots.txt declares the sitemap, 10 when it was only found at a standard path |
| Lastmod coverage | 25 | `25 x lastmodCoveragePct / 100` |
| Freshness | 25 | `25 x (1 - staleSharePct / 100) x lastmodCoveragePct / 100`; 0 when no URL has a `lastmod` |
| Cleanliness | 20 | `20 x (1 - (duplicateUrls + offHostUrls) / urls listed)`, not below 0 |
| Fetch success | 10 | `10 x sitemap files read / sitemap files tried` |

When `lastmodUniform` is true, the coverage and freshness points are halved. Hreflang and media
sitemaps are reported but do not change the score: not every site needs them.

### Input

| Field | Default | Notes |
| --- | --- | --- |
| `siteUrls` | one demo site | Websites, or direct sitemap URLs ending `.xml` or `.xml.gz` |
| `maxSitemapsPerSite` | 30 | Sitemap files read per site, index files included. Each costs one request, about 0.6 s |
| `maxUrlsPerSite` | 50,000 | URL cap per site (up to 500,000) |
| `includeUrls` | false | Also write one row per URL to a separate named dataset `urls` |
| `maxUrlRowsPerSite` | 1,000 | Cap on URL rows per site |

```json
{ "siteUrls": ["https://www.sitemaps.org"], "maxSitemapsPerSite": 10 }
```

### Output example

```json
{
  "site": "www.sitemaps.org",
  "sitemapCount": 1,
  "sitemapUrls": [
    "https://www.sitemaps.org/sitemap.xml"
  ],
  "declaredInRobots": true,
  "urlCount": 84,
  "duplicateUrls": 0,
  "offHostUrls": 0,
  "topSections": [
    {
      "section": "/da",
      "urls": 4,
      "pct": 4.8
    },
    {
      "section": "/de",
      "urls": 4,
      "pct": 4.8
    },
    {
      "section": "/en_GB",
      "urls": 4,
      "pct": 4.8
    }
  ],
  "sectionCount": 24,
  "lastmodCoveragePct": 100.0,
  "lastmodUniform": false,
  "freshUnder30d": 0,
  "aged30to365d": 0,
  "staleOver365d": 84,
  "staleSharePct": 100.0,
  "updatedLast30d": 0,
  "updatesPerDay30d": 0.0,
  "newestLastmod": "2022-12-15",
  "oldestLastmod": "2016-11-21",
  "hasImageSitemap": false,
  "hasVideoSitemap": false,
  "hasNewsSitemap": false,
  "hreflangLanguages": [],
  "hreflangUrlPct": 0.0,
  "truncated": false,
  "sitemapHealth": 75,
  "healthIssues": [
    "100.0% of dated URLs were last modified over a year ago"
  ]
}
```

### Per-URL rows (optional)

With `includeUrls` on, each URL also becomes a row in the named dataset **`urls`**: `site`, `url`,
`section`, `lastmod`, `ageDays`, `freshness` (`under_30d`, `30_to_365d`, `over_365d` or `null`),
`hasImage`, `hasVideo`, `isNews`, `hreflangLanguages`. Find it in Storage > Datasets on the run. These
rows are not charged; only the site rows in the default dataset are.

### Pricing

Pay per event: you pay for each analysed site written to the default dataset, plus the standard Apify
start event. See the Pricing tab. No proxy or browser is used. A site with ten sitemap files takes about
ten seconds. A run that analyses no site fails, so you do not pay for an empty run.

### How it works and limits

- Sitemaps are found from `Sitemap:` lines in robots.txt, then standard paths. Sitemap index files are
  followed up to 3 levels deep; gzip files are supported. Only files on the site's own host are read.
- The Actor checks robots.txt before every fetch, waits at least 0.6 s between requests, and stops on
  repeated HTTP 429 or 403. It never uses a proxy or evades blocks.
- Sitemap files are read as XML with entity declarations refused, and size is capped at 60 MB per file
  after decompression. Private, local and non-public addresses are refused.
- A sitemap lists what the site owner chose to list. It is not a crawl: pages missing from the sitemap
  are not counted, and `lastmod` is only as honest as the generator behind it.
- A site that cannot be read (no sitemap, blocked, unreachable) is skipped with the reason in the run
  status message and in the `SKIPPED` record. The run only fails when no site could be analysed.

### FAQ

**Why is my health score low when the site is fine?** The score rewards a sitemap that is declared,
dated, fresh and clean. A site with no `lastmod` dates loses up to 50 points however good its content is.
`healthIssues` lists the reasons.

**Can I track a competitor's publishing speed?** Yes. Schedule the Actor weekly and read
`updatedLast30d`, `urlCount` and `topSections`.

**Why does `urlCount` differ from the pages Google indexed?** Sitemaps list submitted URLs, not indexed
ones.

# Actor input Schema

## `siteUrls` (type: `array`):

Websites to analyse, one per line, for example https://www.example.com. A direct sitemap URL (ending .xml or .xml.gz) also works. Sitemaps are discovered from robots.txt, then /sitemap.xml.

## `maxSitemapsPerSite` (type: `integer`):

Stop reading after this many sitemap files (index files count). Each file costs one polite request, about 0.6 seconds.

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

Stop counting after this many URLs. The row is marked truncated when a cap is hit.

## `includeUrls` (type: `boolean`):

Writes URL rows (section, lastmod, age, freshness band, media flags, languages) to a separate named dataset called 'urls'. Site rows are the priced result; URL rows are not charged.

## `maxUrlRowsPerSite` (type: `integer`):

Cap on URL rows per site when 'Also save one row per URL' is on.

## Actor input object example

```json
{
  "siteUrls": [
    "https://www.sitemaps.org"
  ],
  "maxSitemapsPerSite": 10,
  "maxUrlsPerSite": 50000,
  "includeUrls": false,
  "maxUrlRowsPerSite": 1000
}
```

# Actor output Schema

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

One sitemap health row per site in the default dataset, overview table view.

## `allFields` (type: `string`):

Every site row with all fields.

# 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 = {
    "siteUrls": [
        "https://www.sitemaps.org"
    ],
    "maxSitemapsPerSite": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("54m_music/sitemap-inventory-intel").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 = {
    "siteUrls": ["https://www.sitemaps.org"],
    "maxSitemapsPerSite": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("54m_music/sitemap-inventory-intel").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 '{
  "siteUrls": [
    "https://www.sitemaps.org"
  ],
  "maxSitemapsPerSite": 10
}' |
apify call 54m_music/sitemap-inventory-intel --silent --output-dataset

```

## MCP server setup

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

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/AsTDhQWRRqe1vmUUK/builds/Ismi3W6CcZXb6QVLO/openapi.json
