# Broken Link Checker: Find 404s & Dead Links on Any Website (`larkmoor/broken-link-checker`) Actor

Crawl a website and find every broken link: 404 and 410 pages, dead external links, domains that no longer resolve, timeouts and broken images, each with the page it appears on and its anchor text. Pay per page crawled; link rows are free.

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

## Pricing

from $1.70 / 1,000 page crawleds

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 & Broken Images on Any Website

Point it at a website and it **crawls the site, collects every link on every page and checks each one**, then gives you a clean list of what is broken: **404 and 410 pages**, **dead external links**, domains that **no longer resolve**, **timeouts**, **SSL errors**, **redirect loops** and **broken images**. Every broken link comes with **the page it appears on and its anchor text**, so you know exactly what to fix and where.

No browser, no login and no setup: it reads the site's public HTML, respects robots.txt and checks each unique URL only once, however many pages link to it. You pay **$2 per 1,000 pages crawled**. Link rows and link checks are free.

### Why check for broken links?

- **SEO**: broken internal links waste crawl budget and leak link equity; broken outbound links make a page look abandoned.
- **User experience**: a visitor who hits a 404 from your own menu or blog post is likely to leave.
- **Content maintenance**: blogs and resource pages rot. Partners rebrand, tools shut down, docs move. A monthly scheduled run catches it.
- **Agencies**: a link audit is a quick, concrete win to show a new client, with the exact page and anchor text for each fix.
- **Migrations**: after moving to a new CMS or URL structure, find every internal link that still points to the old paths.

### What it checks

- **Internal links**: every `<a href>` that points to the same site. These pages are also crawled (up to your page and depth limits).
- **External links**: links to other websites (on by default, switch off with `checkExternalLinks`).
- **Images**: every `<img src>` (on by default).
- **Scripts and stylesheets**: optional (`checkScriptsAndCss`).

Each URL is requested with HEAD first and with GET when the server answers HEAD with an error (many servers do), following redirects.

### Results you get

One row per problem link (or per link checked, if you turn `onlyBroken` off):

