# Broken Link Checker · 404s with Page & Anchor, Only New Ones (`thequietstack/broken-link-checker`) Actor

Crawl your website and find broken links, 404s, server errors and redirects, with the exact page and anchor text to fix. On a schedule it reports only newly broken links. Respects robots.txt and tells 'blocked' apart from 'broken'.

- **URL**: https://apify.com/thequietstack/broken-link-checker.md
- **Developed by:** [TheQuietStack](https://apify.com/thequietstack) (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 $0.67 / 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.
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: 404s with Page and Anchor, Only New Ones

Finds the links on your website that no longer work and tells you **where to fix them**: the page, the anchor text and how often the link appears. On a schedule it reports only newly broken links, so a clean week stays quiet.

**Typical uses:** a weekly link check for your site · cleaning up after a relaunch · finding dead partner and affiliate links · a link report for an agency client.

### What makes it different

- **Refused is not broken.** A link that answers 401, 403 or 429 refused an automated check. Most checkers call that broken. Here it is `problem: blocked`, so your list of real problems stays real.
- **Only new problems.** With `onlyNew` a scheduled run writes just what broke since the last run, and the site summary counts what was fixed.
- **Polite by design.** The Actor names itself, follows robots.txt on every host, including external ones, and never sends parallel requests to one host.

### Input example

```json
{ "startUrls": ["https://www.example.com/"], "maxPages": 200, "maxLinks": 2000, "onlyNew": true }
```

### Output

One row per problem, plus one free `site-summary` row per site.

```json
{ "type": "link", "problem": "broken", "status": 404, "url": "https://www.example.com/old-offer", "linkKind": "internal", "tag": "a",
  "foundOn": "https://www.example.com/", "anchorText": "Old offer", "otherPages": ["https://www.example.com/about"], "timesLinked": 2 }
```

| `problem` | Meaning |
|---|---|
| `broken` | 404, 410 or another 4xx answer |
| `server-error` | 5xx, also after one retry |
| `timeout`, `dns-error`, `tls-error`, `network-error` | No usable answer |
| `blocked` | 401, 403, 429: the site refused the check, the link may well work |
| `redirect` | Works but redirects (only with `includeRedirects`) |

### Pricing

Pay per event: **one charge per unique link checked**, however many pages link to it. A page opened for the crawl counts as its own link check. Links skipped because of robots.txt, `site-summary` rows and problem rows cost nothing extra. `maxLinks` caps every run. A site without problems still costs its checks, because checking is the work.

### Honest limits

- Reads the HTML as delivered. Links that only appear after JavaScript runs are not seen.
- Links in `robots.txt`-disallowed areas are not checked and are counted in `notCheckedByRobots`. If robots.txt cannot be reached (5xx or no answer), nothing on that host is opened.
- `maxPages` and `maxLinks` can end a scan early: the summary then says `complete: false`, and `onlyNew` keeps remembering what it did not reach.
- One host is checked one request at a time with at least 200 ms between requests, so large sites take a while. Raise the run timeout if needed.
- Check sites you own or may check. Private and local addresses are refused.

# Actor input Schema

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

Home pages or sections of sites you own or may check. The crawl stays on the same host.

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

Pages that are opened to look for links.

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

Hard cap on checked links, and therefore on the bill.

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

One request per external link, only where that site's robots.txt allows it.

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

Also checks img, script and stylesheet addresses.

## `useSitemap` (type: `boolean`):

Adds pages from the sitemaps named in robots.txt, so pages without internal links are found too.

## `includeRedirects` (type: `boolean`):

Adds rows for links that work but redirect. Useful for link hygiene.

## `includeBlocked` (type: `boolean`):

401, 403 and 429 mean the site refused an automated check, not that the link is broken. These rows have problem = blocked.

## `onlyNew` (type: `boolean`):

Remembers problems between runs and writes only new ones. Links are still checked and charged. The site summary row counts what was fixed.

## `stateStoreName` (type: `string`):

Named key-value store for the memory. Use different names for different watch lists.

## `delayMs` (type: `integer`):

Minimum pause between two requests to the same host. A longer Crawl-delay in robots.txt wins.

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

A single host never gets parallel requests.

## Actor input object example

```json
{
  "startUrls": [
    "https://books.toscrape.com/"
  ],
  "maxPages": 5,
  "maxLinks": 100,
  "checkExternal": true,
  "checkAssets": true,
  "useSitemap": true,
  "includeRedirects": false,
  "includeBlocked": true,
  "onlyNew": false,
  "stateStoreName": "thequietstack-broken-link-state",
  "delayMs": 500,
  "concurrency": 5
}
```

# Actor output Schema

## `problems` (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 = {
    "startUrls": [
        "https://books.toscrape.com/"
    ],
    "maxPages": 5,
    "maxLinks": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("thequietstack/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/"],
    "maxPages": 5,
    "maxLinks": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("thequietstack/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/"
  ],
  "maxPages": 5,
  "maxLinks": 100
}' |
apify call thequietstack/broken-link-checker --silent --output-dataset

```

## MCP server setup

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