# Backlink Checker and Keyword Research API - Ahrefs SEO Data (`nabeelbaghoor/backlink-checker-keyword-research-api`) Actor

Backlink checker and keyword research with the Ahrefs API v3: Domain Rating, backlinks, referring domains, anchors, organic keywords, top pages, competitors, keyword volume, KD, CPC, keyword ideas and SERP overview. Bring your own Ahrefs API key.

- **URL**: https://apify.com/nabeelbaghoor/backlink-checker-keyword-research-api.md
- **Developed by:** [Nabeel Hassan](https://apify.com/nabeelbaghoor) (community)
- **Categories:** SEO tools, Marketing, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 domain overview returneds

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

## Backlink Checker and Keyword Research API - Ahrefs SEO Data

Check backlinks, Domain Rating and organic traffic for any site, and research keyword volume, difficulty and SERPs, with your own Ahrefs API key, exported to clean JSON, CSV or Excel rows.

Works with the Ahrefs API v3 (api.ahrefs.com/v3), the API behind Ahrefs Site Explorer, Keywords Explorer and SERP Overview. Paste a list of domains, URLs or keywords and get deduplicated rows you can schedule, diff over time, or feed into SEO dashboards, link building prospect lists, content planning, client reports, spreadsheets and AI agents. Bring your own API key.

BYOK, not live-tested: every route, parameter, filter field and column comes from Ahrefs' official OpenAPI document (docs.ahrefs.com/openapi.json), and the route paths were confirmed against the live host, but the actor has not been run with a real Ahrefs key.

### What it does

- **Domain overview**: Domain Rating (DR), Ahrefs Rank, live and all-time backlinks, live and all-time referring domains, organic keywords (all and top 3), organic traffic and traffic value, paid keywords and traffic, in one row per domain or URL.
- **Domain Rating only**: bulk DR and Ahrefs Rank checker at the lowest Ahrefs unit cost (one request per target).
- **Backlinks**: referring page URL, target URL, title, anchor text, source DR and UR, dofollow or nofollow, link type, first seen, lost date and lost reason. Filter by minimum DR, dofollow only, live or lost links, and grouping (similar links, one per domain, all).
- **Referring domains**: each linking domain with its DR, organic traffic, links to the target, dofollow links, new and lost links, spam flag and first and last seen dates.
- **Anchors**: anchor text distribution with referring domains, referring pages and links per anchor.
- **Organic keywords**: the keywords a site or URL ranks for in a country, with position, ranking URL, search volume, Keyword Difficulty (KD), traffic, CPC and SERP features. Filter by volume, KD and position.
- **Top pages**: a site's pages by organic traffic, with traffic value, ranking keywords, top keyword and its position, referring domains and UR.
- **Organic competitors**: domains competing for the same keywords, with common keywords, share, DR, traffic and traffic value.
- **Keyword metrics (Keywords Explorer overview)**: search volume, global volume, KD, CPC, clicks per search, traffic potential, parent topic, search intent and SERP features for up to 1,000 keywords per run.
- **Keyword ideas**: matching terms (all or questions, any order or exact phrase) and related terms (also rank for, also talk about) from seed keywords.
- **SERP overview**: the top results for each keyword with position, URL, title, result type, DR, UR, backlinks, referring domains, traffic and traffic value.
- **API units and limits**: your key's unit allowance, usage and reset date, free of Ahrefs units and free of actor charges.
- **Pay only for results**: refused and empty lookups are recorded as a free row that says why, never charged.

### How to get an API key

Ahrefs API v3 is included on eligible paid Ahrefs plans (see ahrefs.com/pricing); other paid plans can still run the free test queries. A workspace owner or admin creates a key in Account settings, API keys (app.ahrefs.com/account/api-keys), and can cap the monthly units each key may spend there. Paste the key into the API key field, or set the `DATA_API_KEY` environment secret. This actor never ships a shared key.

### Ahrefs API units: what a run costs you

Ahrefs bills your workspace in API units, separately from this actor. Each request costs max(50, rows x per-row units), where the per-row cost is the sum of the selected and filtered columns (1, 5 or 10 units each). Units are not refunded. The columns this actor selects cost, per row:

| Mode | Units per row | Requests |
| --- | --- | --- |
| Domain overview | 50 minimum per request | 3 per target (about 150 units) |
| Domain Rating | 50 minimum | 1 per target |
| Backlinks | 12 | 1 per target |
| Referring domains | 19 | 1 per target |
| Anchors | 11 | 1 per target |
| Organic keywords | 37 | 1 per target |
| Top pages | 31 | 1 per target |
| Organic competitors | 27 | 1 per target |
| Keyword metrics | 58 | 1 per 100 keywords |
| Matching terms, related terms | 55 | 1 per run |
| SERP overview | 35 | 1 per keyword |
| API units and limits | free | 1 |

Filters add their column's cost when it is not already selected. `maxResults` is sent as the Ahrefs `limit`, so the default of 100 rows keeps a backlinks run near 1,200 units. The run log reports the units Ahrefs says it consumed. Free test queries spend nothing: targets `ahrefs.com`, `yep.com` or `firehose.com`, or the single keywords `ahrefs`, `yep` or `firehose` (Ahrefs caps those at 100 rows).

### Input

| Field | Used by | What it does |
| --- | --- | --- |
| `mode` | all | `domainOverview`, `domainRating`, `backlinks`, `referringDomains`, `anchors`, `organicKeywords`, `topPages`, `organicCompetitors`, `keywordMetrics`, `matchingTerms`, `relatedTerms`, `serpOverview` or `apiUnits` |
| `targets` | Site Explorer modes | Domains or URLs, one per line |
| `keywords` | Keywords Explorer, SERP overview | Keywords, one per line |
| `country` | most modes | Two-letter market (default `us`); `all` for Site Explorer metrics across countries |
| `scope` | Site Explorer modes | `subdomains` (default), `domain`, `prefix` or `exact` |
| `protocol` | Site Explorer modes | `both` (default), `http` or `https` |
| `date` | overview, DR, keyword and page reports | Report date, YYYY-MM-DD (default today, UTC) |
| `volumeMode` | overview, keyword and page reports | `monthly` (default) or `average` |
| `linkHistory`, `historySince` | link reports | `live` (default), `all_time`, or `since` a date |
| `backlinkGrouping` | backlinks | `similar_links` (default), `1_per_domain` or `all` |
| `dofollowOnly`, `minDomainRating` | backlinks, referring domains | Dofollow only, minimum DR |
| `minVolume`, `maxDifficulty` | organic keywords, keyword ideas | Minimum search volume, maximum KD |
| `maxPosition` | organic keywords | Best position at or above this |
| `matchingTermsType`, `matchMode` | matching terms | `all` or `questions`; `terms` or `phrase` |
| `relatedTermsType`, `relatedViewFor` | related terms | `all`, `also_rank_for` or `also_talk_about`; `top_10` or `top_100` |
| `topPositions` | SERP overview | Top organic positions per keyword |
| `maxResults` | all | Row ceiling for the run and the Ahrefs limit (default 100) |
| `requestsPerMinute` | all | Pacing (default 50; Ahrefs allows 60 a minute) |
| `apiKey` | all | Your Ahrefs API v3 key, stored as a secret |

Each endpoint only receives the parameters its documentation lists; an input that belongs to another mode is left off with a warning. Reports are ordered so the row cap keeps the strongest rows: backlinks and referring domains by DR, anchors by referring domains, keywords and pages by traffic, competitors by common keywords, keyword ideas by volume.

Example input, the strongest dofollow backlinks to a blog:

```json
{
    "mode": "backlinks",
    "targets": ["ahrefs.com/blog"],
    "scope": "prefix",
    "linkHistory": "live",
    "backlinkGrouping": "1_per_domain",
    "dofollowOnly": true,
    "minDomainRating": 50,
    "maxResults": 100
}
```

### Example output

An organic keyword row. The common columns come first; every selected Ahrefs field follows unchanged (money in USD cents, as Ahrefs returns it), with USD copies in `cpcUsd` and `trafficValueUsd`.

```json
{
    "mode": "organicKeywords",
    "recordType": "organicKeyword",
    "identifier": "ahrefs.com",
    "found": true,
    "domain": null,
    "url": "https://ahrefs.com/backlink-checker",
    "keyword": "backlink checker",
    "domainRating": null,
    "position": 1,
    "volume": 45000,
    "traffic": 21000,
    "difficulty": 87,
    "cpcUsd": 4.5,
    "trafficValueUsd": null,
    "note": null,
    "best_position": 1,
    "best_position_url": "https://ahrefs.com/backlink-checker",
    "keyword_difficulty": 87,
    "sum_traffic": 21000,
    "cpc": 450,
    "serp_features": ["sitelink", "question"],
    "keyword_country": "us",
    "last_update": "2026-10-11T07:15:00Z"
}
```

The numbers above are illustrative. A domain overview row adds `ahrefs_rank`, `backlinks_live`, `backlinks_all_time`, `refdomains_live`, `refdomains_all_time`, `org_keywords`, `org_keywords_1_3`, `org_traffic`, `org_cost`, `paid_keywords`, `paid_pages`, `paid_traffic` and `paid_cost`. Backlink rows carry `url_from`, `url_to`, `title`, `anchor`, `domain_rating_source`, `url_rating_source`, `is_dofollow`, `is_lost`, `first_seen_link`, `last_seen`, `lost_reason` and `link_type`.

### FAQ

#### What is the Ahrefs API?

Ahrefs API v3 is the official REST API of Ahrefs, the SEO platform known for its backlink index and Domain Rating. It gives programmatic access to Site Explorer (backlinks, referring domains, organic keywords, top pages, competitors), Keywords Explorer (keyword metrics and ideas) and SERP Overview, billed in API units on eligible paid plans.

#### Do I need my own Ahrefs API key?

Yes. Every request goes out with your own key as a bearer token. A run without a key ends straight away with a message that says where to create one, and nothing is charged.

#### How do I check backlinks for a domain in bulk?

Use the backlinks mode for individual links, the referring domains mode for one row per linking domain, or the domain overview mode for backlink and referring domain totals. Put the domains or URLs in `targets`, one per line. Set `minDomainRating` and `dofollowOnly` to keep only strong, followed links.

#### How do I check Domain Rating (DR) for a list of sites?

Use the Domain Rating mode. Each domain is one Ahrefs request of 50 units and one row with its DR (0 to 100) and Ahrefs Rank.

#### How do I get keyword search volume, KD and CPC from Ahrefs?

Use the keyword metrics mode, put up to 1,000 keywords in `keywords` and pick the country. Each row has volume, global volume, Keyword Difficulty, CPC, clicks per search, traffic potential, parent topic and intent.

#### How do I find keyword ideas?

Use matching terms for ideas that contain your seed words (or only questions), and related terms for keywords the top-ranking pages also rank for or talk about. Filter by minimum volume and maximum KD.

#### What does it cost?

Pay per result: 0.02 USD per domain overview, 0.005 USD per Domain Rating, 0.005 USD per backlink, referring domain or anchor, and 0.01 USD per organic keyword, top page, competitor, keyword metrics row, keyword idea or SERP position. Refused and empty lookups and the API units mode are never charged. Ahrefs bills your API units separately, as shown above.

#### What happens if my key is wrong or out of units?

A rejected key (HTTP 401), a plan without API access (HTTP 403) or a key or workspace with no units left ends the run cleanly with a status message that explains what to change. Rate limits (HTTP 429) are waited out and retried. A target or keyword Ahrefs refuses becomes a free row with Ahrefs' own words, and the run moves on.

### Pricing

| Event | Price | Charged for |
| --- | --- | --- |
| `domain-overview` | 0.02 USD | Each domain overview (DR, backlinks, referring domains, traffic) |
| `domain-rating` | 0.005 USD | Each Domain Rating lookup |
| `link-record` | 0.005 USD | Each backlink, referring domain or anchor |
| `search-record` | 0.01 USD | Each organic keyword, top page, competitor, keyword, keyword idea or SERP position |

### Keyword map

backlink checker, backlink checker API, Ahrefs API, Ahrefs API v3, Domain Rating checker, DR checker, bulk DR check, referring domains, anchor text, keyword research API, keyword search volume, keyword difficulty, CPC, keyword ideas, SERP API, SERP overview, organic keywords, top pages, competitor analysis, SEO API, link building, traffic estimation.

### Terms and data use

Use of the Ahrefs API is governed by the Ahrefs Terms of Service (ahrefs.com/terms). They grant a limited, non-transferable, non-sublicensable licence for your internal business operations, allow automated access only through the Ahrefs API, and forbid reselling or commercially redistributing Ahrefs data without written consent and using it to build a competing product. Run this actor with your own key, for your own organisation's SEO work, and keep the results for that use. This actor is not affiliated with or endorsed by Ahrefs.

# Actor input Schema

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

Domain overview returns Domain Rating, Ahrefs Rank, live and all-time backlinks and referring domains, organic keywords, organic traffic and traffic value for each target in one row (3 Ahrefs requests per target). Domain Rating is the cheap single-call version. Backlinks, Referring domains and Anchors are the Site Explorer link reports. Organic keywords, Top pages and Organic competitors are the Site Explorer search reports. Keyword metrics, Matching terms and Related terms are Keywords Explorer. SERP overview returns the top results for each keyword. API units and limits shows your key's unit allowance and usage, free.

## `targets` (type: `array`):

Site Explorer modes. Domains such as ahrefs.com or URLs such as https://ahrefs.com/blog/, one per line. Each target is one lookup. ahrefs.com, yep.com and firehose.com are free test targets that spend no API units.

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

Keywords Explorer and SERP overview modes. One keyword per line. Keyword metrics reads them in batches of 100; matching and related terms use them together as seeds; SERP overview makes one request per keyword. "ahrefs", "yep" and "firehose" alone are free test keywords.

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

The search market. Organic competitors, Keywords Explorer and SERP overview need one country; Domain overview, Organic keywords and Top pages also accept All countries.

## `scope` (type: `string`):

Site Explorer modes except Domain Rating. How much of the target to analyse, as in the Ahrefs web app.

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

Site Explorer modes except Domain Rating. Which protocol of the target to analyse.

## `date` (type: `string`):

Domain overview, Domain Rating, Organic keywords, Top pages and Organic competitors. The date to report metrics on (YYYY-MM-DD). Leave empty for today (UTC).

## `volumeMode` (type: `string`):

Domain overview, Organic keywords, Top pages and Organic competitors. Affects volume, traffic and traffic value.

## `linkHistory` (type: `string`):

Backlinks, Referring domains and Anchors. Live shows links that exist now; the others add lost links.

## `historySince` (type: `string`):

Link history "since a date" only. Include links lost on or after this date (YYYY-MM-DD).

## `backlinkGrouping` (type: `string`):

Backlinks only. How Ahrefs groups the backlinks it returns.

## `dofollowOnly` (type: `boolean`):

Backlinks and Referring domains. Only dofollow backlinks, or only referring domains with at least one dofollow link to the target.

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

Backlinks and Referring domains. Only links from domains with at least this Domain Rating (0 to 100).

## `minVolume` (type: `integer`):

Organic keywords, Matching terms and Related terms. Only keywords with at least this monthly search volume.

## `maxDifficulty` (type: `integer`):

Organic keywords, Matching terms and Related terms. Only keywords with a Keyword Difficulty (KD) of at most this (0 to 100).

## `maxPosition` (type: `integer`):

Organic keywords only. Only keywords where the target ranks at this position or better, such as 10 for page one.

## `matchingTermsType` (type: `string`):

Matching terms only. All ideas, or only ideas phrased as questions.

## `matchMode` (type: `string`):

Matching terms only. Ideas contain the seed words in any order, or as the exact phrase.

## `relatedTermsType` (type: `string`):

Related terms only. Keywords the top pages also rank for, terms they also mention, or both.

## `relatedViewFor` (type: `string`):

Related terms only. Which ranking pages the related keywords are drawn from.

## `topPositions` (type: `integer`):

SERP overview only. How many top organic positions to return per keyword. Leave empty for all available.

## `maxResults` (type: `integer`):

The most rows this run returns and charges for. It is also the limit sent to Ahrefs, so it caps the API units spent: a report costs max(50, rows x per-row units).

## `requestsPerMinute` (type: `integer`):

Pacing. Ahrefs allows 60 requests a minute by default and answers 429 above it, which the actor waits out and retries.

## `apiKey` (type: `string`):

Your own Ahrefs API v3 key, created by a workspace owner or admin in Account settings, API keys (app.ahrefs.com/account/api-keys). Stored as a secret and sent only in the Authorization header; it is never logged. You can instead set the DATA_API_KEY environment secret.

## Actor input object example

```json
{
  "mode": "domainOverview",
  "targets": [
    "ahrefs.com"
  ],
  "country": "us",
  "scope": "subdomains",
  "protocol": "both",
  "volumeMode": "monthly",
  "linkHistory": "live",
  "backlinkGrouping": "similar_links",
  "dofollowOnly": false,
  "matchingTermsType": "all",
  "matchMode": "terms",
  "relatedTermsType": "all",
  "relatedViewFor": "top_10",
  "maxResults": 100,
  "requestsPerMinute": 50
}
```

# Actor output Schema

## `records` (type: `string`):

One row per domain, backlink, referring domain, anchor, keyword, page, competitor or SERP position.

# 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 = {
    "targets": [
        "ahrefs.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("nabeelbaghoor/backlink-checker-keyword-research-api").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 = { "targets": ["ahrefs.com"] }

# Run the Actor and wait for it to finish
run = client.actor("nabeelbaghoor/backlink-checker-keyword-research-api").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 '{
  "targets": [
    "ahrefs.com"
  ]
}' |
apify call nabeelbaghoor/backlink-checker-keyword-research-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,nabeelbaghoor/backlink-checker-keyword-research-api"
        }
    }
}
```

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/OEwsXwMbSjukwjXUD/builds/4DLqPcx1wPTZpZBM0/openapi.json
