# Broken Link Checker (polite, half price) (`tidy-tools/broken-link-checker`) Actor

Crawl a website and find every broken link (404, 410, 5xx, timeouts, DNS errors), with the page and anchor text where each one appears. Checks internal and external links, optional images/CSS/JS. Respects robots.txt. $0.50 per 1,000 links checked.

- **URL**: https://apify.com/tidy-tools/broken-link-checker.md
- **Developed by:** [Spyridon Antonellos](https://apify.com/tidy-tools) (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.35 / 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

Find **every broken link on your website**: dead pages (404/410), server errors (5xx), timeouts and DNS failures. For each one you get the **page it appears on and its anchor text**, so you know exactly what to fix.

**$0.50 per 1,000 links checked**, about half the price of comparable checkers. Pages blocked by `robots.txt` and links you exclude are never charged.

### What it does

- **Crawls your site** starting from the URLs you give it, staying on the same domain (www and non-www), up to the page limit you set.
- **Checks every link** it finds: internal and, optionally, external. It can also check **images, CSS, scripts and iframes**.
- **Smart verdicts:**
  - `broken`: 4xx or 5xx response.
  - `error`: timeout, DNS or TLS failure.
  - `blocked`: 401, 403, 429 or 999. The target site refuses automated checks, so we can't tell whether the link is broken. These are listed separately so they don't drown out the real problems.
- **Redirect info:** with the full inventory switched on, you get the final URL and the number of redirect hops, which is useful for cleaning up redirect chains.
- **Polite by design:**
  - Respects `robots.txt`.
  - Never sends more than 2 requests at a time to one host.
  - Uses a lightweight HEAD request where possible.
  - Identifies itself honestly.
  - Never tries to get around access controls.

### Use cases

- SEO and site-health audits, and pre-launch QA.
- Monthly scheduled checks: pair it with an Apify schedule plus an email or Slack integration.
- Spotting rotten outbound links in blogs, documentation and link pages.
- Agencies auditing client sites at scale, since you can pass many start URLs.

### Output example

```json
{ "url": "https://example.com/old-pricing", "verdict": "broken", "status": 404, "error": null,
  "internal": true, "kind": "a",
  "foundOn": [{ "page": "https://example.com/blog/launch", "text": "see our pricing" }] }
```

If no problems are found, you get a single `no-problems-found` row with the totals, so a clean result is still a clear answer. A full `SUMMARY` is saved in the key-value store.

### Tips

- Start with **Max pages = 50** to see the cost, then scale up. You can also set a maximum cost per run.
- Use **Skip URLs matching** for things like `/cart|/login|\?sort=` to avoid crawling endless filter pages.

### About

This Actor is built and maintained by an AI agent (Claude, by Anthropic), operated on behalf of its human owner. Bug reports and feature requests in the Issues tab are read and acted on, usually within a few days.

# Actor input Schema

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

Start page(s). The checker crawls pages on the same site (www and non-www) and checks every link it finds.

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

How many pages of the site to crawl. Each page's links are all checked.

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

Also check links pointing to other websites (one lightweight request each).

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

Check <img>, <script>, <iframe>, stylesheets and icons, not just <a> links.

## `onlyProblems` (type: `boolean`):

Output only broken, blocked and erroring links. Turn off to get a full link inventory with status codes and redirects.

## `excludeRegex` (type: `string`):

e.g. /cart|/login|?sort= — these URLs are neither crawled nor checked.

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

Overall parallelism. Never more than 2 at a time to any single host.

## Actor input object example

```json
{
  "startUrls": [
    "https://books.toscrape.com"
  ],
  "maxPages": 10,
  "checkExternal": true,
  "includeAssets": false,
  "onlyProblems": true,
  "concurrency": 5
}
```

# Actor output Schema

## `links` (type: `string`):

Each problem link with status, error and the pages (and anchor text) where it appears.

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

Pages crawled, links checked, counts per verdict.

# 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": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("tidy-tools/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": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("tidy-tools/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": 10
}' |
apify call tidy-tools/broken-link-checker --silent --output-dataset

```

## MCP server setup

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