# Ahrefs Scraper — Backlinks, Traffic, Keywords & AI Visibility (`trakk/ahrefs-seo-scraper`) Actor

Scrape Ahrefs for any domain or keyword — no login. The extras other scrapers skip: AI Search Visibility (citations in ChatGPT & Google AI Overviews / AI Mode), SERP rank tracking, broken links & sitemaps. Plus DR, backlinks, traffic & value, keyword difficulty & ideas. Filters, CSV/JSON.

- **URL**: https://apify.com/trakk/ahrefs-seo-scraper.md
- **Developed by:** [Kelopr\_bk](https://apify.com/trakk) (community)
- **Categories:** SEO tools, Marketing, Business
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.70 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## 📊 Ahrefs Scraper — SEO metrics for any domain or keyword

Pull **Domain Rating, backlinks, organic traffic, traffic value, keyword difficulty, keyword ideas, rankings, sitemaps and AI-search visibility** for any website or keyword — as clean rows you can export in one click. No Ahrefs login, no subscription.

Most "Ahrefs" scrapers stop at the three numbers on the overview widget. This one keeps going — the dollar value of that traffic, where it comes from, who ranks for a keyword, and whether a brand is being cited in AI answers:

| | Typical scraper | 🎯 This Actor |
|---|---|---|
| Domain Rating | `91` | **`91`** |
| Backlinks | `26,733,774` | **`26,733,774`** |
| Organic traffic | `3,674,687` | **`3,674,687`** |
| Traffic value | — | **`$543,595,000` / mo** |
| Top pages / countries / keywords | — | **✅ where the traffic comes from** |
| Keyword difficulty | `82` | **`82`** + backlinks needed to rank |
| Rank position | — | **`#1` for "backlink checker"** |
| AI-search visibility | — | **`513,831` citations, by model** |
| Sitemap | — | **936 URLs, full list** |

***

### ⚡ Quick start

1. Click **Try for free**.
2. Add **domains** (`ahrefs.com`), **keywords** (`seo tools`), or both.
3. Pick a **country** and toggle on what you need.
4. Hit **Start** ▶️

Results appear live in the **Output** tab and export to CSV, Excel, JSON or XML.

**Simplest possible input:**

```json
{
  "urls": ["ahrefs.com", "semrush.com", "moz.com"]
}
```

**Keyword research with rank tracking:**

```json
{
  "keywords": ["seo tools", "backlink checker"],
  "country": "us",
  "rankDomain": "ahrefs.com",
  "withQuestionIdeas": true
}
```

**Find only strong sites (nothing weak is charged):**

```json
{
  "urls": ["site-a.com", "site-b.com", "site-c.com"],
  "minDomainRating": 60,
  "minOrganicTraffic": 100000
}
```

**The world's top websites in a category:**

```json
{
  "includeTopWebsites": true,
  "topWebsitesCategory": "Finance",
  "topWebsitesLimit": 50
}
```

***

### 📥 What you can feed it

| You give it | You get back |
|---|---|
| 🌐 A domain or URL | Domain Rating, backlinks, referring domains, organic traffic & its dollar value |
| 🔑 A keyword | Difficulty, SERP overview, keyword ideas, and where a domain ranks for it |
| 🏷️ A brand + keywords | How that brand shows up in AI answers (AI Overviews, AI Mode, AI assistants) |
| 🗺️ A domain + sitemap on | Every URL in the site's sitemap |
| 🔗 A domain + backlinks on | Its top backlinks and its broken inbound links |
| 🌍 Nothing — just Top Websites on | The world's top sites by organic traffic, with category & monthly change |

Mix domains and keywords freely in the same run. Results split into clean, per-type tables so no column is ever half-empty.

***

### 🏆 What makes it different

**1. The number that matters — traffic value.** 💰 `trafficValueMonthlyUsd` tells you what a site's organic traffic would cost in ads. A DR score is vanity; this is the money.

**2. Where the traffic actually comes from.** 📄 `topPages`, 🌍 `topCountries` and 🔑 `topKeywords` — the pages, markets and search terms driving a site, not just the total.

**3. AI-search visibility.** 🤖 See how often a brand is cited in AI answers — `aiTotalCitations` broken down **by model**, plus AI Overviews and AI Mode mentions, top topics and top cited domains. This is where SEO is heading, and almost nobody ships it.

**4. Real rank positions.** 📍 Give a domain and get its exact position for each keyword — computed from the live SERP, with the full top-10 so you see who you're up against, even when you don't rank.

**5. Filters that save you money.** 🎯 `minDomainRating`, `minOrganicTraffic`, `minTrafficValueUsd`, `maxKeywordDifficulty` and more. Rows that don't match are dropped **before** they're counted — you only pay for the ones you asked for.

**6. Clean data, no junk.** Duplicates, empty rows and filtered rows are removed on the fly and never charged. Every field that comes back is real — blanks are left out, never guessed.

**7. One Actor, seven tools.** Website authority, traffic, backlinks, broken links, keyword difficulty, keyword ideas, rank tracking, sitemaps and AI visibility — all in one run.

***

### 📤 Example output

**Website row** (trimmed):

```json
{
  "type": "url",
  "target": "ahrefs.com",
  "mode": "subdomains",
  "domainRating": 91,
  "backlinks": 26733774,
  "refDomains": 117162,
  "dofollowBacklinks": 60,
  "organicTrafficMonthly": 3674687,
  "trafficValueMonthlyUsd": 543595000,
  "topPages": [{ "url": "https://ahrefs.com/backlink-checker", "traffic": 614024, "sharePct": 39.5 }],
  "topCountries": [{ "country": "us", "sharePct": 48.2 }],
  "topKeywords": [{ "keyword": "backlink checker", "position": 1, "traffic": 642000 }],
  "sitemapUrlCount": 936
}
```

**Keyword row** (trimmed):

```json
{
  "type": "keyword",
  "target": "backlink checker",
  "country": "us",
  "keywordDifficulty": 91,
  "backlinksNeededToRank": 835,
  "serpTopCount": 10,
  "keywordIdeaCount": 20,
  "rankDomain": "ahrefs.com",
  "rankPosition": 1,
  "rankFound": true,
  "aiTotalCitations": 513831,
  "aiCitationsByModel": [{ "model": "Gemini", "citations": 27271 }, { "model": "Copilot", "citations": 29304 }],
  "aiOverviewMentions": 223676,
  "aiModeMentions": 12941
}
```

***

### 🗂️ Output tables

Websites and keywords have different fields, so the results come as **two clean tables** — open the one you need and every column is filled:

- 🌐 **Websites** — one row per domain (DR, backlinks, traffic, traffic value, sitemap size)
- 🔑 **Keywords** — one row per keyword (difficulty, rank, AI visibility, idea count)
- 🌍 **Top Websites** — the global ranking (when that toggle is on)
- 📋 **Everything** — all rows together, for a single export

And four detail datasets, populated on demand:

- 🔗 **Backlinks** — top backlinks per domain (source, anchor, DR, link type)
- 🚫 **Broken links** — broken inbound links pointing at a domain
- 💡 **Keyword ideas** — suggestions per seed keyword, with volume & difficulty labels
- 🗺️ **Sitemap** — every URL in a site's sitemap

***

### 🎛️ What you can pull

| Toggle | You get |
|---|---|
| **Website authority** | Domain Rating, Ahrefs Rank, backlinks, referring domains, dofollow split |
| **Traffic** | Organic traffic, its dollar value, monthly history, top pages / countries / keywords |
| **Sitemap** | Total URL count + the full URL list |
| **Backlinks** | Top backlinks: source URL, anchor, title, DR, link type |
| **Broken links** | Broken inbound links pointing at the domain |
| **Keyword difficulty** | KD score, backlinks needed to rank, SERP overview |
| **Keyword ideas** | Related keywords with volume & difficulty labels, plus question keywords |
| **Rank position** | Where a domain you name ranks for each keyword |
| **AI visibility** | Citations in AI answers, broken down by model |
| **AI Overviews / AI Mode** | Brand mentions, top topics and top cited domains |
| **Top websites** | The global top 100 sites by organic traffic — rank, domain, category, monthly traffic & change (filter by category) |

***

### 🎯 Filters

Narrow the run to exactly the rows you want — and pay only for those:

- 🌐 **Websites** — `minDomainRating`, `maxDomainRating`, `minBacklinks`, `minRefDomains`, `minOrganicTraffic`, `minTrafficValueUsd`
- 🔑 **Keywords** — `minKeywordDifficulty`, `maxKeywordDifficulty`

Anything that doesn't match is dropped before it's counted. The run summary tells you how many were filtered and by which rule.

***

### 🍳 Recipes

**🔍 Size up a list of competitors**
Drop in their domains. Sort the Websites table by `trafficValueMonthlyUsd` to see who's really winning.

**💸 Find undervalued keywords**
Keywords + `maxKeywordDifficulty: 30`. Easy to rank for, and you never pay for the hard ones.

**📍 Track your rankings**
Keywords + `rankDomain: "yoursite.com"`. Schedule it weekly to watch positions move.

**🤖 Measure your AI-search footprint**
Your brand + your money keywords + AI toggles on. See where you're cited in AI answers — and where competitors are cited and you aren't.

**🔗 Audit a site's link profile**
One domain with backlinks and broken links on. Find your best links and the broken ones worth reclaiming.

**🌍 See who leads a market**
Turn on Top Websites and set a category (e.g. Finance). Get the top sites in that space by organic traffic, ranked, with month-over-month change.

**🏆 Qualify prospects fast**
A big list of domains + `minDomainRating: 50` + `minOrganicTraffic: 50000`. Only the sites worth your time come back.

***

### ❓ FAQ

**Do I need an Ahrefs account?**
No. 🔓 Everything here comes from public data — no login, no subscription, no seat.

**Which countries can I get traffic and keyword data for?**
Any 2-letter country code (`us`, `gb`, `de`, `in`…).

**Do I pay for duplicates, empty or filtered rows?**
No — only real, saved rows count. Duplicates and blanks are removed automatically, and filtered rows are dropped before billing.

**Why is a keyword's rank position sometimes empty?**
Because the domain genuinely isn't in that keyword's top results — `rankFound` tells you honestly, and `rankSerp` still shows who *does* rank. Nothing is invented.

**Why do my numbers differ slightly from Ahrefs?**
The figures update continuously; a number read a minute later will differ by a hair. What's guaranteed is that each value is the exact one reported at the moment it was read.

**How much does it cost?**
You pay per row saved, and it's all-in — no separate charge for starting the run. Set a maximum on the run if you want a hard ceiling.

**Can I schedule it or call it from code?**
Yes ⏰ — use Apify's scheduler, or the Apify API and JavaScript/Python clients like any other Actor. Every run is independent and reproducible.

**What if I make a mistake in the input?**
You get a plain-English note on the run's status line, and the run stops in seconds without burning your budget.

# Actor input Schema

## `urls` (type: `array`):

Domains or URLs to analyse (e.g. ahrefs.com). Returns Domain Rating, backlinks, referring domains and traffic.

## `keywords` (type: `array`):

Keywords to analyse — difficulty, SERP overview and keyword ideas.

## `mode` (type: `string`):

Scope for the domain/URL tools.

## `country` (type: `string`):

Two-letter country code for traffic & keyword data (e.g. us, gb, de).

## `protocol` (type: `string`):

Which protocol to count traffic for (site-level tools).

## `searchEngine` (type: `string`):

Search engine for keyword ideas.

## `includeWebsiteAuthority` (type: `boolean`):

Domain Rating, backlinks, referring domains (per URL).

## `includeTraffic` (type: `boolean`):

Estimated monthly organic traffic and its history.

## `includeBacklinks` (type: `boolean`):

Save the top backlinks per URL to a separate Backlinks dataset.

## `includeBrokenLinks` (type: `boolean`):

Save broken inbound links per URL to a separate Broken Links dataset.

## `includeKeywordIdeas` (type: `boolean`):

Keyword suggestions (with volume & difficulty labels) for each keyword.

## `withQuestionIdeas` (type: `boolean`):

Also return question-style keyword ideas.

## `enrichKeywordIdeas` (type: `boolean`):

The free ideas tool only labels difficulty (Low/High). Turn this on to fetch a real numeric keyword difficulty for the top ideas of each seed. Adds extra calls per seed (one shared captcha token covers them).

## `maxEnrichedIdeas` (type: `integer`):

How many top ideas per seed keyword get a real numeric difficulty when the option above is on.

## `includeKeywordDifficulty` (type: `boolean`):

SERP overview and top-10 competitiveness per keyword.

## `minDomainRating` (type: `integer`):

Keep only domains with DR at or above this (0–100).

## `maxDomainRating` (type: `integer`):

Keep only domains with DR at or below this (0–100).

## `minBacklinks` (type: `integer`):

Keep only domains with at least this many backlinks.

## `minRefDomains` (type: `integer`):

Keep only domains with at least this many referring domains.

## `minOrganicTraffic` (type: `integer`):

Keep only domains with at least this much monthly organic traffic.

## `minTrafficValueUsd` (type: `integer`):

Keep only domains whose monthly organic traffic value is at least this.

## `minKeywordDifficulty` (type: `integer`):

Keep only keywords with KD at or above this (0–100).

## `maxKeywordDifficulty` (type: `integer`):

Keep only keywords with KD at or below this (0–100).

## `rankDomain` (type: `string`):

Optional: a domain to check the ranking position of, for each keyword.

## `brand` (type: `string`):

Brand name to measure in AI answers. Required for the AI visibility/overviews/mode tools.

## `includeAiVisibility` (type: `boolean`):

Per keyword: total AI citations and a breakdown by ChatGPT, Gemini, Perplexity, Copilot, etc. Needs a brand.

## `includeAiOverviews` (type: `boolean`):

Per keyword: Google AI Overviews mentions, top topics and cited domains. Needs a brand.

## `includeAiMode` (type: `boolean`):

Per keyword: Google AI Mode mentions, top topics and cited domains. Needs a brand.

## `includeSitemap` (type: `boolean`):

Per URL: crawl a sitemap and save its URLs to a separate Sitemap dataset.

## `maxSitemapUrls` (type: `integer`):

Upper bound on sitemap URLs exported (and billed) per domain. Only applies when the Sitemap add-on is on. Raise it to export very large sitemaps in full.

## `includeTopWebsites` (type: `boolean`):

Scrape Ahrefs' global Top Websites ranking — the top sites by estimated organic search traffic, with category and monthly change. Works on its own, no urls or keywords needed.

## `topWebsitesCategory` (type: `string`):

Only return Top Websites in this category. Leave as 'All categories' for the full ranking.

## `topWebsitesLimit` (type: `integer`):

How many top websites to return (max 100 — the ranking page lists the top 100).

## `maxItems` (type: `integer`):

Global cap on primary rows saved. Duplicates and empty rows are never counted or charged.

## `maxConcurrency` (type: `integer`):

How many targets to process in parallel.

## `maxRetries` (type: `integer`):

Retry budget per request for a temporary source or captcha error.

## `proxyConfiguration` (type: `object`):

Proxy configuration.

## Actor input object example

```json
{
  "urls": [
    "ahrefs.com"
  ],
  "mode": "subdomains",
  "country": "us",
  "protocol": "both",
  "searchEngine": "Google",
  "includeWebsiteAuthority": true,
  "includeTraffic": true,
  "includeBacklinks": false,
  "includeBrokenLinks": false,
  "includeKeywordIdeas": true,
  "withQuestionIdeas": false,
  "enrichKeywordIdeas": false,
  "maxEnrichedIdeas": 10,
  "includeKeywordDifficulty": true,
  "includeAiVisibility": false,
  "includeAiOverviews": false,
  "includeAiMode": false,
  "includeSitemap": false,
  "maxSitemapUrls": 1000,
  "includeTopWebsites": false,
  "topWebsitesCategory": "",
  "topWebsitesLimit": 100,
  "maxItems": 1000,
  "maxConcurrency": 5,
  "maxRetries": 4,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "urls": [
        "ahrefs.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("trakk/ahrefs-seo-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "urls": ["ahrefs.com"] }

# Run the Actor and wait for it to finish
run = client.actor("trakk/ahrefs-seo-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "urls": [
    "ahrefs.com"
  ]
}' |
apify call trakk/ahrefs-seo-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,trakk/ahrefs-seo-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/SRblhXdnuutyZ8PIv/builds/tKuz6NfewvqiZaqOW/openapi.json
