# Broken Link Checker: Find 404s and Dead Links (`itayozer9/broken-link-checker`) Actor

Crawl a website or check a list of pages and find every broken link: 404s, server errors, dead domains, redirect loops and redirect chains, with the page each link is on and its anchor text. Plain HTTP, obeys robots.txt. You pay only for links that get a clear answer.

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

## Pricing

from $0.50 / 1,000 link checkeds

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 and Dead Links

Give it your homepage (or a list of pages) and it crawls your site, checks every link it finds, and tells you which ones are broken: **404 and 410 pages, server errors, domains that no longer exist, redirect loops and redirect chains**. For every link you get the HTTP status, a plain-language reason, the page it sits on and its anchor text, so you know exactly what to fix and where.

It works over plain HTTP like a search engine crawler: no headless browser, no proxy. That keeps it cheap: **$0.50 per 1,000 links checked**, half the price of the most used broken link checker in the Store. Links it cannot verify (bot walls, timeouts, robots.txt) are free.

It obeys `robots.txt` (RFC 9309) for every site it touches, honors `Crawl-delay`, slows down when a site answers 429 or 503, and never reads pages behind a login.

### Who it is for

- **Site owners and SEO teams:** find broken internal links before Google does, after a redesign or a migration.
- **Agencies:** a link audit for a client site in one run, exported to CSV or Excel.
- **Developers and AI agents:** call it from the API or an MCP client after a deploy and fail the build on `isBroken`.

### What you get

One result per unique link, **problems first** (broken, then blocked, unreachable, redirected, skipped, ok):

- `url`: the link, made absolute (the `#fragment` is dropped)
- `result`:
  - `broken`: 404, 410, any other 4xx, 5xx, a domain that does not exist, a redirect loop, a redirect with no target, or a link that is not a valid URL
  - `blocked`: 401, 403, 429 or 999. Usually a login or bot protection (big news sites, LinkedIn), not a dead page, so it is listed separately and not charged. Open these in a browser to be sure
  - `unreachable`: no answer within 15 seconds, or the connection failed (free)
  - `redirected`: works, but only after one or more redirects. Link straight to `finalUrl`
  - `skipped`: the target's robots.txt disallows robots, or it is a private address (free)
  - `ok`: answered 2xx directly
- `isBroken` (true or false), `statusCode`, `error` (why, in plain words)
- `finalUrl`, `redirectCount` and `redirectChain` (every hop with its status code)
- `firstFoundOn` and `anchorText`: the first page that links to it and the link text there (or the image alt text, `aria-label` or `title` for image links)
- `foundOn` (up to 10 pages with their anchor text) and `foundOnCount` (all pages read in the run that link to it)
- `isInternal` (same site; `www.` and the bare domain count as one), `isStartUrl`, `contentType`, `responseMs`, `checkedAt`

The run's status message sums it up, for example: `8 links on 2 pages: 3 broken, 2 redirected, 3 ok. Billed: 9 links checked.` (the 8 links plus the start page). When some links cannot be verified it adds, for example, `32 not verified (blocked, unreachable or robots.txt)`.

### Input

| Field | Required | Default | Notes |
|---|---|---|---|
| `startUrls` | yes | | Pages to start from, up to 1,000. Each one and every link on it is checked. An address typed without `https://` is read as https |
| `maxCrawlPages` | no | `100` | How many more pages of the same site to open and read for links (0 to 10,000). 0 checks only the links on the pages you list |
| `checkExternalLinks` | no | `true` | Also check links to other websites (one request each, never crawled) |

Check a whole site, up to 500 pages:

```json
{
    "startUrls": ["https://www.example.com/"],
    "maxCrawlPages": 499
}
```

Check only the links on a few pages, internal links only:

```json
{
    "startUrls": ["https://www.example.com/pricing", "https://www.example.com/blog/"],
    "maxCrawlPages": 0,
    "checkExternalLinks": false
}
```

How the crawl works: it reads the start pages, then follows links to other HTML pages of the same site until it has read `maxCrawlPages` more pages per site. Every link on every page it reads is checked once, however many pages share it. Links beyond the crawl limit are still checked, just not opened for more links. Files (PDFs, images, archives) are checked with a light HEAD request, with a GET fallback for servers that answer HEAD wrongly.

### Output example

A real result from the `the-internet.herokuapp.com/status_codes` test page:

