# Broken Link Checker from Sitemap (`sculptural_delphinium/sitemap-broken-link-checker`) Actor

Scans every page in your XML sitemaps and finds broken links and images (404s, 5xx, timeouts). Each unique link is checked once and listed with the pages it appears on.

- **URL**: https://apify.com/sculptural_delphinium/sitemap-broken-link-checker.md
- **Developed by:** [Josep Peruga](https://apify.com/sculptural_delphinium) (community)
- **Categories:** SEO tools, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 page scanneds

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 from Sitemap

Find the broken links and images on your website, using your XML sitemap as the list of pages to check. The Actor reads every page your sitemaps list, collects the links and images on it, checks each unique URL once, and reports the ones that fail: 404s, 410s, server errors, timeouts and dead domains. Each problem is listed with its anchor text and the pages it appears on, so you know exactly what to fix and where.

Use it on sites you own or manage: before a launch, after a redesign or migration, or on a schedule to catch links that rot over time.

### Why from the sitemap

Crawlers that follow links can miss orphan pages and wander into endless filters and calendars. Your sitemap is the list of pages you want indexed, so that is what gets checked, no more and no less. A site with 200 pages costs 200 page events, whatever its URL structure.

### Input

- **Websites or sitemap URLs**: a homepage (sitemaps are discovered from `robots.txt`, then `/sitemap.xml`) or a direct sitemap URL. Sitemap indexes, gzipped sitemaps, text sitemaps and RSS/Atom feeds work.
- **Max pages per site**: caps cost and run time.
- **Check external links** (on by default), **Check images** (on by default), **Also report redirecting links** (off by default).

### Output

One dataset row per unique problem link:

```json
{
  "issue": "broken",
  "status": 404,
  "url": "https://example.com/old-pricing",
  "linkType": "internal",
  "element": "a",
  "anchorText": "See our pricing",
  "foundOnCount": 14,
  "foundOn": ["https://example.com/", "https://example.com/features", "..."],
  "finalUrl": null,
  "redirectHops": 0,
  "error": null,
  "siteUrl": "https://example.com",
  "checkedAt": "2026-10-27T21:00:00.000Z"
}
```

| Issue | Meaning |
|---|---|
| `broken` | 404 Not Found or 410 Gone |
| `http-error` | Another 4xx or a 5xx server error |
| `access-denied` | 401 or 403. For external sites this is often bot protection rather than a dead link, so check these by hand |
| `timeout` / `network-error` | No response, DNS failure, refused connection or TLS error |
| `too-many-redirects` | More than 5 redirects |
| `invalid-url` | The href cannot be parsed as a URL |
| `redirect` | Only with **Also report redirecting links**: the link works but redirects; `finalUrl` shows where to |

`foundOn` lists up to 25 pages; `foundOnCount` is the total number of occurrences. The **OUTPUT** record holds a per-site summary: pages listed and scanned, unique links, links checked, links skipped by robots.txt and counts per issue.

Rate-limited responses (429) are not reported as broken, because they say nothing about the link.

### How it behaves

- It identifies itself as `SitemapLinkChecker/1.0` and obeys robots.txt for that agent (or `*`) on your site and on every external site it checks, including `Crawl-delay` up to 10 s. Disallowed links are skipped and counted, not requested.
- Each unique link is requested once, with `HEAD` first and `GET` only when `HEAD` is refused. At most 2 requests at a time go to any one host.
- Pages are read up to 2 MB of HTML. Links in `<script>`, `<style>`, `<template>` and HTML comments are ignored.
- It collects no personal data. It records URLs, status codes and anchor text.

### Pricing

Pay per event: each scanned page is one `page-scanned` event. Checking all the links found on that page is included, however many there are. Use **Max pages per site** and the run's maximum cost setting to cap spend. The run stops cleanly when the cap is reached.

### Limitations

- Only server-rendered HTML is read. Links added by JavaScript after page load are not seen.
- Only pages listed in your sitemaps are scanned. Use the Sitemap & robots.txt Consistency Auditor by the same publisher to check the sitemap itself.
- Links are checked from Apify's servers. Sites that block datacenter traffic may answer 403 even though the link works for people.

### Support

Open an issue on the Actor's Issues tab. Breakages are fixed within 48 hours.

*This Actor is built and maintained by an AI agent working for its publisher. A human owns the account and is responsible for it.*

# Actor input Schema

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

A homepage (sitemaps are discovered from robots.txt, then /sitemap.xml) or a direct sitemap URL (.xml, .xml.gz, .txt, sitemap index). Every page listed is scanned for links.

## `maxPagesPerSite` (type: `integer`):

Upper limit on pages scanned per site. Each scanned page is one billable event; checking the links on it is included.

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

Also check links that point to other websites. Turn off to check only links within your own site.

## `checkImages` (type: `boolean`):

Also check <img src> URLs, not only <a href> links.

## `reportRedirects` (type: `boolean`):

List links that work but go through one or more redirects, so you can update them to the final URL.

## `maxLinksPerSite` (type: `integer`):

Safety limit on unique links collected per site.

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

Parallel page fetches. Link checks run at most 2 at a time per host, and a robots.txt Crawl-delay forces 1.

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

How long to wait for each HTTP response before recording a timeout.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://crawlee.dev"
    }
  ],
  "maxPagesPerSite": 20,
  "checkExternalLinks": true,
  "checkImages": true,
  "reportRedirects": false,
  "maxLinksPerSite": 5000,
  "maxConcurrency": 5,
  "requestTimeoutSecs": 15
}
```

# Actor output Schema

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

One row per unique problem link: issue, HTTP status, internal or external, anchor text, and the pages it appears on.

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

Pages listed and scanned, unique links found and checked, and counts per issue, stored in the OUTPUT record.

# 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://crawlee.dev"
        }
    ],
    "maxPagesPerSite": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("sculptural_delphinium/sitemap-broken-link-checker").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://crawlee.dev" }],
    "maxPagesPerSite": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("sculptural_delphinium/sitemap-broken-link-checker").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://crawlee.dev"
    }
  ],
  "maxPagesPerSite": 20
}' |
apify call sculptural_delphinium/sitemap-broken-link-checker --silent --output-dataset

```

## MCP server setup

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

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/FQEh6VeqCAZP7VdrU/builds/MWeL2VLXcnDvX8Gb6/openapi.json
