# Ahrefs Scraper - Domain Rating, Traffic Value & Backlinks (`scrapesage/ahrefs-scraper`) Actor

Scrape Ahrefs public Top-Websites data for any domain: Domain Rating, organic search traffic, traffic value in USD, organic keyword count, linking websites with monthly change, top keyword, top country and organic competitors.

- **URL**: https://apify.com/scrapesage/ahrefs-scraper.md
- **Developed by:** [Scrape Sage](https://apify.com/scrapesage) (community)
- **Categories:** SEO tools, Agents, Integrations
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$5.00 / 1,000 website metrics scrapeds

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Ahrefs Scraper - Domain Rating, Traffic Value & Backlinks

Turn any list of domains into a clean SEO table built on **Ahrefs' own numbers** - Domain Rating, organic search traffic, **traffic value in dollars**, organic keyword count, linking websites with monthly change, top keyword, top country and organic competitors.

**No Ahrefs subscription. No API key. No browser.** It reads Ahrefs' free, public **Top Websites** pages (`ahrefs.com/websites/<domain>`, which Ahrefs redirects to `ahrefstop.com`).

### Why this Ahrefs scraper?

| Data | Typical Ahrefs scrapers | This actor |
|---|---|---|
| **Domain Rating (DR)** | ✅ | ✅ |
| Linking websites (referring domains) | partial | ✅ + monthly change |
| Organic search traffic | partial | ✅ + monthly change |
| **Traffic value in USD** | ❌ | ✅ + monthly change |
| Organic keyword count | ❌ | ✅ |
| Global rank + nearest-ranked neighbour | ❌ | ✅ |
| Top keyword with position, country, monthly visits | ❌ | ✅ |
| Top country with visits, change and share | ❌ | ✅ |
| Organic competitors | partial | ✅ |
| **Long-run monthly organic traffic history** (~134 points) | ❌ | ✅ |

**32 fields per domain.** Domains Ahrefs does not track are reported honestly and **never charged**.

#### Pairs with Semrush

Ahrefs and Semrush measure different things, and serious research uses both. **Ahrefs `organicTraffic` is organic search traffic only**; Semrush `visits` counts all visits - so the two numbers differ by design and are not interchangeable. Run this alongside **Semrush Scraper** for Authority Score, bounce rate, paid traffic and AI-assistant referrals.

### Use cases

- **Link-building prospecting** - filter a prospect list by DR and linking websites before outreach.
- **SEO due diligence** - traffic value and DR trend before buying a site.
- **Competitor benchmarking** - DR, traffic and keyword counts side by side.
- **Lead scoring** - qualify agency prospects by real organic traffic, not vanity metrics.
- **Portfolio monitoring** - schedule weekly and watch DR and linking websites move.

### How to use

1. Add your domains under **Domains** (one per line) - or paste/link a list under **Import domains from a file**.
2. Hit **Start**.
3. Export JSON, CSV or Excel, or pull from the API.

### Input

```json
{
    "domains": ["booking.com", "stripe.com"],
    "includeHistory": true,
    "includeKeywords": true,
    "includeCountries": true,
    "includeCompetitors": true,
    "maxItems": 100
}
```

- **domains** - domains to analyse. Full URLs and Ahrefs links are reduced to the registrable domain.
- **startUrls** - paste Ahrefs URLs directly; also accepts the Console's **Link remote text file** option.
- **urlsFromFile** - paste a whole list, or give **one link** to a `.txt`/`.csv`, Google Sheet, Drive share or key-value-store record. Blank lines, `#` comments, CRLF, a UTF-8 BOM, quotes and extra CSV columns all parse; duplicates are analysed once.
- **includeHistory / includeKeywords / includeCountries / includeCompetitors** - toggle sections. All come from one page load, so turning one off makes the record leaner, not cheaper.
- **outputFields** *(pick-list)* - tick exactly the fields you want; the dropdown lists all 32 with plain-English labels and their exact key.
- **maxItems**, **proxyConfiguration** - cap per run, and proxy settings (Apify datacenter by default).

### Output

```json
{
    "type": "website",
    "domain": "booking.com",
    "url": "https://ahrefstop.com/websites/booking.com",
    "domainRating": 93,
    "linkingWebsites": 251800,
    "linkingWebsitesChange": 5300,
    "organicTraffic": 57200000,
    "organicTrafficChange": 5500000,
    "trafficValueUsd": 16200000,
    "trafficValueChangeUsd": 1100000,
    "organicKeywords": 3000000,
    "globalRank": 77,
    "topCountry": "United States",
    "topCountryVisits": 5300000,
    "topCountryShare": 0.093,
    "topKeyword": "booking",
    "topKeywordPosition": 1,
    "topKeywordCountry": "United States",
    "topKeywordVisits": 553000,
    "competitors": ["hotels.com", "expedia.com", "travelweekly.com"],
    "neighbourDomain": "gsmarena.com",
    "neighbourRank": 76,
    "trafficHistory": [1274937, 1820203, 1963552],
    "dataMonth": "July 2026",
    "scrapedAt": "2026-08-09T20:00:00.000Z"
}
```

#### What to expect (field coverage)

Measured over a deliberately varied sample (mega-sites, SaaS, retail, news, a small niche tool):

| Field | Coverage |
|---|---|
| `domainRating`, `linkingWebsites` + change, `topCountry`/`topKeyword` blocks, `competitors`, `trafficHistory` | 100% |
| `organicTraffic`, `trafficValueUsd`, `organicKeywords` + changes | ~91% - Ahrefs shows backlink data but omits traffic tiles for domains it has crawled for links yet has no traffic estimate for |
| `globalRank`, `neighbourDomain`/`neighbourVisits`/`neighbourRank` | ~36% - Ahrefs publishes a numeric global rank only for domains inside its ranked Top-Websites list |

**Numbers are Ahrefs' own, as published.** The page abbreviates them (`251.8K`, `$16.2M`); this actor expands them to integers, so values are exact to the published precision, not to the unit.

### Automate & schedule

Pair with Apify **Schedules** to re-check a prospect or portfolio list weekly and push to Google Sheets, Slack or your warehouse.

### Use with AI assistants (MCP)

Expose this actor to Claude, ChatGPT or any MCP client via the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp) and ask for SEO metrics in plain language.

