metrics - Ahrefs API

Ahrefs API v2 will stop working on March 1st, 2024

This documentation is for the legacy version of our API (v2), which has been discontinued. All active API v2 subscriptions will stop working on March 1st, 2024. Existing Integration apps will continue to work as before until further notice, but new submissions are no longer accepted.

To switch from API v2 to v3, please contact our Enterprise team. Read about API v3.

Documentation - metrics

Contains metrics about the target, such as total number of backlinks, referring pages, etc., that are similar to the Site Explorer Overview page with the addition of stats for total number of HTML pages, internal and external links.

Each request to metrics costs 1 row.
Each result in the response costs 0 rows.

metrics

Column Type Where Having Description
backlinks int − − Number of external backlinks found on the referring pages that link to the target.
refpages int − − Number of external web pages containing at least one backlink that links to the target.
pages int − − Number of unique pages visited by the Ahrefs crawler on the target.
valid_pages int − − Number of unique pages with non 5xx HTTP code, visited by the Ahrefs crawler on the target.
text int − − Number of backlinks that use anchor texts.
image int − − Number of backlinks that use image as an anchor.
nofollow int − − Number of NoFollow backlinks that link to the target.
dofollow int − − Number of DoFollow backlinks that link to the target.
redirect int − − Number of redirects found that forward to the target.
canonical int − − Number of canonical backlinks that link to the target.
gov int − − Number of backlinks of all types (including images and NoFollow) found on web pages on governmental domains that link to the target.
edu int − − Number of backlinks of all types (including images and NoFollow) found on web pages on educational domains that link to the target.
rss int − + Number of RSS external links from the target.
alternate int − + Number of alternate external links from the target.
html_pages int − − Number of HTML pages the target link has.
links_internal int − − Number of internal links found in the target.
links_external int − − Number of external links found in the target.

Examples



Request

https://apiv2.ahrefs.com?from=metrics&target=ahrefs.com&mode=domain&output=json

Response

{
  "metrics":{
    "backlinks":636,
    "refpages":518,
    "pages":1,
    "text":501,
    "valid_pages":500,
    "image":11,
    "nofollow":131,
    "dofollow":370,
    "redirect":135,
    "canonical":12,
    "gov":0,
    "edu":0,
    "rss":0,
    "alternate":0,
    "html_pages":0,
    "links_internal":0,
    "links_external":0
  }
}