# Broken Link Checker: Find Dead Links & Redirects (`centorprat/broken-link-checker`) Actor

Give it URLs. For each page it extracts every link and tests it (HTTP status), reporting broken links (4xx/5xx/unreachable) with their anchor text, plus redirects, and internal vs external counts. Keyless, threaded, read-only. Schedule + webhook to catch new broken links.

- **URL**: https://apify.com/centorprat/broken-link-checker.md
- **Developed by:** [Centor Prat](https://apify.com/centorprat) (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 $17.00 / 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 Dead Links & Redirects

**Catch dead links before your visitors (and Google) do.** Give it URLs; for each page it extracts every
link and tests it, reporting **broken links** (4xx/5xx/unreachable) with their anchor text, plus
**redirects** and internal/external counts. Keyless, threaded, agent-callable. Schedule it + set
`webhookUrl` to be alerted when a new broken link appears.

> 🔗 **Read-only.** It sends HEAD/GET requests like a browser. Some servers rate-limit bots, which can
> look like a broken link — spot-check before acting.

### 📋 What each report contains

| Field | Meaning |
|---|---|
| `signal` | `all-links-ok` / `broken-links-found` / `unreachable` |
| `linksChecked` / `brokenCount` / `redirectCount` | Totals |
| `internalLinks` / `externalLinks` | Link breakdown |
| `brokenLinks` | Each broken link: URL, HTTP status, anchor text, internal/external |
| `redirects` | Links that redirect, and where to |

### 📥 Input

```json
{ "urls": ["https://your-site.com"], "maxLinks": 100, "checkExternal": true }
```

One report per URL. Set `checkExternal: false` to test only internal links.

### 💰 Pricing (pay-per-event)

- **Page checked — $0.02** per page fetched (includes testing all its links).

### 💡 Use cases

- **SEO / content teams:** dead links hurt rankings and UX — find them across your key pages.
- **Agencies / QA:** audit a client site's links before and after a migration.
- **Docs / affiliate sites:** catch broken outbound links that rot over time.
- **Agents / CI:** callable as an MCP tool — give it URLs, get back the broken links.

### 🔑 Keyless & agent-callable

No API keys, no accounts, no paid child Actors — just read-only HTTP requests.

### 🚀 Ready-made tasks (one click)

- [Dead Link Checker - Internal Links Only](https://apify.com/centorprat/broken-link-checker/examples/internal-dead-link-checker)

### 🤖 For AI agents (MCP)

```
https://mcp.apify.com/?tools=actors,docs,centorprat/broken-link-checker
```

Loads as `centorprat--broken-link-checker`. Claude Code:

```
claude mcp add apify -- npx -y @apify/actors-mcp-server --actors centorprat/broken-link-checker
```

# Actor input Schema

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

Pages whose links to test, e.g. \["https://your-site.com"]. One report per URL.

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

Cap how many links to test.

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

Test links to other domains too (off = internal links only).

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

How many links to test in parallel.

## `onlyProblems` (type: `boolean`):

On: return only pages that have broken links.

## `webhookUrl` (type: `string`):

If set, pages with broken links are POSTed here as JSON.

## Actor input object example

```json
{
  "urls": [
    "https://www.python.org/"
  ],
  "maxLinks": 100,
  "checkExternal": true,
  "concurrency": 10,
  "onlyProblems": false
}
```

# Actor output Schema

## `links` (type: `string`):

One report per URL: a signal, counts (links checked, broken, redirects, internal/external), the list of broken links (url, status, anchor text, internal/external) and redirects.

# 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.python.org/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("centorprat/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://www.python.org/"] }

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

```

## MCP server setup

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