# Broken Link Checker – Site Link Audit & 404 Finder (`tagadanar/broken-link-checker`) Actor

Crawl a website and check every link, image, script and stylesheet on its pages, internal and external. One row per broken link (404, 5xx, DNS, timeout, SSL) with the page it is on and the anchor text. $3.00 per 1,000 pages + $0.001/run.

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

## Pricing

from $2.10 / 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 – Site Link Audit & 404 Finder

Give it a website URL. It crawls the site's own pages, checks every link, image, script and stylesheet it finds on them (internal and external), and gives you **one row per broken or failing link, with the page it is on and the link text**, so you know exactly what to fix and where. A summary row per site adds pages crawled, links checked and problem counts.

**$3.00 per 1,000 pages crawled on Free ($2.10 on Gold), plus $0.001 per run. Platform usage is included.** Links are checked at no extra charge, however many there are on a page. No API key, no login, no proxy needed.

### What you get

One flat row per (page, problem link). A link that is broken on 30 pages gives 30 rows, one per page to fix.

| Field | What it is |
| --- | --- |
| `rowType` | `link` for a problem link, `summary` for the per-site summary row |
| `site` | The start URL of the site this row belongs to (the first one given, when several start URLs are on one site) |
| `sourceUrl` | The page the link is on (empty when the start URL itself failed) |
| `sourceTitle` | That page's `<title>` |
| `sourceDepth` | Clicks from the start URL to that page (0 = the start page) |
| `targetUrl` | The link that failed, as an absolute URL |
| `linkText` | The anchor text (or image alt text, or the `rel` of a `<link>`) |
| `linkType` | `a`, `img`, `script`, `link`, or `start` for the start URL |
| `isExternal` | `true` when the link points to another website |
| `issue` | `BROKEN` (404, 410, host does not resolve, connection refused, redirect loop, malformed URL), `SERVER_ERROR` (5xx), `CLIENT_ERROR` (other 4xx), `BLOCKED` (401, 403, 429, 999: login or bot protection, check by hand), `TIMEOUT`, `SSL_ERROR` (bad or expired certificate), `UNREACHABLE` (no answer, including a DNS server that did not answer after a retry), `PRIVATE_ADDRESS` (a link to an internal/private IP), `REDIRECT` (only with "Also report redirected links") |
| `statusCode` | The final HTTP status, when there was an answer |
| `error` | `DNS_ERROR`, `DNS_TEMPORARY_FAILURE`, `TIMEOUT`, `TLS_ERROR`, `CONNECTION_REFUSED`, `TOO_MANY_REDIRECTS`, ... when there was no HTTP answer |
| `detail` | One plain sentence: what went wrong |
| `redirectCount` | Redirects followed before the final answer |
| `finalUrl` | Where the redirects ended (only when the link redirected) |
| `checkedAt` | When the link was checked (ISO 8601) |

Summary rows carry `outcome`, `pagesCrawled`, `linksFound`, `uniqueLinksChecked`, `problemLinks`, `uniqueProblemTargets`, `brokenLinks`, `issuesByType`, `externalSkipped`, `robotsSkipped`, `notChecked` and `stopReason`.

### Who uses it

- **SEO consultants and agencies**: a broken-link audit of a client site before a migration or a monthly report, as a spreadsheet with the exact page and anchor to fix.
- **Site owners and content teams**: find the dead outbound links, missing images and 404 internal pages that hurt visitors and rankings.
- **Developers and docs teams**: run it after a deploy or a docs restructure (schedule it in Apify) to catch broken internal links and assets.

### How it works

1. Reads the site's `robots.txt` and skips what it disallows (switch off for a site you own).
2. Crawls the site's own HTML pages from the start URL, breadth first, up to "Max pages per site" and "Max crawl depth". The crawl follows links across the whole site the start URL belongs to, not only its folder: to stay inside a section, add it to "Only crawl URLs matching" (start URL `https://example.com/docs/` with pattern `/docs/*`). `www.` and the bare domain count as the same site; subdomains only when you ask. Several start URLs on one site are crawled together as one crawl, so each page is fetched and charged once and each broken link is reported once.
3. Extracts `a[href]`, `img[src]`, `script[src]` and `link[href]` from every crawled page and checks each unique target once: a HEAD request, with a GET fallback for servers that refuse HEAD, redirects followed and counted.
4. Writes a row for every page that carries a failing link.

It is polite by design: at most 2 requests at a time and 4 per second to any one host, robots.txt `Crawl-delay` honoured (up to 5 s), `Retry-After` honoured on 429/503, and an honest user agent that names this actor. Plain HTTP, no browser: pages are read as served, so links that only appear after JavaScript runs are not seen.

### Examples

Audit a site (the prefill):

```json
{"startUrls":["https://crawler-test.com/"],"maxPages":20}
```

Internal links only, the blog section only (the pattern keeps the crawl inside it), 500 pages:

```json
{"startUrls":["https://www.example.com/blog/"],"maxPages":500,"checkExternal":false,"includePatterns":["/blog/*"]}
```

Several client sites, skipping tag and paginated archive pages, with redirects reported for SEO clean-up:

```json
{"startUrls":["https://client-one.com/","https://client-two.com/"],"maxPages":300,"excludePatterns":["/tag/*","*?page=*"],"reportRedirects":true}
```

