# Broken Link Checker — 404s, Redirects & Dead Link Audit (`scarlet_harrier/broken-link-checker`) Actor

Crawl your website and check every link and image, internal and external. Reports HTTP status, redirect chains and the page each broken link sits on. Respects robots.txt, polite concurrency, no browser. For sites you own or have permission to audit.

- **URL**: https://apify.com/scarlet_harrier/broken-link-checker.md
- **Developed by:** [Upton & Partners](https://apify.com/scarlet_harrier) (community)
- **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 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 — 404s, Redirects & Dead Link Audit

Crawl a website and check every link and image on it, internal and external. Get back one row per link with the HTTP status, final URL after redirects, redirect chain length, error message and the page it was found on — as a table you can export to CSV, JSON or Excel, or pull via API.

**Intended for checking sites you own or have permission to audit.**

### What it does

- **Crawls a site** from your start URLs, staying on the same host (set the page limit, default 500)
- **Checks every link and image** found on those pages, including external links (optional)
- **HEAD first, GET as fallback**, because many servers mishandle HEAD requests
- **Follows redirects** and reports the final URL and the number of hops
- **Polite by design**: respects `robots.txt` (including `Crawl-delay`), limits concurrency, and spaces out requests to each host
- **Clear errors**: DNS failures, timeouts, TLS certificate problems and redirect loops are reported per link, never crash the run
- **No browser, no proxies** — plain HTTP, so it's fast and cheap

### Use cases

- SEO audits: find 404s, redirect chains and dead images before they cost rankings
- Pre-launch and post-migration checks
- Ongoing content QA for blogs, docs sites and knowledge bases
- Finding outdated external references

### Input

| Field | Description |
|---|---|
| `startUrls` | Pages to start from, e.g. `https://example.com`. Only same-host pages are crawled. |
| `maxPages` | Maximum pages to crawl in total. Default 500. |
| `checkExternalLinks` | Also check links and images on other sites. Default on. |
| `maxConcurrency` | Simultaneous requests, 1 to 20. Default 5. |
| `requestDelayMs` | Minimum pause between requests to the same host. Default 100. |
| `onlyReportBroken` | Save only broken links. Default off. |

```json
{ "startUrls": ["https://example.com"], "maxPages": 500, "checkExternalLinks": true, "maxConcurrency": 5 }
```

### Output

One row per unique link or image per source page.

```json
{
  "sourcePage": "https://toml.io/en/v0.3.1",
  "linkUrl": "https://github.com/dbohdan/remarshal",
  "anchorText": "remarshal",
  "linkType": "external",
  "statusCode": 404,
  "finalUrl": "https://github.com/dbohdan/remarshal",
  "redirectCount": 0,
  "error": "HTTP 404",
  "isBroken": true
}
```

`linkType` is `internal`, `external` or `image`. `anchorText` is truncated to 100 characters (an image's `alt` text is used for images). A `SUMMARY` record in the key-value store gives page, link and broken-link totals.

### Pricing

Pay per page crawled. Checking the links on a page is included, however many there are. Pages that fail to load are not charged.

### Notes

- Use it only on sites you own or have permission to audit. It identifies itself honestly as `BrokenLinkChecker`.
- Same-host pages disallowed by `robots.txt` are neither crawled nor requested; their links are reported as skipped, not broken. External links are checked with a single HEAD/GET request each, as a browser would.
- External responses 401, 403, 429 and 999 usually mean the site blocks automated checks, not that the link is dead. They are reported with an explanatory message and `isBroken: false`.
- Links to `mailto:`, `tel:`, `javascript:` and pure `#fragment` links are ignored; fragments are not verified.
- A start URL that redirects to another host (for example to the `www` version) makes that host the crawled site.
- If your site rate-limits or sits on small hosting, lower `maxConcurrency` or raise `requestDelayMs`.
- This Actor was built and is maintained with AI assistance, with human review. Issues are answered within a few days.

# Actor input Schema

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

Pages to start crawling from, e.g. https://example.com. Only pages on the same host are crawled. Use this only on sites you own or have permission to audit.

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

Stop crawling after this many pages in total. Links found on those pages are still all checked.

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

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

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

Maximum simultaneous requests. Keep low for small or shared hosting.

## `requestDelayMs` (type: `integer`):

Minimum pause between two requests to the same host. A Crawl-delay in robots.txt is honoured if it is longer.

## `onlyReportBroken` (type: `boolean`):

Save only broken links to the dataset instead of every checked link. Pages are still charged the same.

## Actor input object example

```json
{
  "startUrls": [
    "https://toml.io/en/"
  ],
  "maxPages": 5,
  "checkExternalLinks": true,
  "maxConcurrency": 5,
  "requestDelayMs": 100,
  "onlyReportBroken": false
}
```

# Actor output Schema

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

No description

# 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://toml.io/en/"
    ],
    "maxPages": 5
};

// Run the Actor and wait for it to finish
const run = await client.actor("scarlet_harrier/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": ["https://toml.io/en/"],
    "maxPages": 5,
}

# Run the Actor and wait for it to finish
run = client.actor("scarlet_harrier/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": [
    "https://toml.io/en/"
  ],
  "maxPages": 5
}' |
apify call scarlet_harrier/broken-link-checker --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scarlet_harrier/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/bEtsFPsukBdg2GxX6/builds/vMFYUNustD7wX8XGD/openapi.json
