# Broken Link Monitor (`vizellie/broken-link-monitor`) Actor

Crawls your own website and finds broken links, broken images and long redirects, with the page each one was found on. Run it weekly in monitor mode to see what broke and what got fixed. $0.0005 per page crawled. General information only.

- **URL**: https://apify.com/vizellie/broken-link-monitor.md
- **Developed by:** [Vi Zellie](https://apify.com/vizellie) (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.50 / 1,000 page crawleds

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 Monitor

Find broken links on your own website. Each broken link is one row: the link, the page it was found on, the link text, the status, and whether it stays on your site.

General information only.

Links that a browser adds with JavaScript are not seen. A link that works in your browser can still fail from a data center.

### What you get

For each public site:

- Broken links. A link is broken when the target returns an error status, the name does not resolve, the connection fails, or the request times out.
- The page the link was found on, and the link text (shortened).
- Whether the link stays on your site or points somewhere else.
- Redirect chains of more than two hops.
- Plain `http` links found on an `https` page.
- In monitor mode, which broken links are new since the last run and which are fixed.
- One summary row per site, even when no link is broken. That row has the site address and the counts only.

Pages that do not answer are not charged. Private addresses, internal names, and URLs on a port other than 80 or 443 are skipped and are not charged. The summary counts every URL you supplied, how many sites were accepted, and how many were skipped. A run whose addresses are all private still finishes, with nothing crawled.

If `robots.txt` answers with a server error, that site is not crawled. If the site does not answer at all, the start page is reported as broken and is not charged.

### Tutorial

1. Paste your own site URLs under **Website URLs**. Use a full URL such as `https://example.com/`. Up to 20 sites. Extra sites beyond that cap are counted and not checked.
2. Set **Pages per site**. The default is 200 and the maximum is 2000. The crawl starts at the URLs you gave and also reads `sitemap.xml` when the site publishes one.
3. Leave **Check links to other sites** on to check each external link once. Turn it off to stay inside your site. Other sites are never crawled.
4. Start the run. Open the dataset. Each site has one summary row, plus one row for each problem link. The `OUTPUT` record has the run counts.
5. To watch the site, turn on **Monitor mode**, keep the store name, and save the input. Schedule the Actor daily or weekly. The next run marks broken links as `new` or `still`, and adds a row with `fixed` when a link from the last run works again. The first monitored run marks every broken link as `new`.

`mailto` and telephone links are skipped. Query strings are not checked or saved.

### Pricing

You pay a small fee when the run starts, plus a fee for each page that answered. A page that does not answer, or a private address, is free. Checking a link is included in the page fee. Rows in the dataset are free.

| Event | Price |
| --- | --- |
| Run start | $0.00005 |
| Page crawled | $0.0005 |

### What is not collected

Page text is not saved. Image alt text is not stored. Email addresses and phone numbers are not saved. Link text that is a contact request is not saved. Query strings and fragments are not saved. Logs name the domain, how many links were broken, and how many pages answered.

### Limits

Up to 20 sites in one run, and up to 2000 pages on each site. There is a limit on how many links one run will check. Links past that limit are counted and not checked. Each request times out, redirects are capped, and response bodies are capped. Only `http` and `https` on ports 80 and 443 are accepted.

# Actor input Schema

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

Your own public site URLs, for example https://example.com/. Up to 20 sites. Private and internal addresses are skipped.

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

How many pages to crawl on each site.

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

When on, each link to another site is checked once. Those sites are not crawled.

## `monitor` (type: `boolean`):

Save this run's broken links and compare them with the previous run. Use the same store name on a schedule.

## `storeName` (type: `string`):

Name of the key-value store that keeps the last broken links. Used only when monitor mode is on.

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

How many requests to run at the same time.

## Actor input object example

```json
{
  "startUrls": [
    "https://example.com/",
    "https://example.com/blog"
  ],
  "maxPages": 200,
  "checkExternal": true,
  "monitor": false,
  "storeName": "broken-link-monitor",
  "concurrency": 4
}
```

# Actor output Schema

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

One summary row per site, plus one row per problem link.

## `linkRows` (type: `string`):

The links dataset view.

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

The OUTPUT record in the default key-value store.

# 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/"
    ],
    "maxPages": 200,
    "checkExternal": true,
    "monitor": false,
    "storeName": "broken-link-monitor",
    "concurrency": 4
};

// Run the Actor and wait for it to finish
const run = await client.actor("vizellie/broken-link-monitor").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/"],
    "maxPages": 200,
    "checkExternal": True,
    "monitor": False,
    "storeName": "broken-link-monitor",
    "concurrency": 4,
}

# Run the Actor and wait for it to finish
run = client.actor("vizellie/broken-link-monitor").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/"
  ],
  "maxPages": 200,
  "checkExternal": true,
  "monitor": false,
  "storeName": "broken-link-monitor",
  "concurrency": 4
}' |
apify call vizellie/broken-link-monitor --silent --output-dataset

```

## MCP server setup

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

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/cTZQHbJcxKoCAc70x/builds/E2PXZ0hgicuyJeyya/openapi.json