| Field | Meaning |
|---|---|
| `result` | `broken`, `unverified` (the server refused automated checks: open it by hand), `redirect` (optional) or `ok` |
| `url` | the link that was checked |
| `status`, `reason` | HTTP status and a plain reason: `HTTP 404`, `domain does not resolve (DNS)`, `timeout after 15s`, `SSL certificate error`, `redirect loop` |
| `linkType` | internal or external, and link, image, script or stylesheet |
| `foundOn`, `anchorText` | the first page that links to it and the clickable text (or the image's alt text) |
| `foundOnCount`, `allSources` | how many crawled pages link to it, and up to 20 of those pages with their anchor text |
| `redirectsTo` | the final URL when the link redirects |
| `site` | the start URL the link belongs to |

Plus one **summary row per site** (`result: "summary"`) with pages crawled, unique links, links checked, broken and unverified counts, and whether a limit was reached. The **"Per-site summary"** view shows these rows on their own.

### Input

```json
{
  "startUrls": ["https://www.example.com"],
  "maxPagesPerSite": 200,
  "checkExternalLinks": true,
  "checkImages": true,
  "onlyBroken": true
}
```

Other options: `maxDepth` (clicks from the start page), `maxLinksPerSite`, `includeUnverified`, `reportRedirects`, `crawlUrlsWithQuery` (follow filter and sort URLs, off by default), `respectRobotsTxt`, `timeoutSecs`, `concurrency` and `delaySecs` to be gentle with small servers.

### Example output

A real run on basecamp.com (20 pages):

```json
{
  "site": "https://basecamp.com/",
  "url": "https://www.apideck.com/connectors/basecamp",
  "result": "broken",
  "status": 404,
  "reason": "HTTP 404",
  "linkType": "external link",
  "redirectsTo": "https://www.apideck.com/integrations/basecamp",
  "foundOn": "https://basecamp.com/integrations",
  "anchorText": "Apideck Apideck helps developers build native integrations faster through one API.",
  "nofollow": false,
  "foundOnCount": 1,
  "allSources": [
    {
      "page": "https://basecamp.com/integrations",
      "anchorText": "Apideck Apideck helps developers build native integrations faster through one API."
    }
  ]
}
```

```json
{
  "site": "https://basecamp.com/",
  "result": "summary",
  "pagesCrawled": 20,
  "linksChecked": 462,
  "linksFound": 462,
  "broken": 2,
  "unverified": 7,
  "seconds": 14.2,
  "linkLimitReached": false,
  "pageLimitReached": true
}
```

### How much does it cost?

You pay **$0.002 per page crawled** ($2 per 1,000 pages) plus a one-time $0.001 actor start. Checking the links is included: a page with 150 links costs the same as a page with 5. Higher Apify plans get automatic volume discounts (up to 15% off). Runs need only 256 MB of memory.

- **A 50-page small-business site**: about **$0.10**.
- **A 500-page blog, checked every month**: about **$1** per run.
- **An agency checking 20 client sites of 300 pages each**: about **$12**.

Set "Max total charge" on the run, or lower `maxPagesPerSite`, to cap the cost. When your limit is reached, the crawl stops and the links already found are still checked and reported.

### FAQ

**Why are some links "unverified" instead of broken?** Sites like LinkedIn, and many sites behind bot protection, answer automated requests with 401, 402, 403, 429 or 999 even when the page works in a browser. Calling those "broken" would be wrong, so they are listed separately. Turn `includeUnverified` off to hide them.

**Does it run JavaScript?** No. It reads the HTML the server sends, which is where links live on almost every site. Links that only appear after JavaScript runs (some single-page apps) are not seen.

**Can I check sites I don't own?** Yes, at a polite pace. The actor respects robots.txt by default, sends a clear user agent and checks each URL only once. Use `delaySecs` and a lower `concurrency` for small servers.

**Will it crawl forever on a big site?** No. `maxPagesPerSite`, `maxDepth` and `maxLinksPerSite` cap every run, and filter URLs with `?query` parameters are not crawled unless you ask.

**How do I get alerts?** Schedule a weekly or monthly run and connect a webhook, Slack, email or Google Sheets integration. With `onlyBroken` on, an empty dataset means everything works.

### Integrations

Export as CSV, Excel or JSON, call it from the Apify API, schedule it, or connect it to Make, Zapier, n8n, Google Sheets, Slack or a webhook.

### Changelog

- **0.1** (Nov 2026): first release: same-site crawl with depth and page limits, internal and external links, images, scripts and CSS, HEAD-then-GET checks, DNS / timeout / SSL / redirect-loop reasons, unverified class for bot-protected sites, per-site summary, pay per page.

# Actor input Schema

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

Homepages (or any start page) of the sites to check, one per line. The crawl stays on each start page's own domain.

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

How many pages of each site to crawl. You pay per page crawled. Default 200.

## `maxDepth` (type: `integer`):

How many clicks away from the start page the crawl goes (0 = the start page only).

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

Also check links that point to other websites (the most common source of dead links). Off = internal links only.

## `checkImages` (type: `boolean`):

Also check every <img> source for broken images.

## `checkScriptsAndCss` (type: `boolean`):

Also check <script src> and stylesheet files.

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

On: one row per broken or unverified link. Off: one row for every link checked, including working ones.

## `includeUnverified` (type: `boolean`):

Report links whose server refused the automated check (HTTP 401, 402, 403, 429, 999, common on LinkedIn and sites behind bot protection) as `unverified`, so you can open them by hand.

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

Also list working links that redirect elsewhere (useful for updating old links and http to https).

## `maxLinksPerSite` (type: `integer`):

Cap on unique links checked per site. Default 5000.

## `crawlUrlsWithQuery` (type: `boolean`):

Follow internal links that contain ?parameters (filters, sorting, pagination). Off avoids crawling endless filter combinations; the links are still checked.

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

Skip pages the site's robots.txt disallows. Keep this on for sites you do not own.

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

How long to wait for each link before calling it a timeout.

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

Pages fetched at the same time (link checks use twice this). Lower it for small servers.

## `delaySecs` (type: `integer`):

Pause between crawl batches to be gentle on the site. 0 = no pause.

## `summaryRow` (type: `boolean`):

Append one row per site with pages crawled, links checked and broken counts (also saved in the OUTPUT record).

## Actor input object example

```json
{
  "startUrls": [
    "https://books.toscrape.com",
    "https://basecamp.com"
  ],
  "maxPagesPerSite": 200,
  "maxDepth": 10,
  "checkExternalLinks": true,
  "checkImages": true,
  "checkScriptsAndCss": false,
  "onlyBroken": true,
  "includeUnverified": true,
  "reportRedirects": false,
  "maxLinksPerSite": 5000,
  "crawlUrlsWithQuery": false,
  "respectRobotsTxt": true,
  "timeoutSecs": 15,
  "concurrency": 8,
  "delaySecs": 0,
  "summaryRow": true
}
```

# Actor output Schema

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

Broken (and optionally all) links with the page they were found on, plus one summary row per site, in the run's default dataset.

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

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

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

```

## MCP server setup

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