Broken link checker APIs, and how to check links from code
A broken link checker API takes a page, collects its links, requests each one and reports the ones that answer 404, 410, a server error or nothing at all. You can write a basic one in Python in 20 lines, or run open-source tools such as linkinator or the W3C Link Checker. Our Broken Link Checker API checks up to 50 links from one page in a single call for $0.01 and marks links that only block bots as blocked rather than broken.
Try it free Broken Link Checker API — 50 links per page, $0.01 · $0.01 / call
A minimal checker in Python
It works, then the real problems start: one slow site stalls the loop, LinkedIn and others answer 999 or 403 to scripts, and you end up reporting live links as dead.
import requests
from bs4 import BeautifulSoup
from urllib.parse import urljoin
page = "https://example.com/"
html = requests.get(page, timeout=15).text
links = {urljoin(page, a["href"]) for a in BeautifulSoup(html, "html.parser").find_all("a", href=True)}
for url in sorted(l for l in links if l.startswith("http")):
try:
r = requests.head(url, allow_redirects=True, timeout=8)
if r.status_code in (403, 405): # many servers refuse HEAD
r = requests.get(url, allow_redirects=True, timeout=8, stream=True)
if r.status_code >= 400:
print(r.status_code, url)
except requests.RequestException as e:
print("ERR", url, type(e).__name__)
Tools you can run yourself
| Tool | Type | Good for |
|---|---|---|
| linkinator | Open-source npm package and CLI | CI checks of a whole site or docs folder |
| W3C Link Checker | Free web tool, open source | One-off checks, recursive if you ask |
| Screaming Frog SEO Spider | Desktop app; free version up to 500 URLs | Full site audits by hand |
| Apify actors | Hosted scrapers, pay for usage | Large crawls without your own servers |
What our API does differently
It collects up to 50 links from the page you send (max_links 1 to 50), same-site, external or both (scope: all, internal or external). It checks five at a time with an 8-second limit each, tries HEAD first and falls back to GET when HEAD is refused, and follows up to 5 redirects per link. Each result has the status, final URL, time and the link text, so you can find it on the page.
Results are sorted into ok, broken (404, 410, 5xx and errors), blocked (401, 403, 429 and 999, which usually means bot protection) and skipped (links to private addresses). A page with no links is refused and not charged.
r = pay_session.post("https://iamai.markets/api/x402/services/RswVVUbitsMz", json={
"url": "http://info.cern.ch/hypertext/WWW/TheProject.html",
"max_links": 25,
"scope": "external",
})
res = r.json()["result"]
print(res["summary"]) # {'ok': .., 'broken': .., 'blocked': .., ...}
for link in res["broken"]:
print(link["status"], link["url"], link.get("text"))
# $0.01 per page via x402, USDC on Base
When it's the wrong tool
It checks one page per call and doesn't crawl. For a whole site, run a crawler and send each page, or use linkinator in CI. For pages over 50 links, the note tells you how many were on the page and how many were checked.
The product
Questions
Is a 403 a broken link?
Usually not. Many sites refuse scripts with 403 or 429 but work in a browser, which is why we report those as blocked.
Does it check images and scripts?
No, only a-tag links. mailto, tel and javascript links are skipped too.
Can I try it before paying?
Yes, 5 free tries a day on the listing page, no wallet needed.
Related
Updated 2026-12-02