### Results, zeros and errors

- A site crawled with no problem link gives its summary row with `problemLinks` 0: that is a real "no broken links" for the pages crawled.
- A start URL that does not answer, answers with an error, or is not an HTML page gives a `start` row with the reason; it is never reported as "no broken links", and nothing is charged for it.
- A start URL that robots.txt disallows is named in the status (switch "Respect robots.txt" off for your own site).
- A start URL that answers 404, does not resolve, or is disallowed by robots.txt ends the run as succeeded with a row naming the problem; a start URL that does not answer at all, blocks the checker or answers a server error fails the run.
- When "Max pages per site" is reached, links to further pages are still checked (just not crawled), and the summary says so.
- Invalid input ends the run right away with an "Input error: ..." message and only the $0.001 start charge.

### Pricing

- $0.001 per run (start).
- $3.00 per 1,000 pages crawled on Free, with lower prices on higher Apify plans ($2.10 per 1,000 on Gold). Platform usage is included.
- A page is counted when it was fetched as HTML with a 2xx status and its links were checked. Link checks, redirects, error pages, files and the start URL rows cost nothing.

"Max pages per site" is a hard cap, so a 200-page audit never costs more than about $0.60 on Free. Set a maximum charge per run in Apify if you want a ceiling across many sites; the actor stops at it and says so in the status.

### FAQ

**Why do some links show `BLOCKED`?** Sites such as LinkedIn or some shops answer automated checks with 401, 403, 429 or 999 even when the page exists. Those links are not called broken; open them in a browser to confirm.

**Does it follow links to other websites?** It checks them (one request each) but never crawls them. Switch "Check external links" off to check only the site's own links.

**How do the URL patterns match?** A pattern that starts with `/` matches the beginning of the page's path, so `/about` also matches `/about-us`; write `/about/*` for that folder only. `*` matches anything, a pattern that starts with `http` matches the beginning of the full URL, other text (such as `*?page=*`) matches anywhere in the URL, and a regular expression goes between slashes. The start URLs are always crawled.

**Is a link on many pages checked many times?** No. Each unique URL is checked once per site; the result is reported for every page that carries it.

**Can it check a site behind a login, or links added by JavaScript?** No. It reads public pages as the server sends them.

### Data use

The actor reads public web pages you point it at, the way a search engine crawler does, and respects robots.txt by default. It stores no personal data: rows hold URLs, page titles, link texts and HTTP statuses. Crawl only sites you own or are allowed to audit.

# Changelog

This Actor's version history is a separate document: https://apify.com/tagadanar/broken-link-checker/changelog.md

# Actor input Schema

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

One or more website URLs, usually the homepage. The crawl starts there and follows links across the whole site the URL belongs to (www. and the bare domain are one site), and every link found on the crawled pages is checked. To stay inside a section, add it to "Only crawl URLs matching": start URL https://example.com/docs/ with pattern "/docs/\*". Several start URLs on one site are crawled together as one crawl, so each page is fetched and charged once. Up to 100 start URLs per run.

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

Hard cap on HTML pages crawled per site (you pay per page crawled; start URLs on the same site share this cap). Links to further pages are still checked, just not crawled. Default 200, max 5,000.

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

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

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

Also check links that point to other websites (they are checked, never crawled). Off = only links within the site.

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

Skip the site's pages and files that robots.txt disallows, and honour its Crawl-delay (up to 5 s). Turn off only for a site you own.

## `includeSubdomains` (type: `boolean`):

Treat subdomains (blog.example.com, docs.example.com) as part of the site and crawl them. Off = only the start URL's host (www. and the bare domain count as the same site).

## `includePatterns` (type: `array`):

Optional. Crawl only pages whose URL matches one of these patterns: "/blog/*" (path), "*/docs/\*" (anywhere), or a regular expression between slashes. A pattern that starts with / (or with http) matches the beginning of the path (or URL), so "/blog" also matches /blog-news; \* matches anything; other text matches anywhere in the URL. The start URLs themselves are always crawled. Links on crawled pages are still all checked.

## `excludePatterns` (type: `array`):

Optional. Do not crawl pages matching these patterns (same rules), e.g. "/tag/*", "*?page=*". A pattern matches the beginning of the path, so "/about" also skips /about-us; write "/about/*" to skip only that folder. Links to them are still checked.

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

Add a row for every link that works but redirects (useful for SEO clean-up). Off = only broken or failing links.

## `maxLinksToCheck` (type: `integer`):

Safety cap on unique links checked per site besides the crawled pages. Default 5,000, max 50,000.

## `includeSummary` (type: `boolean`):

One extra row per site with pages crawled, links checked and problem counts.

## Actor input object example

```json
{
  "startUrls": [
    "https://crawler-test.com/"
  ],
  "maxPages": 20,
  "maxDepth": 5,
  "checkExternal": true,
  "respectRobotsTxt": true,
  "includeSubdomains": false,
  "reportRedirects": false,
  "maxLinksToCheck": 5000,
  "includeSummary": true
}
```

# Actor output Schema

## `dataset` (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://crawler-test.com/"
    ],
    "maxPages": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("tagadanar/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://crawler-test.com/"],
    "maxPages": 20,
}

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

```

## MCP server setup

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