# Broken Link Checker — Find 404s & Dead Links (`gochujang/broken-link-checker`) Actor

Crawl any website to find broken links (404/5xx), redirects, and slow pages. Checks internal and external links. No API key required.

- **URL**: https://apify.com/gochujang/broken-link-checker.md
- **Developed by:** [Hojun Lee](https://apify.com/gochujang) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 result returneds

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/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 broken links (404/410/5xx, timeouts, DNS and TLS errors) on any website, or check a list of links you already have. Every broken link comes with the page it was found on and its anchor text, so you can fix it in minutes. **No API key required.**

### Two modes

- **Crawl a website (`site`)** — start from `url` (or several `startUrls`), crawl internal pages up to `maxPages`, and check every link found: internal pages, external links and, with `checkAssets`, images, scripts and stylesheets. robots.txt is respected.
- **Check a list of links (`list`)** — put the links in `urls` and only those are checked. Nothing is crawled.

Leave `mode` empty and it picks `list` when only `urls` is filled, `site` otherwise.

### What it reports

- **Broken links** — status code, error, `found_on` (first page linking it), `found_on_pages` (up to 10), `found_on_count`, `anchor_text`
- **Redirects** — full `redirect_chain` (each hop with its status) and `final_url`; more than `maxRedirects` hops is reported as `too_many_redirects`. In site mode a redirect is only followed while it stays on the crawled site: a hop to another site is not requested and the row gets the free status `redirected_off_site` with the target in `final_url`. External links found on pages are still checked, one request to the linked URL
- **Slow links** — `response_ms` and `is_slow` (over `slowThresholdMs`)
- **Link type** — `page`, `link`, `image`, `script`, `stylesheet`

Links are checked with HEAD first; servers that refuse HEAD (403/405/501) get a GET, read only up to the headers. Connection errors, timeouts and 429/502/503/504 are retried (`retries`).

### Input

| Field | Type | Description | Default |
|-------|------|-------------|---------|
| `mode` | `site` / `list` | Crawl a site or check a list | auto |
| `url` | string | Website to crawl | — |
| `startUrls` | array | More websites to crawl | — |
| `urls` | array | List mode: the links to check | — |
| `maxPages` | integer | Pages crawled per start URL (1–1000) | 100 |
| `maxLinksToCheck` | integer | Links checked besides crawled pages (1–10000) | 1000 |
| `checkExternalLinks` | boolean | Check links to other domains | `true` |
| `checkAssets` | boolean | Check images, scripts, stylesheets | `false` |
| `onlyReportBroken` | boolean | Write only broken links | `false` |
| `slowThresholdMs` | integer | Slow flag threshold | 3000 |
| `requestTimeoutMs` | integer | Per-request timeout | 10000 |
| `maxRedirects` | integer | Redirect hops followed | 5 |
| `retries` | integer | Retries on transient errors | 1 |
| `respectRobotsTxt` | boolean | Skip URLs robots.txt disallows | `true` |
| `concurrency` | integer | Parallel requests (1–20) | 10 |

Inputs from v1.0 (`checkExternal`, `maxExternalLinks`) still work.

### Output

```json
{
  "url": "https://example.com/old-pricing",
  "status": "broken",
  "status_code": 404,
  "error": "HTTP 404 Not Found",
  "is_broken": true,
  "link_type": "link",
  "is_internal": true,
  "found_on": "https://example.com/blog",
  "found_on_pages": ["https://example.com/blog", "https://example.com/"],
  "found_on_count": 2,
  "anchor_text": "See our pricing",
  "redirect_chain": [],
  "final_url": null,
  "response_ms": 142,
  "is_slow": false,
  "method": "HEAD",
  "checked_at": "2026-11-15T10:00:00+00:00"
}
```

The dataset has two views: **Broken Links** and **All Links**. A run summary (pages crawled, links checked, broken count, URLs skipped by robots.txt, redirects not followed off the site as `skipped_off_site`) is stored as `SUMMARY` in the key-value store. A start URL that robots.txt disallows, or an invalid input URL, gets one free row explaining why.

### Use cases

- **SEO audits** — broken internal links hurt rankings
- **Site maintenance** — fix 404s before Google reindexes
- **Migration checks** — run list mode on your old URLs and verify every redirect chain
- **Pre-launch QA** — broken images, scripts and stylesheets included

### Pricing

Pay-per-event: **$0.005 per result row** written to the dataset. Actor start: $0.001. With `onlyReportBroken`, you pay only for broken links.

### Feedback

If this actor saves you time, a short review helps others find it: [Leave a review on Apify Store](https://apify.com/gochujang/broken-link-checker#reviews)

# Actor input Schema

## `mode` (type: `string`):

site = crawl from the start URL(s) and check every link found. list = check exactly the links in 'Links to check', no crawling. Left empty: list when only 'Links to check' is filled, otherwise site.

## `url` (type: `string`):

The website URL to start crawling from (site mode).

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

Extra websites to crawl in site mode. Each one is crawled up to 'Max pages to crawl'.

## `urls` (type: `array`):

List mode: the exact links to check (HEAD, GET fallback). No crawling.

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

Maximum internal pages to crawl per start URL (site mode).

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

Maximum links checked besides crawled pages: external links, assets, internal links beyond the page limit, or the list-mode links.

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

Also check links to other domains.

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

Also check images, scripts and stylesheets used on crawled pages.

## `onlyReportBroken` (type: `boolean`):

Write only broken links (4xx/5xx, timeouts, DNS/TLS errors) to the dataset. You pay only for rows written.

## `slowThresholdMs` (type: `integer`):

Responses slower than this are flagged is_slow.

## `requestTimeoutMs` (type: `integer`):

Per-request timeout. A link that times out is reported as broken with error 'timeout'.

## `maxRedirects` (type: `integer`):

Redirect hops followed per link; more is reported as 'too_many_redirects'.

## `retries` (type: `integer`):

Retries on connection errors, timeouts and 429/502/503/504.

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

Site mode: do not request internal URLs that robots.txt disallows.

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

Parallel requests.

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

Old name of 'Check external links'; used only when that field is not set.

## `maxExternalLinks` (type: `integer`):

Cap on external links within 'Max links to check'.

## Actor input object example

```json
{
  "url": "https://example.com",
  "urls": [
    "https://example.com/",
    "https://example.com/old-page"
  ],
  "maxPages": 100,
  "maxLinksToCheck": 1000,
  "checkExternalLinks": true,
  "checkAssets": false,
  "onlyReportBroken": false,
  "slowThresholdMs": 3000,
  "requestTimeoutMs": 10000,
  "maxRedirects": 5,
  "retries": 1,
  "respectRobotsTxt": true,
  "concurrency": 10,
  "maxExternalLinks": 1000
}
```

# 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 = {
    "url": "https://example.com"
};

// Run the Actor and wait for it to finish
const run = await client.actor("gochujang/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 = { "url": "https://example.com" }

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

```

## MCP server setup

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