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

Crawl any website and find every broken link: 404s, 5xx errors, dead external links, redirect chains and missing images or scripts, each with the page it was found on and its anchor text so you can fix it fast. Polite crawling, cost cap, CSV/Excel export.

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

## Pricing

$0.80 / 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/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 & redirect chains

Crawl one website or a whole list of sites and check every link on every page. Get each **broken link**, the **page it appears on**, the **anchor text**, the **HTTP status code** (404, 410, 500, 503 and more), timeouts and redirect chains. Fix dead links before Google and your visitors find them.

### Why use it

- **SEO**: broken internal links waste crawl budget and leak link equity. Broken outbound links hurt trust.
- **Website launches and migrations**: catch 404s after a redesign, CMS move or URL change.
- **Agencies**: run monthly link audits for every client site in one scheduled run.
- **Content teams**: find dead references in blogs, docs and knowledge bases.

### What you get

| Field | Description |
|---|---|
| `url` | The link that was checked |
| `status` | HTTP status code, or empty when the request failed |
| `error` | `timeout`, DNS or connection error, if any |
| `sourcePage` | The page where the link was found |
| `anchorText` | The clickable text of the link |
| `type` | `link`, `image`, `script` or `stylesheet` |
| `internal` | `true` for links on the same site |
| `redirects`, `finalUrl` | Redirect count and where the link ends up |
| `responseMs` | Response time |

A per-site summary (pages crawled, broken references) is saved to the key-value store as `SUMMARY`. Export to CSV, Excel, JSON or Google Sheets, schedule weekly runs, or call it from the API, Zapier, Make, n8n or an AI agent via Apify MCP.

### How to use it

1. Add one or more **Website URLs**.
2. Choose **Max pages per site** and **Max links to check** (your cost cap).
3. Optionally check **images, scripts and stylesheets** or turn off **Output only broken links** for a full link inventory.
4. Click **Start**.

```json
{
  "startUrls": [{ "url": "https://example.com" }],
  "maxPagesPerSite": 50,
  "maxLinksTotal": 2000,
  "checkExternalLinks": true,
  "includeAssets": false,
  "onlyBroken": true
}
```

### Example input

```json
{
  "startUrls": [
    {
      "url": "https://books.toscrape.com/"
    }
  ],
  "maxPagesPerSite": 3,
  "maxLinksTotal": 40,
  "onlyBroken": false
}
```

### Example output (one dataset row from a real run)

```json
{
  "site": "books.toscrape.com",
  "sourcePage": "https://books.toscrape.com/",
  "url": "https://books.toscrape.com/index.html",
  "type": "link",
  "anchorText": "Books to Scrape",
  "internal": true,
  "broken": false,
  "status": 200,
  "finalUrl": "https://books.toscrape.com/index.html",
  "redirects": 0,
  "error": null,
  "responseMs": 16
}
```

### Pricing

**$0.0008 per unique link checked** ($0.80 per 1,000 links). Each unique URL is checked and billed once per run, even if it appears on many pages. Runs stop at **Max links to check** and at your Apify max-charge setting.

#### Pricing examples

- 100 link checkeds: $0.08
- 1,000 link checkeds: $0.80
- 10,000 link checkeds: $8.00

You pay only for results delivered, and the run stops at your max cost per run.

### Polite crawling

- Follows `robots.txt` rules for the pages it crawls.
- Crawls only pages on the same host as your start URL.
- Uses HEAD requests first and limits concurrency to stay light on servers.

### FAQ

**Does it render JavaScript?** No. It reads the HTML the server returns, which covers most sites and keeps runs fast and cheap.

**Why is a link marked 403?** Some sites block automated checks. Treat 403 as "check by hand".

**Does it collect personal data?** No. It only records URLs, status codes and link text.

**Does it check external links?** Yes, optionally, with polite HEAD/GET requests.

**JavaScript sites?** It reads server-rendered HTML; links injected only by JavaScript may be missed.

### More tools from LaunchGrade

Website audits, link checking, domain research, lead lists and data exporters, all pay-per-result: [apify.com/launchgrade](https://apify.com/launchgrade).

# Actor input Schema

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

Homepages or sections to crawl. Pages on the same host are followed.

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

How many pages to crawl on each site.

## `maxLinksTotal` (type: `integer`):

Total unique links checked across all sites. The run stops here so it can't cost more than you expect.

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

Also check links that point to other websites.

## `includeAssets` (type: `boolean`):

Also check img, script and CSS files.

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

Turn off to get every checked link with its status code.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://books.toscrape.com/"
    }
  ],
  "maxPagesPerSite": 3,
  "maxLinksTotal": 50,
  "checkExternalLinks": true,
  "includeAssets": false,
  "onlyBroken": false
}
```

# Actor output Schema

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

One row per link or asset checked, with status, redirects and broken flag.

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

JSON summary of the run.

# 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": [
        {
            "url": "https://books.toscrape.com/"
        }
    ],
    "maxPagesPerSite": 3,
    "maxLinksTotal": 50,
    "onlyBroken": false
};

// Run the Actor and wait for it to finish
const run = await client.actor("launchgrade/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": [{ "url": "https://books.toscrape.com/" }],
    "maxPagesPerSite": 3,
    "maxLinksTotal": 50,
    "onlyBroken": False,
}

# Run the Actor and wait for it to finish
run = client.actor("launchgrade/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": [
    {
      "url": "https://books.toscrape.com/"
    }
  ],
  "maxPagesPerSite": 3,
  "maxLinksTotal": 50,
  "onlyBroken": false
}' |
apify call launchgrade/broken-link-checker --silent --output-dataset

```

## MCP server setup

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