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

Crawl a website and check every link, or bulk-check a URL list. Status codes, full redirect chains, response times, the pages and anchor text where each broken link appears. Robots-aware. $0.40 per 1,000 links.

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

## Pricing

Pay per event

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, redirects and dead links

Crawl any website and check every link on it, or paste a list of URLs to bulk-check their HTTP status. You get one clean row per unique link: status, HTTP code, full redirect chain, response time, and the exact pages and anchor text where the link appears, so you know what to fix and where.

**$0.40 per 1,000 links checked.** Pages crawled are free. A 25-page site with 1,000 links costs about $0.40.

### What it does

- **Site crawl**: starts from your homepage (or any page), follows internal links up to `maxPages`, and checks every internal and external link it finds.
- **Bulk URL checker**: turn `crawl` off and it checks just the URLs you list: status codes, redirects, final URL, timing.
- **Clear status for every link**: `broken` (4xx/5xx), `error` (DNS not found, connection refused, timeout, expired or invalid SSL certificate, redirect loop), `blocked` (401/403/429/999, usually bot protection rather than a dead link), `redirected` (works, but through 301/302 hops), `ok`.
- **Where it's broken**: `foundOn` lists up to 10 source pages per link with anchor text, tag and nofollow flag, plus a total `occurrences` count.
- **Accurate**: tries a fast HEAD request first and confirms every failure with GET, because many servers mishandle HEAD. Redirect chains are followed hop by hop.
- **Polite**: honours robots.txt when crawling, at most 5 parallel requests per host, identifies itself with a clear user agent, retries 429/503 with backoff.
- **Problems first**: rows are sorted broken, error, blocked, redirected, ok. `SUMMARY` record has counts for every status.
- Optional checks of images, scripts, stylesheets, iframes and media (`checkAssets`).

### Input example

```json
{ "urls": ["https://example.com"], "maxPages": 200, "maxLinks": 10000, "onlyBroken": true }
```

### Output example

```json
{
  "url": "https://example.com/old-pricing",
  "status": "broken",
  "isBroken": true,
  "statusCode": 404,
  "error": null,
  "finalUrl": "https://example.com/old-pricing",
  "redirectCount": 0,
  "redirectChain": [],
  "responseTimeMs": 182,
  "contentType": "text/html",
  "isInternal": true,
  "linkType": "a",
  "occurrences": 3,
  "foundOn": [{ "pageUrl": "https://example.com/blog/launch", "anchorText": "see pricing", "tag": "a", "nofollow": false }],
  "checkedAt": "2026-10-23T06:00:00.000Z"
}
```

### Pricing compared

| Actor | Price per 1,000 links |
|---|---|
| **This Actor** | **$0.40** |
| khadinakbar/broken-link-checker | $1.00 |
| parseforge/broken-link-checker | $1.20 + $0.04 per run |
| logiover/bulk-url-status-checker | $2.50 |
| logiover/broken-link-checker | $5.00 |

Prices from the Apify Store, October 2026. Set a maximum cost per run in Apify and the Actor stops cleanly at the limit.

### Use cases

- SEO audits and link rot clean-up
- Site migrations: verify every old URL redirects correctly
- Monitoring: schedule a weekly run with `onlyBroken` and get only what broke
- Bulk HTTP status and redirect checks for URL lists, sitemaps or backlinks

### FAQ

**Why is a link "blocked" and not "broken"?** Sites like LinkedIn or some CDNs refuse automated requests (403, 429, 999). The page probably works in a browser, so it's kept separate from real 404s.

**Does it run JavaScript?** No. It reads the HTML your server returns, which is what search engines and most link checkers see. That makes it fast and cheap.

**Does it follow nofollow links?** Yes, it checks them and marks them `nofollow: true`.

### API

```bash
curl -X POST "https://api.apify.com/v2/acts/best_apis~broken-link-checker/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" -d '{"urls":["https://example.com"],"onlyBroken":true}'
```

# Actor input Schema

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

Start pages to crawl (for example your homepage), or a plain list of URLs to check when crawling is off. Empty input runs a small demo.

## `crawl` (type: `boolean`):

On: follow internal links from the start pages and check every link found. Off: just check the URLs you listed (bulk HTTP status and redirect checker).

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

Internal HTML pages to open and scan for links. Links found beyond this are still checked.

## `maxLinks` (type: `integer`):

Hard cap on unique URLs checked (and billed) per run.

## `checkExternal` (type: `boolean`):

Also check links that point to other websites.

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

Also check <img>, <script>, \<link rel=stylesheet/icon>, <iframe> and <source> URLs, not only <a> links.

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

Save only broken links (4xx/5xx and connection, DNS, SSL or timeout errors). Counts for every status are always in the SUMMARY record.

## `respectRobots` (type: `boolean`):

Don't crawl pages that robots.txt disallows (links to them are still checked).

## `concurrency` (type: `integer`):

Parallel requests overall. At most 5 run against any single host.

## Actor input object example

```json
{
  "urls": [
    "https://books.toscrape.com"
  ],
  "crawl": true,
  "maxPages": 10,
  "maxLinks": 1000,
  "checkExternal": true,
  "checkAssets": false,
  "onlyBroken": false,
  "respectRobots": true,
  "concurrency": 16
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

## `full` (type: `string`):

No description

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

No description

# 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://books.toscrape.com"
    ],
    "maxPages": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("best_apis/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 = {
    "urls": ["https://books.toscrape.com"],
    "maxPages": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("best_apis/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 '{
  "urls": [
    "https://books.toscrape.com"
  ],
  "maxPages": 10
}' |
apify call best_apis/broken-link-checker --silent --output-dataset

```

## MCP server setup

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