Ahrefs API v2 has been deprecated
This documentation is for the legacy version of our API (v2), which was discontinued on March 1st, 2024. Existing API v2 integration apps are not affected and continue to work as before, but new submissions are no longer accepted.
To switch to API v3, please contact our Enterprise team. Read about API v3.
Documentation - broken_links
Contains the broken links and details of the referring pages, such as anchor and page title.
Each request to broken_links costs 1 row.
Each result in the response costs 1 row.
Using 'where' costs 5 rows.
Using 'having' costs 5 rows.
• links
Column | Type | Where | Having | Description |
---|---|---|---|---|
url_from | string | + | + | URL of the page where the backlink is found. |
url_to | string | + | + | URL of the page the backlink is pointing to. |
ahrefs_rank | int | + | + | URL Rating of the referring page. |
domain_to_rating | int | − | + | Domain Rating for destination domain. |
ip_from | string | + | + | IP address of the referring page. |
links_internal | int | + | + | Number of internal links found in the referring page. |
links_external | int | + | + | Number of external links found in the referring page. |
page_size | int | + | + | Size of the referring page, in bytes. |
encoding | string | + | + | Character encoding of the referring page, for example "utf8" or "iso-8859-1" (Latin-1). |
title | string | + | + | Title of the referring page. |
language | string | + | + | Language of the referring page (ISO 639-1). |
first_seen | date | + | + | Least recent date when the Ahrefs crawler was able to visit the backlink. |
last_visited | date | + | + | Most recent date when the Ahrefs crawler was able to visit the backlink. |
prev_visited | date | + | + | Second to the most recent date when the Ahrefs crawler was able to visit the backlink. |
original | boolean | + | + | Indicates whether the backlink was present on the referring page when the Ahrefs crawler first visited it. |
link_type | string | + | + | Either "href", "redirect", "frame", "form", "canonical", "rss", or "alternate". |
redirect | int | + | + | For redirected links, the Redirect Code (3XX), zero otherwise. |
nofollow | boolean | + | + | Indicates whether the backlink is NoFollow. |
alt | string | + | + | Alternative text of the image backlink, if exists. |
anchor | string | + | + | Anchor text of the backlink. |
text_pre | string | + | + | Snippet before the anchor text. |
text_post | string | + | + | Snippet after the anchor text. |
broken_at | date | + | + | The date when the Ahrefs crawler thinks the link became broken. |
http_code | int | + | + | The HTTP code for the Link URL. |
error | string | + | + | The string indicating the nature of error (currently only "dns"). |
domain_to_ahrefs_top | int | − | + | Ahrefs rank of the external domain. |
url_from_first_seen | date | + | + | Least recent date when the Ahrefs crawler was able to visit the referring page with backlink. |
Examples
Request
https://apiv2.ahrefs.com?from=broken_links&target=ahrefs.com&mode=subdomains&limit=2&order_by=broken_at%3Adesc&output=json
Response
{ "links": [ { "url_from":"https://blog.ahrefs.com/google-still-pushes-nofollow-failed-anti-comment-spam-instrument/", "ahrefs_rank":13, "domain_to_rating":0, "ip_from":"208.43.234.10", "links_internal":44, "links_external":18, "page_size":15308, "encoding":"utf8", "title":"Why Google Still Pushes nofollow the Failed Anti-Comment Spam Instrument - Ahrefs Blog", "language":"en", "url_to":"http://cranberry.com/blog/post/nofollow-press-releases", "first_seen":"2015-02-23T11:14:01Z", "last_visited":"2015-03-17T23:56:18Z", "prev_visited":"2015-02-23T11:14:01Z", "original":true, "redirect":0, "alt":"", "anchor":"press releases", "text_pre":"2.", "text_post":"", "link_type":"href", "nofollow":false, "broken_at":"2015-04-26T02:24:03Z", "http_code":404, "error":"", "domain_to_ahrefs_top":11, "url_from_first_seen": "2013-11-07T06:58:50Z" }, { "url_from":"https://blog.ahrefs.com/weekly-seo-roundup-on-ahrefs-blog-week-of-6-mar-2015/", "ahrefs_rank":18, "domain_to_rating":0, "ip_from":"208.43.234.10", "links_internal":46, "links_external":31, "page_size":16036, "encoding":"utf8", "title":"Weekly SEO Roundup on Ahrefs Blog: Week of 6 Mar 2015 - Ahrefs Blog", "language":"en", "url_to":"http://www.stateofdigital.com/biggest-social-media-updates-2015/", "first_seen":"2015-03-23T00:53:47Z", "last_visited":"2015-03-27T13:52:36Z", "prev_visited":"2015-03-23T00:53:47Z", "original":true, "redirect":0, "alt":"", "anchor":"Biggest Social Media Updates of 2015 To Date", "text_pre":"", "text_post":"", "link_type":"href", "nofollow":false, "broken_at":"2015-04-25T15:47:00Z", "http_code":404, "error":"", "domain_to_ahrefs_top":12, "url_from_first_seen": "2013-11-07T06:58:50Z" } ] }