# Broken Link Checker: 404s, redirects and bad URLs (`bepolabs/link-checker`) Actor

Give it your key sites or a list of addresses. Each hyperlink and image gets one row: answer code, every hop of its redirects trail, final destination, response time and where it was found.

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

## Pricing

$0.80 / 1,000 checked links

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

### 🔗 What is Broken Link Checker?

Spot every broken link, 404 and chain of redirects before customers do. Point it at the documents you care about, or drop in a plain spreadsheet column, and each target is requested once, then labelled ok, redirected or broken. Switch on `onlyBroken` to keep and pay for failures only.

- **SEO audits**: find 404s and redirect chains that waste crawl budget and link equity
- **Website QA before a launch**: check every link on your key pages after a redesign or a migration
- **Redirect mapping**: verify that old addresses land on the right new destination, one jump at a time
- **Content maintenance**: schedule a weekly run over blog posts and docs and fix what broke
- **Outbound link monitoring**: make sure partner, affiliate and reference links still work

![Broken Link Checker: Every link and image on your pages checked: HTTP status, each redirect hop, final URL and response time.](https://api.apify.com/v2/key-value-stores/wdeAWGooHdIhvFgSY/records/link-checker-hero.png)

#### ✨ Why use this Actor?

- ✅ **Every redirect hop**: each 301, 302, 307 or 308 is listed with its URL and status, up to `maxRedirects` hops (default 10)
- ✅ **Links and images**: anchors and `<img src>` pictures are both covered, with the visible text and the page they were found on
- ✅ **Pages or plain URL lists**: read documents and test what they point to, or give up to 500 addresses directly
- ✅ **Failures on request**: with `onlyBroken`, only dead targets are stored and charged
- ✅ **Light on servers**: a HEAD request first (GET when a server refuses it), eight at a time, retries with backoff on network errors, 429 and 5xx
- ✅ **Polite**: robots.txt is honoured for every host; disallowed targets are marked as skipped, not hammered

### 📦 What data can you get with Broken Link Checker?

| | | |
|---|---|---|
| 🔗 Checked URL | ✅ Result: ok, redirected, broken | 🔢 HTTP status code |
| ↪️ Redirect chain, hop by hop | 🎯 Final URL | ⏱️ Response time (ms) |
| 📄 Page the link was found on | 📝 Link text | 🖼️ Tag: link or image |
| 🏠 Internal-only filter | 🤖 robots.txt skips marked | 📊 Run summary: broken and redirected counts |

### 🚀 How to use Broken Link Checker

Broken Link Checker works in a few clicks, no coding needed:

1. [Create a free Apify account](https://console.apify.com/sign-up) (the free plan includes 5 USD of monthly credit).
2. Open [Broken Link Checker](https://apify.com/bepolabs/link-checker) and click **Try for free**.
3. Paste your documents (or plain addresses with "Check links on the pages" off) and choose whether to keep only failures.
4. Click **Start** and wait for the run to finish (most runs take seconds).
5. Download your data as JSON, CSV, Excel, XML or HTML, or send it straight to Google Sheets, Make, Zapier or your AI agent.

![How Broken Link Checker works](https://api.apify.com/v2/key-value-stores/wdeAWGooHdIhvFgSY/records/link-checker-workflow.png)

### ⬇️ Input

Add the pages to check, up to 500 per run. Everything else has sensible defaults.

##### Check the links on pages, or the URLs themselves

With `checkLinks` on (default), each entry is opened and everything it points to gets a verdict. With `checkLinks` off, the entries themselves are examined, which suits sitemaps, redirect maps and spreadsheet columns.

##### Internal links only

Switch on `internalOnly` to follow only targets on the same host, for example to audit your own navigation and skip outbound ones.

##### Limits

`maxLinksPerPage` caps how many each document may yield (default 200, up to 2,000). The Actor handles what you give; it does not crawl the whole site, so add every one you want covered.

| Field | Type | What it does | Default |
|---|---|---|---|
| **URLs** (`urls`) | array | Pages whose links are checked, or (with "Check links on the pages" off) the URLs to check themselves. | `["https://www.iana.org/help/example-doma` |
| **Check links on the pages** (`checkLinks`) | boolean | On: read each page and check its links and images. | `true` |
| **Internal links only** (`internalOnly`) | boolean | Only links to the same host as the page. | `false` |
| **Only broken links in the dataset** (`onlyBroken`) | boolean | Charge and store only links that failed. | `false` |
| **Maximum links per page** (`maxLinksPerPage`) | integer | Maximum number of links checked on each crawled page (1 to 2,000); extra links on very long pages are skipped. | `200` |
| **Maximum redirects** (`maxRedirects`) | integer | Hops followed before a link counts as broken. | `10` |
| **Maximum retries** (`maxRetries`) | integer | Retries per request with exponential backoff on network errors, 429 and 5xx. | `2` |

![Broken Link Checker input form](https://api.apify.com/v2/key-value-stores/wdeAWGooHdIhvFgSY/records/link-checker-input.png)

#### Input example

```json
{
    "urls": [
        "https://docs.apify.com/"
    ],
    "internalOnly": true,
    "maxLinksPerPage": 40
}
```

### ⬆️ Output

Each target becomes one row with its `result`: `ok`, `redirected` (it works, but through one or more redirects), `broken` (status 400 or higher, too many redirects, or no answer at all) or `skipped: robots.txt`. The run summary in the key-value store (`OUTPUT`) counts broken and redirected rows and lists every document with the number found or the reason it could not be read.

![Broken Link Checker output table](https://api.apify.com/v2/key-value-stores/wdeAWGooHdIhvFgSY/records/link-checker-output.png)

#### Output example

One row of the dataset (a redirected link on docs.apify.com, from a real run):

```json
{
    "url": "https://docs.apify.com/cli",
    "status": 200,
    "ok": true,
    "result": "redirected",
    "finalUrl": "https://docs.apify.com/cli/docs",
    "redirects": [
        {
            "url": "https://docs.apify.com/cli",
            "status": 301
        }
    ],
    "ms": 559,
    "foundOn": "https://docs.apify.com/",
    "linkText": "CLI",
    "tag": "a"
}
```

#### A broken link

From the same kind of run, with `checkLinks` off:

```json
{
    "url": "https://httpbin.org/status/404",
    "status": 404,
    "ok": false,
    "result": "broken",
    "finalUrl": "https://httpbin.org/status/404",
    "redirects": [],
    "ms": 3632,
    "foundOn": null,
    "linkText": null,
    "tag": null
}
```

#### ⚠️ Result values

| `result` | Meaning |
|---|---|
| `ok` | Answered with a status below 400, no redirect |
| `redirected` | Works, but only after one or more redirects (see `redirects`) |
| `broken` | Answered with a status from 400 to 499, for example 404 or 410 |
| `broken: too many redirects` | More than `maxRedirects` hops |
| `broken: <reason>` | No answer after the retries: unknown domain, timeout, refused connection, rate limit (429) or server error (5xx); the reason is in the text |
| `skipped: robots.txt` | The host's robots.txt disallows the URL; not requested |

A page you list that cannot be read (for example HTTP 404 or blocked by robots.txt) is not charged and does not stop the run: it appears in the run summary with the reason.

View the results as a table or JSON in the Output tab and download them as JSON, CSV, Excel, XML, HTML or RSS, all fields or only those you pick.

### 💰 How much does Broken Link Checker cost?

Broken Link Checker is priced **per event**: **0.8 USD per 1,000 links** (0.0008 USD per link), with no monthly rental. With `onlyBroken` on, you pay for failures only. Unreadable inputs cost nothing.

| You get | You pay |
|---|---|
| 100 links | 0.08 USD |
| 1,000 links | 0.8 USD |
| 10,000 links | 8 USD |
| 100,000 links | 80 USD |

💡 Apify's free plan gives you 5 USD of credit every month, enough for about **6,250 links** at no cost. Set a spending limit per run and the Actor stops there.

### ⚖️ Broken Link Checker vs. the alternatives

| | Broken Link Checker | Free online link checkers | SEO suite subscriptions |
|---|---|---|---|
| **Every redirect hop with its status** | ✅ | often final status only | ✅ |
| **Plain URL lists (sitemaps, redirect maps)** | ✅ up to 500 per run | ❌ one site at a time | ✅ |
| **JSON, CSV, Excel and API** | ✅ | ❌ | ✅ on paid plans |
| **Pay per link, no monthly plan** | ✅ 0.8 USD per 1,000 | free with limits | monthly plan |
| **Schedules, webhooks and MCP for AI agents** | ✅ | ❌ | varies |

### 🔌 Integrations, API and MCP

#### Connect Broken Link Checker to your AI agent (MCP)

Give Claude, ChatGPT, Cursor or any MCP client direct access to Broken Link Checker through the [Apify MCP server](https://mcp.apify.com). Add this URL to its settings:

```text
https://mcp.apify.com/?actors=bepolabs/link-checker
```

For Claude Desktop, add it under `mcpServers` in `claude_desktop_config.json`:

```json
{
    "mcpServers": {
        "link-checker": {
            "command": "npx",
            "args": [
                "-y",
                "@apify/actors-mcp-server",
                "--actors",
                "bepolabs/link-checker"
            ],
            "env": {
                "APIFY_TOKEN": "<your Apify API token>"
            }
        }
    }
}
```

Then ask: *"Check every link on https://example.com/pricing and tell me which ones are broken or redirect."*

#### Run it from your code

Python (`pip install apify-client`):

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("bepolabs/link-checker").call(run_input={"urls":["https://docs.apify.com/"],"internalOnly":true,"maxLinksPerPage":40})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

JavaScript (`npm install apify-client`):

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });
const run = await client.actor('bepolabs/link-checker').call({"urls":["https://docs.apify.com/"],"internalOnly":true,"maxLinksPerPage":40});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

#### No-code integrations

Send results to **Google Sheets, Slack, Airtable, HubSpot, Make, Zapier, n8n** and more from the Integrations tab, start runs on a **schedule**, or trigger your own endpoint with a **webhook** when a run finishes. The [Apify API](https://docs.apify.com/api/v2) gives you full control over runs and datasets.

### ❓ FAQ

##### Does it crawl my whole website?

No. It examines what your listed entries point to (up to 500, with up to 2,000 targets each). To cover a whole site, pass the addresses from its sitemap, or give that file itself with `checkLinks` off.

##### What counts as a broken link?

A status of 400 or higher, more redirects than `maxRedirects`, or no answer at all (unknown domain, timeout, connection refused). Redirects that end in a working page are marked `redirected`, not broken.

##### Why are some links marked skipped?

Their host's robots.txt disallows them, so the Actor does not request them. These rows are still in the dataset so you can see what was not checked.

##### Are images checked too?

Yes. `<img src>` addresses are examined like anchors and marked with `tag: img`. Targets using `mailto:`, `tel:`, `javascript:` and in-document jumps are left out.

##### How do I get only the broken links?

Switch on `onlyBroken`. Only failed links are stored and charged; the run summary still counts everything.

##### Is it legal to use Broken Link Checker?

Yes. Asking whether an address works means one request each, the same as a visitor clicking it, and the Actor honours robots.txt for every host with an honest user agent (`BEPOLabsLinkChecker`). It does not log in or collect personal data. Use it on sites you own or have a legitimate reason to examine, and keep runs on third-party hosts reasonable.

##### What if something is missing or does not work?

Open an issue on the **Issues** tab; we read each one and reply. Feature requests are welcome too.

### 💬 Your feedback

Tell us what Broken Link Checker should add on the **Issues** tab or leave a review; your notes decide what we work on next.

### 🔗 Related Actors

| Actor | What it does |
|---|---|
| 🩺 [SEO Audit](https://apify.com/bepolabs/seo-audit) | Any page to a 0 to 100 SEO score and grade, with the fixes that matter most first: on-page, links and Core Web Vitals. |
| 🗺️ [Sitemap URL Extractor](https://apify.com/bepolabs/sitemap-urls) | Every URL of a website from its sitemaps, in one deduplicated list with lastmod, changefreq and priority. |
| ⚡ [Bulk PageSpeed Insights](https://apify.com/bepolabs/pagespeed) | Lighthouse scores, lab metrics and real-user Core Web Vitals for any list of URLs, on mobile, desktop or both. |
| 📸 [Website Screenshot](https://apify.com/bepolabs/website-screenshot) | Full-page PNG, JPEG or PDF of any URL, on desktop, tablet and phone, with cookie banners closed. |
| 📝 [Website to Markdown](https://apify.com/bepolabs/web-to-markdown) | Any web page or docs site to clean Markdown for LLMs, RAG and AI agents, with headings, links and ready-made chunks. |
| 🌐 [Domain RDAP and DNS](https://apify.com/bepolabs/domain-rdap) | Domains to registrar, creation and expiry dates, age, status, nameservers, DNSSEC and DNS records from official RDAP, in bulk. |
| 📈 [Google Trends Scraper](https://apify.com/bepolabs/google-trends) | Interest over time for up to five keywords on one 0 to 100 scale, any country or worldwide, plus top and rising related queries. |
| 🧩 [Tech Stack Detector](https://apify.com/bepolabs/tech-stack) | Any list of domains to the technologies behind each site: CMS, shop, framework, analytics, CDN and hosting. |

# Changelog

This Actor's version history is a separate document: https://apify.com/bepolabs/link-checker/changelog.md

# Actor input Schema

## `urls` (type: `array`):

Pages whose links are checked, or (with "Check links on the pages" off) the URLs to check themselves. Up to 500.

## `checkLinks` (type: `boolean`):

On: read each page and check its links and images. Off: check the given URLs.

## `internalOnly` (type: `boolean`):

Only links to the same host as the page.

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

Charge and store only links that failed.

## `maxLinksPerPage` (type: `integer`):

Maximum number of links checked on each crawled page (1 to 2,000); extra links on very long pages are skipped.

## `maxRedirects` (type: `integer`):

Hops followed before a link counts as broken.

## `maxRetries` (type: `integer`):

Retries per request with exponential backoff on network errors, 429 and 5xx.

## Actor input object example

```json
{
  "urls": [
    "https://www.iana.org/help/example-domains"
  ],
  "checkLinks": true,
  "internalOnly": false,
  "onlyBroken": false,
  "maxLinksPerPage": 200,
  "maxRedirects": 10,
  "maxRetries": 2
}
```

# Actor output Schema

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

Dataset items, one row per result, in the overview table view.

# 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 = {
    "urls": [
        "https://www.iana.org/help/example-domains"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("bepolabs/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 = { "urls": ["https://www.iana.org/help/example-domains"] }

# Run the Actor and wait for it to finish
run = client.actor("bepolabs/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 '{
  "urls": [
    "https://www.iana.org/help/example-domains"
  ]
}' |
apify call bepolabs/link-checker --silent --output-dataset

```

## MCP server setup

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