Data APIs ยท Ahrefs
Ahrefs data APIs for AI agents
morigraph has 5 Ahrefs data APIs that Claude, ChatGPT, Cursor, Codex or your own code can call, including backlinks, domain overview, keyword difficulty and keyword ideas. You need no Ahrefs developer account or API key, only one morigraph connection. Calls cost from 0.109 credits, about $10.9 for 1,000 calls, paid from one balance.
- APIs
- 5
- Price
- 0.109 to 0.115 credits a call
- Call it from
- MCP, command line and HTTP API
- Needs
- One morigraph connection. No Ahrefs account or API key
Three ways to call it
Every data API is run by one tool, data_api, with the API's id and its arguments. The example is Ahrefs Backlinks.
In your assistant (MCP). Connect once, then ask in plain words
claude mcp add --transport http --scope user morigraph https://morigraph.com/mcp
Use morigraph's Ahrefs Backlinks data API with {"mode":"exact","url":"ahrefs.com"} and summarise what comes back.From a terminal or script (CLI)
npx @morigraph/cli@latest login
morigraph call data_api --json-args '{"api":"ahrefs.backlinks","input":{"mode":"exact","url":"ahrefs.com"}}'From your own code (HTTP API)
curl https://api.morigraph.com/v1/tools/data_api \
-H "Authorization: Bearer $MORIGRAPH_API_KEY" \
-H "Content-Type: application/json" \
-d '{"api":"ahrefs.backlinks","input":{"mode":"exact","url":"ahrefs.com"}}'5 Ahrefs data APIs
| API | Id | Price |
|---|---|---|
| Ahrefs Backlinks | ahrefs.backlinks | 0.109 credits a call |
| Ahrefs Domain Overview | ahrefs.overview | 0.109 credits a call |
| Ahrefs Keyword Difficulty | ahrefs.keywords | 0.109 credits a call |
| Ahrefs Keyword Ideas | ahrefs.keyword_ideas | 0.109 credits a call |
| Ahrefs Traffic Overview | ahrefs.traffic | 0.115 credits a call |
Ahrefs Backlinks
Get the referring pages linking to a domain or URL, each with the source page, anchor text, linking domain rating, and page title.
| Argument | Type | Required | What it is |
|---|---|---|---|
mode | exact | subdomains | no | Match scope: "exact" for the given URL only, or "subdomains" to include the domain and its subdomains. Default "subdomains". |
url | string | yes | The domain or page URL to find backlinks for (e.g. "ahrefs.com"). |
Returns anchor contextAfter contextBefore domainRating title urlFrom urlTo
The call
data_api({"api":"ahrefs.backlinks","input":{"mode":"exact","url":"ahrefs.com"}})Ahrefs Domain Overview
Get an SEO authority overview for any domain or URL: Domain Rating, total backlinks, and referring domains - as normalized JSON. For the keywords a domain ranks for, use seo.ranked_keywords.
| Argument | Type | Required | What it is |
|---|---|---|---|
mode | exact | subdomains | no | Analysis scope: subdomains covers the whole domain, exact matches only the given URL. Default "subdomains". |
url | string | yes | The domain or page URL to analyze (e.g. ahrefs.com). |
Returns backlinks dofollowBacklinksPct dofollowReferringDomainsPct domain domainRating mode referringDomains
The call
data_api({"api":"ahrefs.overview","input":{"mode":"subdomains","url":"ahrefs.com"}})Ahrefs Keyword Difficulty
Get the Ahrefs keyword-difficulty metrics for any search term: the difficulty score (0-100) and the number of referring domains a page needs to rank in the top 10 - as normalized JSON.
| Argument | Type | Required | What it is |
|---|---|---|---|
country | string | no | Two-letter country code that scopes volume and difficulty (e.g. us, gb, de). Default "us". |
keyword | string | yes | The search term to analyze (e.g. "seo tools"). |
Returns country cpcUsd difficulty keyword referringDomainsToRank searchVolume updatedUtc
The call
data_api({"api":"ahrefs.keywords","input":{"country":"us","keyword":"seo tools"}})Ahrefs Keyword Ideas
Get related keyword suggestions for any seed term, each with an Ahrefs difficulty and search-volume bucket.
| Argument | Type | Required | What it is |
|---|---|---|---|
country | string | no | Two-letter country code that scopes the suggestions (e.g. us, gb, de). Default "us". |
keyword | string | yes | The seed keyword to expand into related suggestions (e.g. "coffee"). |
Returns country ideas questions searchEngine sourceKeyword
The call
data_api({"api":"ahrefs.keyword_ideas","input":{"country":"us","keyword":"coffee"}})Ahrefs Traffic Overview
Get the Ahrefs organic traffic overview for a website Ahrefs publishes traffic for (its Top Websites list, mostly larger sites): monthly organic traffic estimate and value, the top 5 keywords it ranks for with position and traffic, traffic by country, and a monthly traffic history - as normalized JSON. Other websites return not found. Top pages are not available. For a domain's full ranked-keyword
| Argument | Type | Required | What it is |
|---|---|---|---|
mode | exact | subdomains | prefix | domain | no | Analysis scope. Only subdomains, the whole website with its subdomains, is served now; a request for domain, prefix or exact is refused. A page URL is analyzed as its whole website. Default "subdomains". |
url | string | yes | The website to analyze (e.g. ahrefs.com). A page URL is analyzed as its whole website. |
Returns domain mode monthlyTraffic monthlyTrafficValueUsd topCountries topKeywords trafficHistory
The call
data_api({"api":"ahrefs.traffic","input":{"mode":"subdomains","url":"ahrefs.com"}})Good to know
- The price shown is the usual one. A call can cost more when the first source fails and another serves it; the most it can cost is shown beside each API, and
max_creditssets your own limit. - These APIs return public data. What you may do with it depends on the platform's terms and the privacy law where you operate, and that responsibility is yours.
- A failed call is not charged.
When to choose something else
Choose a provider that specialises in Ahrefs data when you need it at high volume, on a schedule, or as bulk exports: you will get volume pricing and more control. Choose the platform's official API when you need data from your own account. These APIs are for an agent that needs an answer now, alongside other tools on the same balance.
Questions
Do I need an Ahrefs API key or developer account?
No. morigraph supplies the access. You connect morigraph once to your assistant, or use one morigraph API key from your own code, and call any of the 5 APIs on this page.
What does Ahrefs data cost through morigraph?
Between 0.109 and 0.115 credits a call depending on the API, where a credit is about 10 cents. That is from about $10.9 for 1,000 calls. You pay per call from one balance, with no separate subscription.
Can Claude, ChatGPT or Cursor get Ahrefs data?
Yes. Add morigraph as an MCP server, sign in once, then ask in plain words. Your assistant finds the right API with one search and runs it with one call.
Which Ahrefs data APIs are available?
Ahrefs Backlinks, Ahrefs Domain Overview, Ahrefs Keyword Difficulty, Ahrefs Keyword Ideas and Ahrefs Traffic Overview.
Prices and availability read from the production service on . A credit is about 10 cents of tool use; see pricing. Your assistant can quote the exact cost before a paid call.