# Broken Link Checker: Find 404s & Dead Links on a Website (`lx112/broken-link-checker`) Actor

Crawl a website and find its broken links: every internal and external link, image and script that answers 404, 410, 5xx, times out or fails DNS, with the page it's on, its anchor text and the redirect chain. Set how many pages to crawl; get one row per broken link plus a per-site summary.

- **URL**: https://apify.com/lx112/broken-link-checker.md
- **Developed by:** [Jing Peng Xing](https://apify.com/lx112) (community)
- **Categories:** SEO tools, Developer tools, Marketing
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.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 & Dead Links on a Website

Crawl a website and get a list of its **broken links**: every link, image, script, stylesheet and iframe that answers
**404, 410 or 5xx, times out, fails DNS or has a bad certificate**, with the **page it sits on** and its **anchor text**,
so you can fix it. Internal and external links are both checked.

Plain HTTP requests, no browser: a 50-page site with a few hundred links takes well under a minute.

### What you get

One row per broken link (the same broken URL on 30 pages is one row, with the pages listed):

```json
{
  "site": "https://the-internet.herokuapp.com/",
  "url": "https://the-internet.herokuapp.com/about/",
  "broken": true, "result": "broken", "status": 404, "reason": "404 Not Found",
  "type": "link", "internal": true, "anchorText": "About",
  "foundOn": "https://the-internet.herokuapp.com/disappearing_elements",
  "foundOnPages": ["https://the-internet.herokuapp.com/disappearing_elements"],
  "occurrences": 1, "redirectedTo": null, "redirects": 0,
  "checkedAt": "2026-11-12T00:44:51.889Z"
}
```

| Field | Meaning |
|---|---|
| `result` | `broken`, `ok`, or `blocked` (the server refused an automated check: 401, 403, 429) |
| `reason` | `404 Not Found`, `Timed out`, `DNS lookup failed`, `SSL certificate error`, `Too many redirects`, ... |
| `type` | `link`, `image`, `script`, `stylesheet`, `iframe` or `media` |
| `foundOn`, `foundOnPages`, `occurrences` | Where the link is (up to 20 pages listed) and how often it appears |
| `redirectedTo`, `redirects` | Where a redirecting link ends up, and in how many hops |

The run's **SUMMARY** record has, per site: pages crawled, links checked, broken links by reason, and whether the page
limit cut the crawl short.

Turn off **Only broken links in the results** to get every link with its status: useful for auditing redirects.

### Good for

- **SEO maintenance**: broken links waste crawl budget and lose link equity. Schedule a weekly run.
- **After a migration or redesign**: find every internal link that now leads nowhere.
- **Content upkeep**: catch external references that have died.
- **Agency audits**: one run per client site, export to CSV.

### How it judges a link

- Each link gets a HEAD request first; if the server mishandles HEAD, a GET follows before the link is judged.
  Timeouts get one more try.
- **401, 403 and 429 are not counted as broken.** Sites such as LinkedIn or Cloudflare-protected pages refuse automated
  requests although the page exists. They're reported as `blocked` (visible when "Only broken" is off).
- Redirects are followed (up to 8 hops) and the final answer decides.

### Limits

- Links added by JavaScript after the page loads aren't seen: the actor reads the HTML the server sends.
- The crawl stays on the start address's host (`www.` and the bare domain count as the same site).
- Pages behind a login aren't crawled.

### Pricing

Pay per page: **$0.002 per page crawled**, however many links are on it ($1 per 500 pages). Checking the links is
included.

# Actor input Schema

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

The websites to check. Crawling starts at each address and stays on that site; links leaving the site are checked but not followed.

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

How many pages of each site to crawl. Every link found on those pages is checked.

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

Also check links that point to other websites.

## `checkAssets` (type: `boolean`):

Also check images, scripts, stylesheets, iframes and media files, not only links.

## `onlyBroken` (type: `boolean`):

Return only broken links. Turn off to get every link with its status, including redirects and links that refused an automated check.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://the-internet.herokuapp.com"
    }
  ],
  "maxPagesPerSite": 50,
  "checkExternalLinks": true,
  "checkAssets": true,
  "onlyBroken": true
}
```

# Actor output Schema

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

One item per broken link (or every link, if chosen): URL, status, reason, the page it was found on, anchor text, link type, redirect target.

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

Per site: pages crawled, links checked, broken links by reason.

# 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://the-internet.herokuapp.com"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("lx112/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://the-internet.herokuapp.com" }] }

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

```

## MCP server setup

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