# Broken Link Checker – 404s, Redirects & Bulk URL Status (`lepidata/link-checker`) Actor

Check web pages or a URL list for broken links, 404s, redirect chains and HTTP status codes. Honors robots.txt.

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

## Pricing

from $0.90 / 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, Redirects & Bulk URL Status

Give it web pages, a sitemap, or a plain list of URLs and get **one row per link**: the HTTP status, whether it is ok, redirected or broken, where it redirected to, and how long it took. Useful for site maintenance, SEO audits, documentation and blog upkeep.

### What you get

| Field | Meaning |
|---|---|
| `type` | `link` for a checked link; free status rows otherwise |
| `url`, `foundOn`, `tag` | The link, the page or sitemap it was on, and where it came from (a, img, script, link, iframe, source, sitemap) |
| `status`, `result` | Final HTTP status; `ok`, `redirect`, `broken`, `forbidden` or `rate-limited` |
| `method` | `HEAD`, or `GET` when the server does not support HEAD |
| `finalUrl`, `redirects` | Where redirects ended, and how many |
| `ms`, `error` | Time taken; network error code (DNS_FAILED, TIMEOUT, TLS_FAILED...) when there was no answer |

### Pricing

**$0.90 per 1,000 links checked** (pay per event `link`), the same price on every Apify plan. Free: pages that could not be read, links skipped because robots.txt disallows them or the address is private, and limit rows. Set a maximum charge per run and the Actor stops cleanly when it is reached.

**Free-plan limit:** Apify Free-plan accounts can scan up to 5 pages and get up to 100 checked links per run. Paid Apify plans get full results.

### How it works

- Each link is checked with a **HEAD request** (no page download). Only when a server answers 405 or 501 is a GET sent, and its body is discarded after 64 KB.
- **robots.txt is respected** for every host, including Crawl-delay. Disallowed links are reported as free `link-skipped` rows and not requested.
- **At least 1 second between requests to the same host.** HTTP 429/503 answers are retried at most twice, waiting as long as `Retry-After` asks (up to 30 s); a host that keeps answering 429 is not contacted again in the run.
- Per-run cap: up to 20,000 unique links (`maxLinks`, default 1,000) and 500 pages.
- Only public http(s) addresses; private and internal addresses are refused.
- Pages are not crawled: only the pages you list are read. `urls` checks a URL list directly (bulk HTTP status), without reading pages. `sitemapUrls` checks every URL listed in sitemap.xml files (sitemap indexes followed, up to 20 sitemap files per run; .xml.gz not supported).

Lepidata is not affiliated with, endorsed by or sponsored by Lychee, Apify or the owners of any website checked.

# Actor input Schema

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

Web pages whose links should be checked (URLs or domains). Each page is read once; links on it are checked. Up to 500 pages per run.

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

Optional. URLs whose HTTP status should be checked directly, without reading any page.

## `sitemapUrls` (type: `array`):

Optional. sitemap.xml URLs: every URL listed is checked. Sitemap index files are followed (up to 20 sitemap files per run). Same robots.txt rules and link caps apply.

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

Stop collecting links after this many unique links. Each checked link is billed.

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

Off = only check links on the same host as the page.

## Actor input object example

```json
{
  "startUrls": [
    "https://example.com"
  ],
  "maxLinks": 1000,
  "checkExternal": true
}
```

# Actor output Schema

## `items` (type: `string`):

All rows from this run.

# 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://example.com"
    ]
};

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

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

```

## MCP server setup

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