All scrapers

Business data

Ahrefs Scraper

ahrefs.com

99.1% Success rate
2.7s Avg response
Cloudflare Turnstile Protection
1,139 calls Measured over

Ahrefs offers a set of free SEO tools on its website for signed-out visitors, and each of them wants a Cloudflare Turnstile token before it answers. A dedicated plugin endpoint runs seven of those tools and returns their answers already parsed. Pick the tool with tool. authority returns the Domain Rating, backlinks, referring domains and the dofollow share of each; backlinks adds the top backlinks with the linking page, its title, the anchor, the text around the link and the linking site's DR; traffic returns the monthly organic traffic and its value in USD, the traffic history, top pages, top countries and top keywords, worldwide or for one country; broken-links returns broken backlinks pointing at the site and broken links on its pages. These take a domain or URL as target, and mode sets the scope: the domain with its subdomains, the domain alone, everything under a URL prefix or one exact URL. The keyword tools take keyword and a country: keyword-difficulty returns the KD score from 0 to 100, how many referring domains a page needs to rank in the top 10 and the SERP it was read from; keywords returns Google keyword ideas and question ideas with their difficulty and search-volume bucket; serp returns the top Google results with DR, UR, backlinks, referring domains, traffic and keywords for each organic result, plus the AI overview, shopping, local, news and question blocks. The figures are Ahrefs' own, as its free tools show them; no Ahrefs account, login or API key is involved.

What you can extract

  • Domain Rating (DR), total backlinks and referring domains, with the dofollow share of each
  • Top backlinks: linking URL, target URL, page title, anchor, the text around the link and the linking site's DR
  • Monthly organic traffic and its value in USD, traffic history, top pages, top countries and top keywords, worldwide or for one country
  • Broken backlinks pointing at a site and broken outgoing links on its pages
  • Keyword difficulty (KD 0-100) and the referring domains a page needs to rank in the top 10
  • Google keyword ideas and question ideas with difficulty and search-volume buckets
  • The Google SERP for a keyword with DR, UR, backlinks, referring domains, traffic, value and keywords per organic result, plus AI overview, shopping, local, news and question blocks
  • Target scope: a domain with or without its subdomains, a URL prefix or one exact URL

Dedicated endpoints

/seo/ahrefs

Ahrefs' free SEO tools

Seven of Ahrefs' free tools behind one endpoint, chosen with tool. authority, backlinks, traffic and broken-links take target (a domain or URL) and mode (subdomains, domain, prefix or exact): domainRating, backlinks, referringDomains, dofollowBacklinksPercent and dofollowReferringDomainsPercent; backlinks adds topBacklinks (urlFrom, urlTo, title, anchor, textBefore, textAfter, domainRating); traffic returns organicTraffic, trafficValueUsd, trafficHistory, topPages, topCountries and topKeywords, with country for one market and protocol; broken-links returns inbound and outbound broken links. keyword-difficulty, keywords and serp take keyword and country (default us): difficulty, referringDomainsToRank and results; ideas and questionIdeas with difficulty and volume, plus totalIdeas and totalQuestionIdeas (questions=false leaves the questions out); results with metrics for each organic result and the other SERP blocks. Every answer carries tool, query, source and found.

How to scrape it

curl -X POST \
  -H "X-ScrapeUnblocker-Key: $SU_API_KEY" \
  "https://api.scrapeunblocker.com/seo/ahrefs?tool=backlinks&target=github.com"
import requests

resp = requests.post(
    "https://api.scrapeunblocker.com/seo/ahrefs",
    headers={"X-ScrapeUnblocker-Key": SU_API_KEY},
    params={"tool": "backlinks", "target": "github.com"},
)
print(resp.text)
import { ScrapeUnblockerClient } from 'scrapeunblocker';

const su = new ScrapeUnblockerClient({ apiKey: process.env.SU_API_KEY });

const backlinks = await su.ahrefs('backlinks', { target: 'github.com' });
const ideas = await su.ahrefs('keywords', { keyword: 'running shoes', country: 'us' });
console.log(backlinks);
console.log(ideas);

Requests are POST and take their parameters in the query string. Browser rendering always happens - there is no flag to enable.

Example response

