# Broken Link Checker — Find 404s & Dead Links (`keyman98/broken-link-checker`) Actor

Crawl a website and check every link it points to — pages, images, scripts, stylesheets, internal and external. Get status code, redirect chain and the page each link was found on.

- **URL**: https://apify.com/keyman98/broken-link-checker.md
- **Developed by:** [KeyMan98](https://apify.com/keyman98) (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 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 — Find 404s & Dead Links on Any Website

Crawl a website and check every link it points to — pages, images, scripts, and stylesheets, internal or external — and get a clean report of what's broken: 404s, server errors, timeouts, DNS failures. Plain HTTP requests only, no browser.

### What it does

Starting from the URL(s) you give it, the Actor crawls the site (following only links on the same host, up to a page limit you set) and collects every link it finds along the way: page links (`<a>`), images, scripts, and stylesheets. Each unique link is then checked once — is it reachable, does it return an error, where does it redirect to — and written to the dataset.

### Input

- **Start URLs** — pages to start crawling from.
- **Max pages to scan** — how many same-site HTML pages to crawl (default 50). This is also what you're charged for.
- **Check external links** — when on (default), links pointing to other websites are checked too, not just the site being crawled.
- **Only output broken links** — when on (default), the dataset only contains broken links. Turn off to get a row for every link checked, working or not.
- **Max concurrency** — how many pages/links are checked in parallel (default 10).

### Output example (JSON)

```json
{
  "url": "https://example.com/old-page.html",
  "sourcePage": "https://example.com/",
  "sourcePagesCount": 1,
  "linkText": "Read more",
  "linkType": "a",
  "isExternal": false,
  "statusCode": 404,
  "finalUrl": "https://example.com/old-page.html",
  "redirectChain": [],
  "isBroken": true,
  "note": null,
  "error": null,
  "checkedAt": "2026-09-24T12:00:00+00:00"
}
```

- `url` — the link that was checked.
- `sourcePage` — first crawled page where this link was found. `null` for a start URL.
- `sourcePagesCount` — number of distinct crawled pages this link was found on.
- `linkText` — visible text of the link (up to 200 characters). Empty for images/scripts/stylesheets.
- `linkType` — `a` (page link), `img`, `script`, or `css` (stylesheet).
- `isExternal` — `true` if the link points to a different host than the site being crawled.
- `statusCode` — HTTP status received, or `null` if the link could not be reached at all.
- `finalUrl` — URL after following redirects, or `null` if unreachable.
- `redirectChain` — URLs visited before reaching `finalUrl`, in order.
- `isBroken` — `true` for an error status (4xx/5xx) or a link that could not be reached at all. A link still returning `429` (rate limited) after retries is **not** counted as broken — see `note`.
- `note` — set to `"rate limited (429)"` when the link is still answering `429` after retries; that is a server asking to slow down, not a dead link, so `isBroken` stays `false`. `null` otherwise.
- `error` — network error (DNS, timeout, SSL, refused URL), or `null` if the link responded.
- `checkedAt` — UTC timestamp of the check.

### Pricing

Pay only for pages actually crawled — checking the links found on them costs nothing extra. Pricing model: **pay-per-event**.

| Event | When it's charged | Price |
| --- | --- | --- |
| `page-scanned` | a same-site HTML page was successfully crawled and scanned for links | 0.001 USD |

Example: a 50-page site costs 0.05 USD to crawl, however many links (broken or not, internal or external) it turns up.

Not charged: a page that could not be reached, a non-HTML page, or any individual link check.

### Limitations

- **Same-host crawl only.** `example.com` and `www.example.com` count as the same host; a link to any other host is only *checked*, never crawled further.
- **JavaScript-rendered links are not seen.** No browser is used; links only added to the page by client-side JavaScript won't be found.
- **`robots.txt` is honored for crawling** (which pages get followed to find more links), not for checking a link that was already found. If `robots.txt` itself cannot be reached, crawling is allowed.
- **Login-gated sites are not supported.** No authentication of any kind.
- **Up to 5,000 unique links** are tracked per run, regardless of `maxPages` — a handful of pages can reference far more assets than that.
- Internal/private/loopback addresses and non-http(s) URLs (e.g. `file://`) are refused before any request is made.

### FAQ

#### Does this use a headless browser?

No — plain HTTP requests only, which keeps runs fast and cheap. Links that only appear after JavaScript runs are not found.

#### Will it check links outside the site I'm crawling?

Yes, by default — every link found, including ones to other websites, is checked (unless "Check external links" is off). Only links on the site being crawled are followed to find more pages.

#### What if a page requires a login?

Not supported. The Actor makes plain, unauthenticated requests.

#### Does it respect `robots.txt`?

Yes, for deciding which pages to crawl. It does not skip checking a link just because `robots.txt` disallows it — the link is still reported.

#### Can I check a fixed list of URLs instead of crawling?

Not today. This Actor only crawls starting from the "Start URLs" you give it, following same-host links to discover pages; there's no input for a fixed URL list or a sitemap.

#### Can I use this through the Apify API or an MCP server?

Yes. Like any Apify Actor, you can run it and read results through the standard Apify API, or through the Apify MCP server if you use Claude, Cursor, or another MCP-enabled client.

### Export

Results can be downloaded from the Apify dataset as JSON, CSV, or Excel, or accessed via the Apify API.

# Actor input Schema

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

Pages to start crawling from. Only pages on the same host are crawled further; every link found (internal or external) is checked.

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

Maximum number of same-site HTML pages to crawl and scan for links (this is also what you are charged for, one event per page).

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

Also check links that point to a different website, not just the site being crawled.

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

When enabled, the dataset only contains links that are broken (error, 4xx/5xx). When disabled, every checked link gets a row, working or not.

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

Maximum number of pages/links checked in parallel.

## Actor input object example

```json
{
  "startUrls": [
    "https://crawler-test.com/"
  ],
  "maxPages": 50,
  "checkExternalLinks": true,
  "onlyBroken": true,
  "maxConcurrency": 10
}
```

# Actor output Schema

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

All checked links in the default dataset (JSON, CSV, Excel).

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

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

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

```

## MCP server setup

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