# Broken Link Checker: Find 404s, Redirects & Dead Links (`eddie-power-dev/broken-link-checker`) Actor

Crawl your website and find every broken internal and external link, with the page it's on, the anchor text, status code, redirect chain and timeouts. Respects robots.txt. Cheap per-page and per-link pricing.

- **URL**: https://apify.com/eddie-power-dev/broken-link-checker.md
- **Developed by:** [Eddie Power](https://apify.com/eddie-power-dev) (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.00 / 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.

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: Find 404s, Redirects & Dead Links

**Find every broken link on your website in minutes.** Give it your home page and it crawls your site, checks every internal and external link, and tells you **which page the broken link is on, the anchor text, the HTTP status, the redirect chain and any timeouts**. Fix 404s before Google and your visitors find them.

Great for:

- 🔍 **SEO audits:** broken links and redirect chains waste crawl budget and leak link equity
- 🛠️ **Web developers and agencies:** check a site after a migration, redesign or CMS update
- 📝 **Content teams and bloggers:** catch dead external references in old posts
- ⏰ **Scheduled monitoring:** run it weekly with Apify Schedules and get alerted

### What it checks

- Crawls pages on your domain (same host, `www.` included; subdomains optional) up to your **max pages** and **max depth**
- Checks every `<a href>` link, and optionally images, scripts, stylesheets and iframes
- External links get a light **HEAD** request, falling back to **GET** when a server refuses HEAD
- Follows up to 10 redirects and records every hop
- **Respects robots.txt** (including Crawl-delay) and `meta robots nofollow` by default
- Polite: per-host delay and a concurrency limit you control

### Input

| Field | Description | Default |
|---|---|---|
| `startUrls` | Your website URL(s), up to 20 | – |
| `maxPages` | Pages to crawl on your site | 100 (max 10,000) |
| `maxDepth` | Clicks from the start page | 3 |
| `maxLinksToCheck` | Extra links checked without crawling (external, beyond limits) | 5,000 |
| `checkExternalLinks` | Check links to other sites | on |
| `checkResources` | Also check images, scripts, CSS, iframes | off |
| `includeSubdomains` | Treat `blog.example.com` etc. as internal | off |
| `respectRobotsTxt` | Obey robots.txt | on |
| `reportMode` | `broken`, `brokenAndRedirects` or `all` | `brokenAndRedirects` |
| `treatBlockedAsBroken` | Count 401/403/429/999 as broken | off |
| `excludeUrlContains` | Skip links containing any of these text fragments | – |
| `maxConcurrency` / `perHostDelayMs` / `requestTimeoutSecs` | Speed and politeness | 5 / 250 ms / 15 s |

```json
{ "startUrls": [{ "url": "https://www.example.com/" }], "maxPages": 200, "maxDepth": 3 }
```

### Example output (one row per link occurrence)

```json
{
  "url": "https://www.example.com/old-pricing",
  "isBroken": true,
  "result": "BROKEN",
  "statusCode": 404,
  "linkType": "internal",
  "sourcePage": "https://www.example.com/blog/2024-update",
  "anchorText": "see our pricing",
  "element": "a",
  "nofollow": false,
  "finalUrl": "https://www.example.com/old-pricing",
  "redirectCount": 0,
  "redirectChain": [],
  "method": "GET",
  "responseTimeMs": 142,
  "error": null,
  "occurrencesOnSite": 3,
  "checkedAt": "2026-10-26T10:47:23.972Z"
}
```

`result` values: `OK`, `BROKEN` (4xx/5xx), `BLOCKED_BY_SITE` (401/403/429/999, often bot protection, not necessarily broken), `TIMEOUT`, `DNS_ERROR`, `CONNECTION_ERROR` (refused, reset, bad TLS certificate), `TOO_MANY_REDIRECTS`, `SKIPPED_ROBOTS`, `UNSAFE_URL` and `ERROR`. A run summary (pages crawled, links checked, broken count) is saved as `SUMMARY` in the key-value store.

### Pricing

Pay per event: a small fee per **page crawled** and per **extra link checked**. See the Pricing tab. Set a maximum cost per run and the crawl stops cleanly when it's reached.

### Limitations

- Pages are fetched as HTML without running JavaScript, so links that only appear after JavaScript runs (some single-page apps) aren't found. Server-rendered sites, WordPress, Shopify, Laravel, Next.js SSR and similar work well.
- Some sites block bots and return 403/429/999 even for working links. These are reported separately as `BLOCKED_BY_SITE`.
- For safety, it only checks public `http(s)` URLs on ports 80, 443, 8080 and 8443. Links to private or internal addresses (`localhost`, `192.168.x.x`, cloud metadata and the like) and links with embedded passwords are reported as `UNSAFE_URL` and never requested.
- Pages over 5 MB are only scanned up to 5 MB.
- External links are checked with one request each and are never crawled.

### Responsible use

Check sites you own or have permission to audit. Keep robots.txt respect on for other people's sites. This Actor is independent and not affiliated with any website it checks.

# Actor input Schema

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

Where to start crawling (usually your home page). The crawler stays on these domains. Up to 20.

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

Maximum number of pages on your site to load and scan for links.

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

How many clicks away from the start URL to crawl. Links found on the deepest pages are still checked.

## `maxLinksToCheck` (type: `integer`):

Cap on links checked without crawling (external links and internal links beyond the page/depth limits).

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

Also check links to other websites (one HEAD request each, falling back to GET).

## `checkResources` (type: `boolean`):

Also check img, script, iframe, source and stylesheet/icon URLs, not just <a> links.

## `includeSubdomains` (type: `boolean`):

Crawl subdomains of the start domains too (www. is always treated as the same site).

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

Skip internal pages disallowed by robots.txt (and honour Crawl-delay up to 10 s). Recommended. Only turn off for your own site.

## `reportMode` (type: `string`):

Only problems, problems plus redirected links, or every link checked.

## `treatBlockedAsBroken` (type: `boolean`):

Many sites (LinkedIn, Cloudflare-protected sites) block bots with 403/429/999. By default these are reported as BLOCKED_BY_SITE, not broken.

## `excludeUrlContains` (type: `array`):

Plain text fragments; any link containing one is skipped (e.g. /logout, ?replytocom=).

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

Requests in flight at once (across all hosts).

## `perHostDelayMs` (type: `integer`):

Politeness delay per host. robots.txt Crawl-delay is used if larger.

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

A link that takes longer than this is reported as TIMEOUT.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.example.com/"
    }
  ],
  "maxPages": 100,
  "maxDepth": 3,
  "maxLinksToCheck": 5000,
  "checkExternalLinks": true,
  "checkResources": false,
  "includeSubdomains": false,
  "respectRobotsTxt": true,
  "reportMode": "brokenAndRedirects",
  "treatBlockedAsBroken": false,
  "maxConcurrency": 5,
  "perHostDelayMs": 250,
  "requestTimeoutSecs": 15
}
```

# Actor output Schema

## `linkReport` (type: `string`):

One row per checked link with status, source page, anchor text and redirect chain.

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

Counts for the run (JSON record SUMMARY in the default key-value store).

# 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://www.example.com/"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("eddie-power-dev/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://www.example.com/" }] }

# Run the Actor and wait for it to finish
run = client.actor("eddie-power-dev/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://www.example.com/"
    }
  ]
}' |
apify call eddie-power-dev/broken-link-checker --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,eddie-power-dev/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/va42cLPJujXeaZ6K8/builds/74i9VBbnbdhybChSh/openapi.json