```json
{
    "url": "https://the-internet.herokuapp.com/status_codes/404",
    "result": "broken",
    "isBroken": true,
    "statusCode": 404,
    "error": "The page answered HTTP 404 (not found).",
    "finalUrl": "https://the-internet.herokuapp.com/status_codes/404",
    "redirectCount": 0,
    "redirectChain": [],
    "isInternal": true,
    "isStartUrl": false,
    "foundOnCount": 1,
    "firstFoundOn": "https://the-internet.herokuapp.com/status_codes",
    "anchorText": "404",
    "foundOn": [{ "pageUrl": "https://the-internet.herokuapp.com/status_codes", "anchorText": "404" }],
    "contentType": "text/html",
    "responseMs": 17,
    "checkedAt": "2026-10-31T18:50:46.817Z"
}
```

And a working link that goes through a redirect:

```json
{
    "url": "http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml",
    "result": "redirected",
    "statusCode": 200,
    "error": "Redirects once; link straight to http://www.iana.org/assignments/http-status-codes.",
    "finalUrl": "http://www.iana.org/assignments/http-status-codes",
    "redirectCount": 1,
    "redirectChain": [{ "url": "http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml", "statusCode": 302 }],
    "isInternal": false,
    "anchorText": "here"
}
```

### Pricing

Pay per event, no subscription:

| Event | Price | When |
|---|---|---|
| Link checked | $0.0005 | Each unique link that gets a clear answer: ok, redirected or broken |
| Actor start | $0.00005 | Once per run (Apify's standard start event) |

Free, never charged:

- Start pages that cannot be read (dead, blocked, disallowed by robots.txt or not a valid URL); a start page that loads counts as one checked link
- Links that come back `blocked`, `unreachable` or `skipped`, and links that are not valid URLs
- The same link found on many pages (checked and charged once per run)

Example: a homepage plus pages that link to 2,400 unique URLs, of which 40 are blocked or time out, costs (1 + 2,360) x $0.0005 + $0.00005 = **$1.18055**.

Set a maximum charge on the run and the checker stops when it is reached: it never checks a link it cannot bill within your limit, and the status message says how many found links were left unchecked.

### Limits

- No JavaScript rendering: links that only appear after scripts run are not seen. Most sites put their links in the HTML.
- Hyperlinks only (`<a href>` and `<area href>`). Images, scripts and stylesheets are not checked, and `#fragment` targets are not verified.
- A site counts as one host name without `www.`: `blog.example.com` is another site, so its pages are checked as links but not crawled.
- About 3 requests at a time per host (1 at a time with a `Crawl-delay`, which is honored up to 10 seconds). A crawl of a large docs site checked 3,136 links on 86 pages in 6 minutes in our tests.
- At most 100,000 unique links per run. Near the run's timeout it stops checking and saves what it has; give large sites a longer timeout.
- A server that answers 200 for a missing page (a "soft 404") looks fine to any HTTP checker, this one included.

### FAQ

**Why is a link "blocked" and not "broken"?** Many big sites answer 403 or 429 to any robot while the page works fine in a browser. Calling those broken would bury your real problems under false alarms, so they get their own result and cost nothing.

**Does it check links on other sites?** Yes, with `checkExternalLinks` on (the default). Each external link gets one request; external sites are never crawled.

**Why was a link skipped?** The target site's robots.txt disallows robots on that path (for example x.com and twitter.com disallow everything). The checker respects that and does not charge for it.

**Can I check a list of pages without crawling?** Put them in `startUrls` and set `maxCrawlPages` to 0. Each listed page and every link on it is checked once.

**How do I find the page to fix?** `firstFoundOn` and `anchorText` show where the link sits; `foundOn` lists up to 10 pages and `foundOnCount` how many pages carry it.

# Actor input Schema

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

One full address per line (https://...). Every link on these pages is checked, and the crawl starts here. Up to 1,000 per run. Each page counts as one checked link; a start page that cannot be read is free.

## `maxCrawlPages` (type: `integer`):

How many more pages of the same site to open and read for links, found by following links from the start pages (robots.txt is respected). 0 checks only the links on the pages you list. Links on every page read are checked, so a bigger crawl finds more links. Up to 10,000.

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

On: links to other websites are checked too (one request each, never crawled). Off: only links within the same site.

## Actor input object example

```json
{
  "startUrls": [
    "https://www.example.com/"
  ],
  "maxCrawlPages": 10,
  "checkExternalLinks": true
}
```

# Actor output Schema

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

One item per unique link, problems first: result (broken, blocked, unreachable, redirected, skipped, ok), HTTP status, error, redirect chain, the pages it was found on and its anchor text.

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

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

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

```

## MCP server setup

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