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

Crawl a website and test every link on every page: internal, external, images, scripts, CSS, iframes. Each broken link with the page it is on, anchor text, status code and redirect chain. Bot-blocking sites are flagged as restricted, not broken.

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

## Pricing

from $1.40 / 1,000 page checkeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 & Redirects on a Site

Crawl a website and **test every link on every page**: internal links, external links, images, scripts, stylesheets, iframes and video/audio sources. You get **one row per problem**: the page where the link is, the broken URL, its **anchor text**, the HTML element, the **status code or error** (404, 500, timeout, DNS failure, redirect loop) and the **redirect chain**.

What makes it different:

- **No false alarms from bot-blocking sites.** LinkedIn, Instagram and many others answer robots with 999, 403 or 429. Those links are reported as `restricted`, not `broken`, so your list of real 404s stays clean.
- **Priced per page, not per link.** A typical page has 50-150 links; you pay once per page checked, with every link on it tested.
- **Each unique link is tested once**, even if it appears on every page (menus, footers), and never more than 2 requests at a time go to the same external site.
- Streams results as it crawls: if the run stops early, everything found so far is already saved.

**Who uses it:** SEO agencies and site owners fixing 404s, content teams cleaning old blog posts, developers checking a site before launch or after a migration, link-building outreach (find dead links on other sites).

### Input

Check up to 500 pages, internal and external links:

```json
{
  "startUrls": ["https://example.com"],
  "maxPagesPerSite": 500
}
```

Only internal links of the blog, also listing redirects to update:

```json
{
  "startUrls": ["https://example.com/blog/"],
  "includeUrlPatterns": ["/blog/"],
  "checkExternalLinks": false,
  "reportRedirects": true
}
```

### Output

One item per problem occurrence (page + link):

| Field | Description |
|---|---|
| `type` | `broken`, `restricted` (401/403/429/999) or `redirect` |
| `foundOn` | page where the link appears |
| `url` | the link |
| `linkText` | anchor text (or image alt) |
| `element` | `a`, `img`, `script`, `link`, `iframe`, `source` |
| `linkScope` | `internal` or `external` |
| `statusCode`, `error` | HTTP status, or the error (timeout, DNS failed, redirect loop) |
| `finalUrl`, `redirectChain` | where a redirecting link ends up |
| `nofollow` | the link has rel="nofollow" |

A free summary per site (`type: "site-summary"`): pages checked, unique links checked, broken, redirecting and restricted counts.

### Example output

One real item from a test run (long texts and lists shortened):

```json
{
  "type": "broken",
  "site": "https://www.scrapethissite.com/",
  "foundOn": "https://www.scrapethissite.com/pages/simple/",
  "url": "https://lipis.github.io/flag-icon-css/css/flag-icon.css",
  "linkText": null,
  "element": "link",
  "linkScope": "external",
  "nofollow": null,
  "statusCode": 404,
  "error": null,
  "finalUrl": null,
  "redirectChain": null
}
```

### Tips

- Sort by `url` to see each broken link once with all the pages it appears on.
- Turn on **Report redirects** after a migration to find links still pointing to old URLs.
- Use **Schedule** (weekly or monthly) with a notification integration to hear about new 404s.
- For on-page SEO (titles, descriptions, H1, canonical, noindex), see the **SEO Audit Crawler**.

### Feedback

Found a problem or need another check? Open an issue in the **Issues** tab: every issue is read and answered. If the actor helped you, a review on the Store helps a lot.

### How much does it cost?

You pay only for results delivered, at a fixed price per item. **Apify platform usage is included** in that price, so there are no compute costs on top. Errors and items that couldn't be found are free.

| What you get | Price | Example |
|---|---|---|
| Page checked | $0.002 each | 1,000 page checkeds = $2.00 |

The Apify **Free plan includes $5 of monthly credit**, enough for about **2,500 page checkeds** per month at no cost. You can also set a maximum spend per run.

On paid Apify plans it gets cheaper automatically: **10% off on Starter, 20% on Scale and 30% on Business**.

# Actor input Schema

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

Home page (or any start page) of each site. The checker follows internal links from there and tests every link it finds.

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

Stop after checking the links of this many pages per site. You pay per page checked, not per link.

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

Also test links that point to other websites.

## `linkTypes` (type: `array`):

Which kinds of links to test.

## `reportRedirects` (type: `boolean`):

Also list links that work but redirect (worth updating to the final URL).

## `reportRestricted` (type: `boolean`):

List links that answered 401, 403, 429 or 999 (login required or bot blocking, e.g. LinkedIn). Usually they work in a browser.

## `includeUrlPatterns` (type: `array`):

Check only pages whose URL contains one of these texts (e.g. '/blog/'). Empty = whole site.

## `excludeUrlPatterns` (type: `array`):

Skip pages whose URL contains one of these texts (e.g. '/tag/', '?page=').

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

Also crawl subdomains (blog.example.com when starting at example.com).

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

Skip pages blocked by the site's robots.txt. Turn off only for sites you own.

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

Links tested at the same time (at most 2 per external host).

## `timeoutSecs` (type: `integer`):

A link that does not answer in this time is reported as broken (timeout).

## Actor input object example

```json
{
  "startUrls": [
    "https://www.scrapethissite.com"
  ],
  "maxPagesPerSite": 25,
  "checkExternalLinks": true,
  "linkTypes": [
    "a",
    "img",
    "script",
    "link",
    "iframe",
    "source"
  ],
  "reportRedirects": false,
  "reportRestricted": true,
  "includeSubdomains": false,
  "respectRobotsTxt": true,
  "maxConcurrency": 10,
  "timeoutSecs": 20
}
```

# Actor output Schema

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

One item per problem occurrence (page + link) and one summary per site (type 'site-summary').

# 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://www.scrapethissite.com"
    ],
    "maxPagesPerSite": 25
};

// Run the Actor and wait for it to finish
const run = await client.actor("jeffev/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://www.scrapethissite.com"],
    "maxPagesPerSite": 25,
}

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

```

## MCP server setup

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