# Broken Link Checker & Redirect Chain Auditor (`mediapro-tools/broken-link-redirect-auditor`) Actor

Crawl a site or check a URL list for broken links, redirect chains and HTTPS downgrades. Input: startUrls, urls. Output (JSON/CSV): one row per item with url, issue, status, finalUrl, redirectHops, httpsDowngrade, internal, foundOn, foundOnCount, anchorText.

- **URL**: https://apify.com/mediapro-tools/broken-link-redirect-auditor.md
- **Developed by:** [Jeremy Yarbrough](https://apify.com/mediapro-tools) (community)
- **Categories:** SEO tools, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.80 / 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.

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 & Redirect Chain Auditor

Crawl a site (or check a URL list) and find broken links (4xx/5xx), DNS/timeout errors, redirect chains, loops and HTTPS downgrades, with the page each link was found on. Respects robots.txt.

### Input

| Field | Type | Notes |
|---|---|---|
| `startUrls` | array | Start pages. Internal pages are crawled (same host, robots.txt respected) and every link/image/script found is checked. |
| `urls` | array | Optional plain list of URLs to check status/redirects for, e.g. an old sitemap or backlink list. |
| `maxPages` | integer | Per run, across all start URLs. |
| `maxLinks` | integer | Cap on unique links checked. |
| `checkExternal` | boolean | Also check links to other domains (HEAD request, no crawl). |
| `onlyProblems` | boolean | Skip links that return 2xx with no redirect. |
| `maxConcurrency` | integer | Parallel checks. Each host is limited to ~4 requests/second. |
| `timeoutSecs` | integer | Per request. |

### Example input

```json
{
 "startUrls": [
  {
   "url": "https://books.toscrape.com/"
  }
 ],
 "maxPages": 5,
 "maxLinks": 80,
 "urls": [
  "http://github.com",
  "https://httpbin.org/status/404",
  "https://httpbin.org/redirect/3"
 ]
}
```

### Output

One dataset item per result. Main columns: `url`, `issue`, `status`, `finalUrl`, `redirectHops`, `httpsDowngrade`, `error`, `internal`, `foundOn`, `foundOnCount`, `anchorText`. A `RUN_SUMMARY` record is saved to the default key-value store.

### Pricing

Pay per event: Link checked $0.0005.

### Scheduling / monitoring

Create a Schedule (daily/weekly) with monitor mode on, and connect a webhook or Slack/email integration to get only the changes.

### Fair use

Uses public files/official APIs only, no login. Only audit sites and data you are entitled to; do not use output for spam.

### Related tools

- [On-Page SEO Audit & Metadata Extractor (bulk + crawl)](https://apify.com/mediapro-tools/seo-onpage-audit-metadata)
- [Sitemap URL Extractor & New Page Monitor](https://apify.com/mediapro-tools/sitemap-url-change-monitor)
- [Bulk PageSpeed Insights & Core Web Vitals Checker](https://apify.com/mediapro-tools/pagespeed-crux-bulk)
- [Bulk Website Screenshot (full page, mobile & desktop)](https://apify.com/mediapro-tools/bulk-website-screenshot)

**Pipeline recipe:** sitemap-monitor → link-auditor → seo-page-audit: list every URL, find broken links and redirects, then audit titles, meta and schema.

# Actor input Schema

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

Start pages. Internal pages are crawled (same host, robots.txt respected) and every link/image/script found is checked.

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

Optional plain list of URLs to check status/redirects for, e.g. an old sitemap or backlink list.

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

Per run, across all start URLs.

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

Cap on unique links checked.

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

Also check links to other domains (HEAD request, no crawl).

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

Skip links that return 2xx with no redirect.

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

Parallel checks. Each host is limited to ~4 requests/second.

## `timeoutSecs` (type: `integer`):

Per request.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://books.toscrape.com/"
    }
  ],
  "maxPages": 50,
  "maxLinks": 2000,
  "checkExternal": true,
  "onlyProblems": false,
  "maxConcurrency": 8,
  "timeoutSecs": 15
}
```

# Actor output Schema

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

All result records in the default dataset (table view: overview).

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

Counts and stats for this run (JSON).

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

// Run the Actor and wait for it to finish
const run = await client.actor("mediapro-tools/broken-link-redirect-auditor").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://books.toscrape.com/" }] }

# Run the Actor and wait for it to finish
run = client.actor("mediapro-tools/broken-link-redirect-auditor").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://books.toscrape.com/"
    }
  ]
}' |
apify call mediapro-tools/broken-link-redirect-auditor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,mediapro-tools/broken-link-redirect-auditor"
        }
    }
}
```

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/wRLR15Cb2sbYcGF0F/builds/0jhzBLsPoN5xFYiFH/openapi.json
