# Broken Link Checker & SEO Site Audit (`cellwright/broken-link-checker`) Actor

Crawls your website and finds broken links (internal, external, images, scripts), redirect chains and on-page SEO issues: titles, meta descriptions, H1, canonical, noindex, alt texts. Fast, no browser, pay per page.

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

## Pricing

Pay per event

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 & SEO Site Audit

Crawl your website and find **every broken link** – internal pages, external links, images, scripts and stylesheets – plus **redirect chains** and the most common **on-page SEO issues** (missing or too long titles and meta descriptions, missing/multiple H1, canonical, noindex, missing alt texts, mixed content, slow pages). One clean record per page, a site-wide summary, and **network errors are free**.

Fast and cheap: plain HTTP, no browser. Ideal for site owners, SEO agencies and web developers who want a regular health check, a pre-launch audit or structured data for AI agents.

### Why this Actor

- **Broken links with context:** every broken link is listed on the page where it was found, with status code, link type (internal, external, resource) and anchor text.
- **Site-wide summary** in the key-value store (`OUTPUT`): unique broken URLs with the pages linking to them, restricted URLs, issue counts, **duplicate titles and meta descriptions**, slowest pages.
- **Accurate:** HEAD first, GET fallback (many servers answer HEAD wrongly), one retry on timeouts/429/503, each URL is checked only once per run. External links answering 401/403/429/999 (sites that block bots) are listed separately as "restricted – verify manually" instead of being counted as broken.
- **Under your control:** max pages, depth, include/exclude patterns, subdomains, query parameter handling, a separate limit for link checks to protect your budget.
- **Polite and safe:** respects robots.txt and `meta robots nofollow` by default, honest user agent, moderate parallelism, private/internal addresses are blocked.

### Input

| Field | Default | Description |
|---|---|---|
| `startUrls` | – | Homepage (or any page) of each site to audit (up to 100) |
| `maxPages` | `200` | Pages to crawl per run (1–50,000) |
| `maxDepth` | `20` | Clicks away from the start URL (0 = start pages only) |
| `checkExternalLinks` | `true` | Check links to other websites |
| `checkResources` | `true` | Check images, scripts, stylesheets, media; detect mixed content |
| `includeSubdomains` | `false` | Crawl subdomains as part of the site |
| `includeUrlPatterns` | – | Regex: only crawl matching pages |
| `excludeUrlPatterns` | – | Regex: never crawl matching pages (still checked as links) |
| `ignoreQueryParameters` | `false` | Treat `?a=1` and `?a=2` as the same page |
| `respectRobotsTxt` | `true` | Skip URLs disallowed by robots.txt |
| `maxConcurrency` | `5` | Parallel requests (1–20) |
| `requestTimeoutSecs` | `20` | Per request |
| `maxLinkChecks` | `10000` | Limit for links that are checked but not crawled |

Example:

```json
{
  "startUrls": [{ "url": "https://www.example.com" }],
  "maxPages": 500,
  "excludeUrlPatterns": ["/tag/", "/page/\\d+"]
}
```

### Output (one record per crawled page)

| Field | Description |
|---|---|
| `url` | Final page URL (after redirects) |
| `requestedUrl` | Linked URL if it redirected, else `null` |
| `ok` | `false` if the page itself is broken (4xx/5xx/network error) |
| `statusCode` | HTTP status |
| `depth`, `foundOn` | Clicks from the start URL, first page linking to it |
| `redirectChain` | Redirect hops (`url`, `statusCode`) or `null` |
| `responseTimeMs`, `htmlBytes`, `contentType` | Response metrics |
| `title`, `titleLength`, `metaDescription`, `metaDescriptionLength` | Meta data |
| `h1`, `h1Count`, `canonical`, `metaRobots`, `noindex`, `lang`, `hasViewport`, `wordCount` | On-page SEO |
| `internalLinkCount`, `externalLinkCount`, `resourceCount` | Link counts |
| `imagesWithoutAlt`, `mixedContentCount` | Accessibility / security |
| `brokenLinkCount`, `brokenLinks[]` | Broken links on this page: `url`, `type` (`internal`, `external`, `resource`), `statusCode`, `error`, `anchorText`, `note` |
| `restrictedLinkCount`, `restrictedLinks[]` | External links whose server refused automated requests (401/403/429/999) – not counted as broken, verify manually |
| `redirectingLinkCount` | Internal links that point to a redirect (update them) |
| `uncheckedLinkCount` | Links skipped (robots.txt, limits, blocked) |
| `issues[]`, `issueCount` | Issue codes, see below |
| `error`, `errorType` | Reason if `ok` is `false` |
| `checkedAt` | ISO timestamp |