{
  "tool": "backlinks",
  "query": { "target": "github.com", "mode": "subdomains" },
  "source": "https://ahrefs.com/backlink-checker",
  "found": true,
  "domainRating": 97.0,
  "backlinks": 4800493963,
  "referringDomains": 2387109,
  "dofollowBacklinksPercent": 91,
  "dofollowReferringDomainsPercent": 95,
  "topBacklinks": [
    {
      "urlFrom": "https://openai.com/index/chatgpt/",
      "urlTo": "https://github.com/openai",
      "title": "Introducing ChatGPT | OpenAI",
      "anchor": "(opens in a new window)",
      "textBefore": "",
      "textAfter": "",
      "domainRating": 93,
      "redirectChain": [],
      "inRenderedHtml": true,
      "inRawHtml": true
    },
    {
      "urlFrom": "https://duckduckgo.com/",
      "urlTo": "https://github.com/duckduckgo/tracker-blocklists",
      "title": "DuckDuckGo - Protection. Privacy. Peace of mind.",
      "anchor": "list of trackers",
      "textBefore": "more , which all help cover different tracking angles. Our",
      "textAfter": "is open source, along with the list of exceptions we",
      "domainRating": 91,
      "redirectChain": [],
      "inRenderedHtml": true,
      "inRawHtml": false
    }
  ]
}

Read the API docs

Frequently asked questions

Is it legal to scrape Ahrefs?

Collecting the figures Ahrefs shows in its free, public SEO tools is lawful in many jurisdictions, but the rules depend on your country, the data you collect and how you use it. The numbers are Ahrefs' own estimates and index data, not the site's analytics, so present them as Ahrefs figures. ScrapeUnblocker returns what the free tools show; what you collect and how you use it is your decision.

How do I scrape Ahrefs without getting blocked?

Ahrefs' free tools answer only a request that carries a valid Cloudflare Turnstile token, which a browser earns by passing Cloudflare's check, and Ahrefs refuses some addresses outright. The /seo/ahrefs plugin gets that token in a real Chrome, shares it between calls while it is still valid, and sends each tool request to Ahrefs' own free-tool API from an ISP exit, moving to a fresh exit when one is refused. Most calls need no browser at all; a call that has to get a new token first usually takes under ten seconds longer. In ScrapeUnblocker's benchmark it returned data on 99.1% of 1,139 calls spread over all seven tools, with a different domain or keyword on every call, about 2.7s per call.

Which Ahrefs tools does the plugin cover?

Seven of Ahrefs' free tools: the Website Authority Checker (tool=authority), Backlink Checker (backlinks), Traffic Checker (traffic), Broken Link Checker (broken-links), Keyword Difficulty Checker (keyword-difficulty), Keyword Generator (keywords) and SERP Checker (serp). Ahrefs' page names and shorthands such as dr, kd or keyword-generator work too. The free tools show a summary rather than the full report a paid Ahrefs account sees: the top backlinks, pages, countries and keywords rather than every one, and keyword volumes as buckets such as 10K+, with volumeMin as a number.

Do I need an Ahrefs account or API key?

No. Ahrefs' API needs an Ahrefs subscription and an API key; the plugin needs neither, and no login: send the tool with a domain or keyword and your ScrapeUnblocker key, and get the answer back as JSON. You get the same figures Ahrefs shows signed-out visitors in its free tools. The keyword tools search the Google market you pass as country (us by default), and traffic is worldwide unless you pass one.

What happens when Ahrefs has no data for a domain or keyword?

A domain or keyword Ahrefs has no data for comes back with found: false and the tool's fields empty or null, so you can tell it apart from a failure, which returns an error status: 400 when Ahrefs rejects the target or keyword, 502 when it could not be reached, which is worth a retry. query echoes the resolved target, mode, keyword and country, so a batch of calls can be matched back to its inputs.

How much does it cost to scrape Ahrefs?

Each call is one request: one tool, one domain or keyword. 1 request = 1 credit, EUR 1.00 per 1,000 on pay as you go, down to about EUR 0.55 per 1,000 on the Ultimate plan. Blocks and timeouts are not billed, and the free trial includes 500 requests with no card.

Related scrapers

Ahrefs and other names and marks of ahrefs.com belong to their owner and are used here only to identify the website this API works with. ScrapeUnblocker is an independent service, not affiliated with, endorsed by or sponsored by the owner of ahrefs.com.

Start scraping this site today

Free tier included. No credit card required to test it.