Docs/API

Broken Links

The broken links endpoint returns all broken links detected on a monitor with the broken links check enabled. To configure the broken links check settings (whitelist URLs, link types, etc.), use the monitors endpoint.

You'll need a monitor ID for this endpoint.

Example request:

$ OHDEAR_TOKEN="your API token"
$ curl https://ohdear.app/api/broken-links/1 \
    -H "Authorization: Bearer $OHDEAR_TOKEN" \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json'

All endpoints below follow the same authentication pattern.

GET /api/broken-links/{monitorId}

Returns all broken links from the latest completed crawl run.

Here's what the response looks like:

{
  "data": [
    {
      "status_code": 404,
      "crawled_url": "https://example.com/broken",
      "relative_crawled_url": "/broken",
      "found_on_url": "https://example.com",
      "relative_found_on_url": "/",
      "link_text": "Click here",
      "internal": true
    }
  ]
}
  • status_code: the HTTP status code returned by the broken link
  • crawled_url: the full URL of the broken link
  • relative_crawled_url: the relative path of the broken link
  • found_on_url: the page where the broken link was found
  • relative_found_on_url: the relative path of the page containing the broken link
  • link_text: the anchor text or alt text of the link
  • internal: whether the broken link points to the same domain (true) or an external site (false)
Was this page helpful?

Feel free to reach out via [email protected] or on X via @OhDearApp if you have any other questions. We'd love to help!