# Broken Link Checker and Sitemap SEO Auditor (`clearcheck/link-sitemap-audit`) Actor

Broken link checker and sitemap auditor for your own site: broken links, redirect chains, orphan pages, duplicate titles and a technical SEO score.

- **URL**: https://apify.com/clearcheck/link-sitemap-audit.md
- **Developed by:** [ClearCheck Tools](https://apify.com/clearcheck) (community)
- **Categories:** SEO tools, 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 $4.00 / 1,000 page analyseds

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

## Broken Link Checker and Sitemap SEO Auditor

Audit **one website you own** in a single run: broken links, redirect chains, sitemap errors, orphan pages, duplicate or missing titles and meta descriptions, canonical problems, images without alt text and slow pages. You get a **technical SEO score (0-100)** and a **prioritised fix list**, plus one clean dataset per problem type you can hand to a developer or import into a spreadsheet.

It is polite by design: it reads `robots.txt`, waits between requests, identifies itself with a clear user-agent and never tries to get around protections.

### What you get

| Dataset | What it contains |
|---|---|
| **Pages analysed** (default dataset) | One row per page: status, response time, title, description, H1, canonical, noindex, link and image counts, in sitemap or not |
| `lsa-broken-links` | Broken internal and external links: HTTP status, **source page**, **anchor text** |
| `lsa-redirects` | Redirect chains (2+ hops), redirects to HTTP, loops, redirects to error pages, internal links that redirect |
| `lsa-sitemap-issues` | Sitemap URLs returning 404/5xx, redirected, noindex or canonicalised elsewhere; indexable pages missing from the sitemap |
| `lsa-orphan-pages` | URLs in the sitemap that no crawled page links to |
| `lsa-duplicates` | Groups of pages sharing a title or meta description |
| `lsa-seo-tags` | Missing or too long/short title, meta description, missing or multiple H1 |
| `lsa-canonical-issues` | Missing, conflicting, cross-protocol or broken canonical tags |
| `lsa-images-alt` | Pages with images lacking an `alt` attribute (examples included) |
| `lsa-slow-pages` | Pages slower than your threshold |
| **Summary** (key-value store, `OUTPUT`) | Score, grade, prioritised fixes (P1/P2/P3), totals, coverage notes |

Sitemaps are discovered automatically (robots.txt `Sitemap:` lines, then `/sitemap.xml`), sitemap indexes and `.xml.gz` files are followed.

#### Sample summary

```json
{
  "technicalSeoScore": 63,
  "grade": "D",
  "priorities": [
    { "priority": "P1", "issue": "broken-internal-links", "affected": 2, "pointsLost": 10,
      "recommendation": "Fix or remove internal links pointing to 404/5xx URLs, or add a 301 to the right page." },
    { "priority": "P1", "issue": "sitemap-errors", "affected": 2, "pointsLost": 6,
      "recommendation": "Remove 404/5xx/redirected URLs from the sitemap; list only final, indexable 200 URLs." }
  ],
  "totals": { "pagesAnalyzed": 10, "brokenInternalLinks": 2, "brokenExternalLinks": 1, "orphanPages": 2 }
}
```

#### Sample broken-link row

```json
{
  "brokenUrl": "https://example.com/missing",
  "type": "internal",
  "statusCode": 404,
  "problem": "not-found",
  "sourcePage": "https://example.com/",
  "linkText": "Missing page",
  "severity": "high"
}
```

### How to use

1. Enter the **Site URL** (home page) and tick the ownership confirmation.
2. Set **Max pages to analyse**. It is also your cost cap: price per page x this number.
3. Run. Open the **Output** tab: summary first, then each problem dataset.
4. Export any dataset as JSON, CSV or Excel, or read it through the API.

#### Input

Example:

```json
{
    "url": "https://example.com/",
    "confirmOwnership": true,
    "maxPages": 100,
    "checkExternalLinks": true
}
```

| Field | Default | Notes |
|---|---|---|
| `url` | | Start URL, required |
| `confirmOwnership` | | Required, must be true |
| `maxPages` | 100 | Pages analysed (billed) |
| `sitemapUrl` | auto | Optional override |
| `delaySecs` | 0.5 | Minimum delay between requests to the same host |
| `maxConcurrency` | 3 | Parallel requests |
| `checkExternalLinks` | true | Outbound links checked with HEAD, GET fallback |
| `maxLinkChecks` | 500 | Extra URLs checked beyond the crawl (not billed) |
| `maxSitemapChecks` | 300 | Sitemap URLs checked that were not crawled |
| `slowThresholdMs` | 1500 | Slow page threshold |
| `titleMaxLength` / `descriptionMaxLength` | 60 / 160 | Length limits |
| `datasetPrefix` | lsa | Prefix of the issue datasets |

### Use cases

- **Monthly SEO health check**: schedule the Actor on your own site and send the broken-link dataset to your developer or your spreadsheet.
- **Agencies**: audit a client site you are authorised to check before a redesign or migration, and hand over the prioritised P1/P2/P3 fix list.
- **After a migration**: find redirect chains, redirects to HTTP and sitemap URLs that now return 404.
- **Content teams**: find duplicate titles, missing meta descriptions, missing H1 and images without alt text.
- **Sitemap clean-up**: list orphan pages and indexable pages that are missing from the sitemap.

### Pricing

Pay per event. A 100-page audit costs 100 times the page price; **Max pages** is your cost cap.

| Event | Price | When it is charged |
|---|---|---|
| Page analysed | $0.004 per page ($4 per 1,000) | Once per page that returned HTML and was audited |
| Actor start | $0.00005 per run | Platform default start fee |

Failed URLs, redirects, external link checks and sitemap checks are free. Examples: 100 pages = $0.40, 500 pages = $2.00, 2,000 pages = $8.00.

### Good citizen behaviour

- Identifies as `LinkSitemapAuditBot/1.0` and links the Actor in its user-agent.
- Obeys `robots.txt` (Disallow and Crawl-delay) for the audited site and for external hosts it checks. If robots.txt disallows your start URL, the run stops with an explanation.
- Spaces requests per host. No proxies, no browser fingerprint tricks, no CAPTCHA solving.
- External sites answering 401/403/429/999 are listed as **unverifiable**, not broken.

### Good to know

- **Orphan detection** needs a complete crawl: if the page limit stops the crawl, the dataset stays empty and the summary says so (raise `maxPages`).
- Pages are analysed from the server-rendered HTML (no JavaScript rendering). Links added only by JavaScript are not seen.
- **Slow page** = time to download the page including redirects, measured from the Apify datacenter.
- Issue datasets are **named datasets** and are overwritten at the next run with the same prefix. Use a different `datasetPrefix` for concurrent runs on different sites.
- Fragments (`#...`) are ignored; trailing slash and `www.` differences are treated as the same URL when comparing against the sitemap.

### How the score is computed

Start from 100 and remove points per category, capped: broken internal links (5 each, max 25), sitemap errors (3 each, max 12), broken external links (1.5 each, max 8), redirect problems (2 each, max 8), then proportional penalties by share of affected pages: missing title/H1 (12), canonical (8), duplicates (6), meta description (5), slow pages (5), orphans (4), images without alt (4), title length (3). Grades: A 90+, B 80+, C 65+, D 50+, F below.

### Legal

Use it on sites you own or are authorised to audit. You are responsible for compliance with the audited site's terms.

### Support

Found a false positive or want a new check? Open an issue from the Actor page.

### FAQ

**Can I audit a competitor or any site?** No. The Actor is meant for a site you own or are authorised to audit, and you must tick the ownership confirmation. It also respects robots.txt and waits between requests.

**Does it render JavaScript?** No. Pages are analysed from the server-rendered HTML, so links added only by JavaScript are not seen.

**Why is the orphan pages dataset empty?** Orphan detection needs a complete crawl. If Max pages stops the crawl early, the summary says so; raise Max pages and run again.

**Are external links that answer 403 or 429 reported as broken?** No. They are listed as unverifiable, not broken.

### More Actors by clearcheck

- [Email Validator](https://apify.com/clearcheck/email-validator)
- [Domain Health Checker](https://apify.com/clearcheck/domain-health-checker)
- [PDF, DOCX and HTML to Markdown Converter](https://apify.com/clearcheck/document-to-markdown-converter)
- [Website Contact Finder](https://apify.com/clearcheck/website-contact-finder)
- [Bulk Phone Number Validator](https://apify.com/clearcheck/phone-validator)
- [Bulk Image Optimizer](https://apify.com/clearcheck/image-optimizer)
- [OCR Text Extractor](https://apify.com/clearcheck/ocr-text-extractor)
- [Dataset Merger and Deduplicator](https://apify.com/clearcheck/dataset-merge-dedupe)
- [Excel and CSV to JSON Converter](https://apify.com/clearcheck/spreadsheet-to-json)

# Changelog

This Actor's version history is a separate document: https://apify.com/clearcheck/link-sitemap-audit/changelog.md

# Actor input Schema

## `url` (type: `string`):

Start URL of the site to audit (usually the home page, e.g. https://www.example.com/). Only pages of this site are crawled.

## `confirmOwnership` (type: `boolean`):

Required. This tool is meant for auditing your own website (or a client site you are authorised to audit).

## `maxPages` (type: `integer`):

Upper limit of pages analysed. You are billed per analysed page, so this is also your cost cap (price per page x this number).

## `sitemapUrl` (type: `string`):

Leave empty to auto-detect: robots.txt Sitemap lines, then /sitemap.xml. Sitemap index files and .xml.gz are followed automatically.

## `delaySecs` (type: `number`):

Minimum delay between two requests to the same host. robots.txt Crawl-delay is honoured if larger.

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

Parallel page requests. Requests to one host are still spaced by the delay above.

## `checkExternalLinks` (type: `boolean`):

Check outbound links (HEAD, then GET if HEAD is refused). External hosts' robots.txt is respected. Sites that block bots (401/403/429) are listed as unverifiable, not broken.

## `maxLinkChecks` (type: `integer`):

Maximum number of additional URLs checked (external links and internal links beyond the page limit). Not billed, but bounds run time.

## `maxSitemapChecks` (type: `integer`):

Maximum number of sitemap URLs that were not crawled and get a status check.

## `slowThresholdMs` (type: `integer`):

Pages whose response time (including redirects) exceeds this value are reported as slow.

## `titleMaxLength` (type: `integer`):

Titles longer than this are reported.

## `descriptionMaxLength` (type: `integer`):

Meta descriptions longer than this are reported.

## `datasetPrefix` (type: `string`):

Issue datasets are named <prefix>-broken-links, <prefix>-redirects, etc. They are rewritten at each run. Use a different prefix per site if you run several audits at the same time.

## Actor input object example

```json
{
  "url": "https://example.com/",
  "confirmOwnership": true,
  "maxPages": 100,
  "delaySecs": 0.5,
  "maxConcurrency": 3,
  "checkExternalLinks": true,
  "maxLinkChecks": 500,
  "maxSitemapChecks": 300,
  "slowThresholdMs": 1500,
  "titleMaxLength": 60,
  "descriptionMaxLength": 160,
  "datasetPrefix": "lsa"
}
```

# Actor output Schema

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

JSON summary with technical SEO score, grade, prioritised fixes and totals.

## `pages` (type: `string`):

One row per analysed page.

# 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 = {
    "url": "https://example.com/",
    "confirmOwnership": true,
    "maxPages": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("clearcheck/link-sitemap-audit").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 = {
    "url": "https://example.com/",
    "confirmOwnership": True,
    "maxPages": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("clearcheck/link-sitemap-audit").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 '{
  "url": "https://example.com/",
  "confirmOwnership": true,
  "maxPages": 100
}' |
apify call clearcheck/link-sitemap-audit --silent --output-dataset

```

## MCP server setup

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

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/2kGrlehEdNGpjLR4C/builds/TgJvst4TzllyfqYzy/openapi.json
