# Broken Link Checker - Site Crawler, 404s & Redirects (`donrulezz/broken-link-checker-crawler`) Actor

Crawl a whole website and check every link (and optionally image) on every page: broken 404/5xx, dead domains, timeouts and redirects, with the pages they appear on. Charged per page, not per link: a 200-page site costs about $0.40.

- **URL**: https://apify.com/donrulezz/broken-link-checker-crawler.md
- **Developed by:** [Ashish Agarwal](https://apify.com/donrulezz) (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 $1.40 / 1,000 page crawleds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 – Site Crawler, 404s & Redirects

Crawl a whole website and check **every link on every page** (and, if you like, every image): broken pages (404, 410), dead domains, server errors, timeouts and redirects, each with **the pages where it appears and its anchor text**. Every site gets a summary you can track over time.

**Charged per page crawled, not per link.** A page with 120 links costs the same as a page with 5, and a link that appears on every page is checked once. A 200-page site costs about **$0.40**.

### What you get

| Status | Meaning |
|---|---|
| `broken` | 404/410 or other client error, or the domain no longer resolves |
| `server-error` | 5xx answer |
| `unreachable` | Timeout, refused connection or protocol error |
| `blocked` | The site blocks automated checks (403/429, LinkedIn's 999) even after a retry as a normal browser. Not counted as broken; open it in a browser to confirm |
| `redirect` | Works, but redirects (update the link to the final URL) |

Each link item has `url`, `statusCode`, `error`, `redirectsTo`, `external`, `kind` (link or image) and `foundOn` (up to 10 pages with the anchor text). The site summary has pages crawled, links checked and the count for each status.

### How it crawls

- Starts at your URL and follows internal links up to the click depth and page limit you set; stays on the same host (`www.` included).
- Respects `robots.txt` by default. External links are checked, never crawled.
- Checks each unique link once, with HEAD and a GET fallback for servers that refuse HEAD, plus one retry as a normal browser when a site looks like a bot wall.
- Skips `mailto:`, `tel:` and `javascript:` links; doesn't crawl into PDFs, images or other files (it still checks them).

### Use cases

- **SEO and site maintenance:** fix 404s that waste crawl budget and frustrate visitors; update redirected links.
- **Before and after a migration or redesign:** crawl the old and new site and compare.
- **Agencies:** run it on every client site monthly and send the summary.
- **Documentation and blogs:** catch links to pages and domains that died years ago.

### Input example

```json
{
  "startUrls": ["https://www.sitemaps.org"],
  "maxPagesPerSite": 200,
  "checkExternalLinks": true,
  "checkImages": false
}
```

### Output example

From a real run on 26 Oct 2026: sitemaps.org's FAQ links to a domain that no longer exists.

```json
{
  "type": "link",
  "site": "https://www.sitemaps.org",
  "url": "http://asg.web.cmu.edu/rfc/rfc3986.php",
  "statusCode": null,
  "status": "broken",
  "error": "domain does not resolve (DNS)",
  "external": true,
  "kind": "link",
  "foundOn": [{"page": "https://www.sitemaps.org/faq.html", "text": "...", "kind": "link"}],
  "foundOnCount": 1
}
```

Site summary from the same run (wordpress.org/news/, first 25 pages): 596 links checked, 1 broken (404), 1 unreachable, 6 blocked by bot walls (Slack, LinkedIn and others; not counted as broken) and 12 redirects.

### Pricing

Pay per event: **$2 per 1,000 pages crawled** (less on higher Apify plans), with all links on those pages checked at no extra cost. Set *Max pages per site* and a maximum spend per run; the actor stops cleanly at either limit.

### Tips

- Large sites: start with *Max pages per site* 200–500 to see the pattern, then raise it.
- Small servers: lower *Pages in parallel* to 1–2.
- Sites that block data-centre traffic: turn on *Proxy*.

### FAQ

**Why is a link "blocked" and not "broken"?** Big sites (LinkedIn, Slack, many shops) refuse automated requests even when the page is fine. The actor retries as a normal browser first; if it is still refused, you see it separately so your broken list stays real.

**Does it run JavaScript?** No. It reads the HTML your server sends, which is what search engines index first. Links injected only by client-side JavaScript are not seen.

**Something wrong?** Open an issue on the actor's Issues tab and it will be fixed.

# Actor input Schema

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

Start pages to crawl, one per line. The crawler stays on the same host (www. included).

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

Stop crawling a site after this many HTML pages. Each page is one charge, with all its links checked.

## `maxDepth` (type: `integer`):

How many clicks away from the start page to follow (0 = only the start page).

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

Also check links to other websites (they are checked, never crawled).

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

Also check <img> sources for broken images.

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

List links that redirect (worth updating to the final URL), not only broken ones.

## `reportAllLinks` (type: `boolean`):

Output OK links too (full link inventory). Off = only problems.

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

Skip pages that robots.txt disallows for crawlers.

## `pageConcurrency` (type: `integer`):

Pages fetched at the same time on the site being crawled. Lower it for small servers.

## `linkConcurrency` (type: `integer`):

Links checked at the same time.

## `proxyConfiguration` (type: `object`):

Optional. Use Apify Proxy for sites that block data-centre traffic.

## Actor input object example

```json
{
  "startUrls": [
    "https://www.sitemaps.org"
  ],
  "maxPagesPerSite": 200,
  "maxDepth": 5,
  "checkExternalLinks": true,
  "checkImages": false,
  "reportRedirects": true,
  "reportAllLinks": false,
  "respectRobotsTxt": true,
  "pageConcurrency": 4,
  "linkConcurrency": 15,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `problems` (type: `string`):

Every problem link with status, error, redirect target and where it appears.

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

Pages crawled, links checked and counts per site.

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

Every item.

# 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": [
        "https://www.sitemaps.org"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("donrulezz/broken-link-checker-crawler").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": ["https://www.sitemaps.org"] }

# Run the Actor and wait for it to finish
run = client.actor("donrulezz/broken-link-checker-crawler").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": [
    "https://www.sitemaps.org"
  ]
}' |
apify call donrulezz/broken-link-checker-crawler --silent --output-dataset

```

## MCP server setup

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

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/cswNrpLBqzaEJVyRg/builds/rRoSFGEMktThIiRZB/openapi.json