**Issue codes:** `page-broken`, `broken-links`, `links-to-redirects`, `title-missing`, `title-too-long` (> 60), `title-too-short` (< 15), `meta-description-missing`, `meta-description-too-long` (> 160), `h1-missing`, `h1-multiple`, `noindex`, `canonical-missing`, `canonical-points-elsewhere`, `images-missing-alt`, `mixed-content`, `lang-missing`, `viewport-missing`, `thin-content` (< 200 words), `slow-response` (> 2 s), `large-html` (> 2 MB).

Dataset views: **Pages**, **Broken links**, **SEO details**. The run summary is in the key-value store record `OUTPUT`.

### Pricing (pay per event)

- **$0.0015 per page audited** (any page of your site that answered – a 404 is a finding)
- **$0.0002 per extra link checked** (external links, images, scripts, stylesheets, pages beyond your limits)
- Free: network errors of your pages, URLs skipped by robots.txt, blocked addresses

Example: 500 pages with 2,000 unique external links and images ≈ $1.15.

### Limits

- Plain HTTP crawler: links that only exist after JavaScript runs are not discovered (most sites render links server-side; for single-page apps use a sitemap URL list as start URLs).
- No logins, cookies or custom headers. Some servers block automated requests (401/403/429/999); those links are marked "verify manually".
- Audit only sites you own or are allowed to audit.

### Use with AI agents / API

Flat, stable camelCase fields; run via the Apify API or MCP server and read the dataset or the `OUTPUT` summary.

# Actor input Schema

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

Homepage (or any page) of each site to audit. The crawler follows links on the same site (www and non-www count as the same site). 'https://' is added if missing.

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

Maximum number of pages to crawl per run (all start URLs together). Links beyond this limit are still checked, but not crawled.

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

How many clicks away from the start URL the crawler goes. 0 = only the start pages.

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

Also check links that point to other websites (one request per unique URL, HEAD with GET fallback).

## `checkResources` (type: `boolean`):

Also check <img>, <script>, stylesheet and media URLs for errors, and detect mixed content (http resources on https pages).

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

Treat subdomains (e.g. blog.example.com) as part of the site and crawl them too.

## `includeUrlPatterns` (type: `array`):

Optional regular expressions. If set, only matching pages are crawled (start URLs always are). Example: '/blog/'.

## `excludeUrlPatterns` (type: `array`):

Regular expressions for pages that should not be crawled (they are still checked as links). Example: '/tag/|/page/\d+'.

## `ignoreQueryParameters` (type: `boolean`):

Treat '/page?a=1' and '/page?a=2' as the same URL. Useful for sites with tracking or filter parameters.

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

Skip URLs disallowed by robots.txt (they are reported as unchecked). Turn off only for sites you own or are allowed to audit.

## `maxConcurrency` (type: `integer`):

Number of simultaneous requests. Keep it low (≤ 5) for small or shared hosting.

## `requestTimeoutSecs` (type: `integer`):

Per request. Slower responses count as broken (network error).

## `maxLinkChecks` (type: `integer`):

Upper limit for checks of links that are not crawled as pages (external links, resources, pages beyond the limits). Protects your budget on link-heavy sites.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://crawlee.dev"
    }
  ],
  "maxPages": 10,
  "maxDepth": 20,
  "checkExternalLinks": true,
  "checkResources": true,
  "includeSubdomains": false,
  "ignoreQueryParameters": false,
  "respectRobotsTxt": true,
  "maxConcurrency": 5,
  "requestTimeoutSecs": 20,
  "maxLinkChecks": 150
}
```

# Actor output Schema

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

One item per processed input in the default dataset (JSON, CSV, Excel via the dataset export).

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

Totals and statistics of the run (OUTPUT record).

# 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://crawlee.dev"
        }
    ],
    "maxPages": 10,
    "maxLinkChecks": 150
};

// Run the Actor and wait for it to finish
const run = await client.actor("cellwright/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://crawlee.dev" }],
    "maxPages": 10,
    "maxLinkChecks": 150,
}

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

```

## MCP server setup

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