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 - backlinks_one_per_domain
Contains the backlinks and details of the referring pages, such as anchor and page title. Includes only one backlink with the highest ahrefs_rank per referring domain.
Each request to backlinks_one_per_domain costs 10 rows.
Each result in the response costs 2 rows.
Using 'where' costs 5 rows.
Using 'having' costs 5 rows.
• refpages
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_rating | int | − | + | Domain Rating of the referring domain. |
ahrefs_top | int | − | + | Ahrefs Rank of the target 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). |
language | string | + | + | Language of the referring page (ISO 639-1). |
title | string | + | + | Title of the referring page. |
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. |
http_code | int | + | + | The HTTP code for the Link URL. |
url_from_first_seen | date | + | + | Least recent date when the Ahrefs crawler was able to visit the referring page with backlink. |
total_backlinks | int | − | + | Total number of backlinks from this referring domain. |
Examples
Request
https://apiv2.ahrefs.com?from=backlinks_one_per_domain&target=ahrefs.com&mode=domain&limit=2&order_by=total_backlinks%3Adesc&output=json
Response
{ "refpages": [ { "url_to": "http://ahrefs.com/serp-checker", "url_from": "http://www.aletenky.cz/", "ahrefs_rank": 21, "domain_rating": 48, "ip_from": "46.51.179.2", "links_internal": 0, "links_external": 1, "page_size": 199, "encoding": "raw", "language": "", "title": "301 Moved Permanently", "first_seen": "2013-10-26T20:19:04Z", "last_visited": "2013-11-08T19:25:22Z", "prev_visited": "2013-11-07T06:58:50Z", "original": true, "link_type": "redirect", "redirect": 301, "nofollow": false, "alt": "", "anchor": "", "text_pre": "", "text_post": "", "http_code": 200, "url_from_first_seen": "2013-11-07T06:58:50Z", "total_backlinks": 12 }, { "url_to": "http://ahrefs.com/", "url_from": "http://oni.toypark.in/", "ahrefs_rank": 16, "domain_rating": 62, "ip_from": "183.177.133.249", "links_internal": 84, "links_external": 18, "page_size": 9529, "encoding": "utf8", "language": "ja", "title": "SEOの鬼サーチ ブログ版 | ディレクトリに登録されているサイトギャラリー", "first_seen": "2013-10-27T20:42:14Z", "last_visited": "2013-11-05T21:55:32Z", "prev_visited": "2013-11-01T17:09:20Z", "original": true, "link_type": "href", "redirect": 0, "nofollow": false, "alt": "", "anchor": "ahrefs", "text_pre": "", "text_post": "", "http_code": 200, "url_from_first_seen": "2013-11-07T06:58:50Z", "total_backlinks": 4 } ] }