### Agent-ready: autonomous payments (x402 & Skyfire)

This actor is **agent-ready** — AI agents can discover it, run it, and **pay for it autonomously**, with no Apify account and no human in the loop. It uses [pay-per-event](https://docs.apify.com/platform/actors/publishing/monetize/pay-per-event) pricing and [limited permissions](https://docs.apify.com/platform/actors/development/permissions), so it qualifies for Apify's agentic-payment standards:

- **[x402](https://docs.apify.com/platform/integrations/x402)** — an open, HTTP-native payment protocol. Agents pay per run in USDC on the Base network directly through the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp) — no account, no API key.
- **[Skyfire](https://docs.apify.com/platform/integrations/skyfire)** — agent-to-service payments for fully autonomous AI-agent workflows.

Building an AI agent, MCP tool, or autonomous data pipeline? This scraper is ready to plug in and pay as it goes.

### Pricing

Pay per event: **$0.005 per domain**. Domains Ahrefs does not track cost nothing.

### FAQ

**Does this need an Ahrefs subscription?** No. It reads only the free Top-Websites pages Ahrefs publishes publicly.

**Why is a domain "not tracked"?** Ahrefs publishes a page only for domains in its index. Use the registrable domain (`example.com`, not a sub-path), and expect very small or brand-new sites to be absent.

**Why is the traffic number lower than Semrush's?** Different metrics. Ahrefs reports **organic search traffic**; Semrush's `visits` counts all traffic. Both are estimates from each vendor's own model.

**Can I import a big list?** Yes - paste it, link it, or use the Start-URLs *Link remote text file* option. A file that cannot be read says so and charges nothing.

### Need help?

Open an issue on the actor's **Issues** tab - feature requests genuinely do get built.

***

*Not affiliated with, endorsed by, or sponsored by Ahrefs. "Ahrefs" is a trademark of its respective owner and is used here only to describe what this tool reads. Scrapes public pages only.*

# Actor input Schema

## `domains` (type: `array`):

Domains to analyse, one per line - e.g. <code>booking.com</code>. Full URLs and Ahrefs links are accepted and reduced to the registrable domain. Ahrefs publishes a page only for domains in its index; anything else is reported as <i>not tracked</i> and is never charged.

## `startUrls` (type: `array`):

Paste Ahrefs Top-Websites URLs directly, e.g. <code>https://ahrefs.com/websites/booking.com</code>. <b>Bulk import:</b> use this field's <i>Link remote text file</i> option to load a hosted list - or paste the list into <b>Import domains from a file</b> below.

## `urlsFromFile` (type: `string`):

Bulk-load domains without adding them one at a time. Either <b>paste the whole list</b> (one per line), or give <b>a single link</b> to a public <code>.txt</code>/<code>.csv</code>, a Google Sheet or Drive share link, or an Apify key-value-store record. Blank lines, <code>#</code> comments, CRLF, a UTF-8 BOM, quotes and extra CSV columns all parse; duplicates are analysed once. A file that cannot be read says so and charges nothing.

## `includeHistory` (type: `boolean`):

Add the long-run monthly organic-traffic series Ahrefs charts on the page.

## `includeKeywords` (type: `boolean`):

Add the single keyword sending the domain the most traffic, with its position, country and monthly visits.

## `includeCountries` (type: `boolean`):

Add the country sending the most traffic, with its visits, monthly change and share of total.

## `includeCompetitors` (type: `boolean`):

Add the domains ranking in the top 10 for the same keywords this domain gets most of its traffic from.

## `outputFields` (type: `array`):

Pick the fields you want and every record is trimmed to exactly those - handy for lean CSV/Sheets exports. <b>Nothing to memorise:</b> open the dropdown and tick, or start typing (<code>traffic</code>, <code>rating</code>, <code>keyword</code>) to filter. Leave empty to get every field.

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

Maximum number of domains to analyse in one run.

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

Proxy settings. Ahrefs serves these public pages cleanly to Apify datacenter proxies, which are used by default. If you ever see blocks, switch to Residential.

## Actor input object example

```json
{
  "domains": [
    "booking.com",
    "stripe.com"
  ],
  "includeHistory": true,
  "includeKeywords": true,
  "includeCountries": true,
  "includeCompetitors": true,
  "maxItems": 100,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `results` (type: `string`):

All analysed domains as JSON items in the default dataset.

# 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 = {
    "domains": [
        "booking.com",
        "stripe.com"
    ],
    "urlsFromFile": ""
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapesage/ahrefs-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 = {
    "domains": [
        "booking.com",
        "stripe.com",
    ],
    "urlsFromFile": "",
}

# Run the Actor and wait for it to finish
run = client.actor("scrapesage/ahrefs-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 '{
  "domains": [
    "booking.com",
    "stripe.com"
  ],
  "urlsFromFile": ""
}' |
apify call scrapesage/ahrefs-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scrapesage/ahrefs-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/pzKF6b1oRkwdxJi5M/builds/mC9ghusgaRYidAVkl/openapi.json
