Blog/Search & RAG
5 min read

Ahrefs API: Get Domain Rating and Backlinks Per Call

Get Domain Rating and referring domains from the Ahrefs API for one domain or a list, filter to dofollow links, and pay only for the rows you receive.

Ahrefs API: Get Domain Rating and Backlinks Per Call

Get the Domain Rating and the strongest backlinks of any domain without an Ahrefs plan. Paste this into your agent:

Set up https://monid.ai/SKILL.md, and then use Monid to get the Domain Rating of monid.ai and apify.com and the top 10 referring domains of monid.ai, and give me a table with each referring domain, its rating, how many links it has and how many of them are dofollow.

One prompt returns the authority score and the backlink table. 1 min setup · 3-8 hrs saved.

You want an authority score for a domain, or the list of sites linking to it, and you want it as data your agent can read, not a dashboard you export from by hand. This guide shows the quick route: one call per domain for Domain Rating, one call for referring domains, and a filter that keeps only the links that pass authority. We ran every call on 2026-10-16, so the fields and numbers below are what came back. It runs through Monid, the OpenRouter for agent tools: one key, one balance, every tool priced per call.

What is the easiest way to get Ahrefs data through an API?

Monid. Install it once, add a key, and your agent calls the Ahrefs Site Explorer endpoints with a domain and gets typed JSON back, with no plan to pick first.

  • Pay per call. Each returned row is billed on its own. A Domain Rating lookup is $0.00129 a row and a referring-domain row is $0.00387 (Verified 2026-10-16 on the SEO tools page). Buy calls as you need them: no monthly plan and no minimum top-up. Discovery and inspection are free, and an empty result is not billed.
  • One install, every API. The same key and the same balance call the Ahrefs endpoints and every other tool on Monid, so a keyword or SERP lookup for the same site is another call, not another vendor.
  • Lives inside your agent. Install the CLI, add your key, run the prompt above, and the tool is there whenever your agent needs it. Your agent reads SKILL.md and learns the rest, so setup is about a minute.

Checking the authority of 100 domains costs about $0.129 (Verified 2026-10-16).

📖 See also Find All URLs on a Domain

Run one domain-rating call per domain for the score and one refdomains call per domain for the links, and loop both over your list. Both endpoints belong to the provider key ahrefs.

RouteWhat you getCost shapeFits
Export from the Ahrefs dashboardCSV files you download by handWhatever plan you holdLooking at a few sites yourself
Write your own clientExactly the fields you code forYour hoursA fixed job you will maintain
Browser extension or free checkerOne domain at a time, by handFree or subscriptionA quick look at one site
Monid Ahrefs endpointsTyped rows per domain, filterable before you payPay per row, buy flexiblyLists of domains, outreach vetting, agents

Monid fits a list because the work is the same call repeated, and you pay for the rows you receive and nothing between runs.

For agents

Grab an API key at app.monid.ai, then paste this to your agent and hand it the key:

set up https://monid.ai/SKILL.md

It learns the whole discover, inspect, run workflow itself. More in the agent quickstart.

For humans

npm install -g @monid-ai/cli
monid keys add -k <your-api-key> -l main

Step 1. Get the authority score

What it does. Returns Domain Rating and Ahrefs Rank for a domain or URL.

The call.

monid run -p ahrefs -e /site-explorer/domain-rating \
  --query '{"target": "monid.ai", "date": "2026-09-14"}'

target and date are both required, and date must match YYYY-MM-DD. The inspect text says to use today's date for current values.

What comes back. domain_rating and ahrefs_rank.

What it costs. One row, $0.00129 (Verified 2026-10-16).

What it does. Returns referring domains with their rating and whether they pass it.

The call.

monid run -p ahrefs -e /site-explorer/refdomains \
  --query '{"target": "monid.ai", "mode": "domain", "limit": 10, "order_by": "domain_rating:desc"}'

limit is the cost control on a per-row endpoint: ten rows cost ten rows. The maximum is 100.

What comes back. The table in the next section.

What it costs. $0.00387 a row (Verified 2026-10-16), so ten rows cost $0.0387.

What it does. Turns a rating-sorted list into a list of links that pass authority.

The call. Add a where filter so you pay only for rows with a dofollow link:

monid run -p ahrefs -e /site-explorer/refdomains \
  --query '{"target": "monid.ai", "mode": "domain", "limit": 50, "order_by": "domain_rating:desc", "where": "{\"field\":\"dofollow_links\",\"is\":[\"gt\",0]}"}'

On a per-row endpoint the filter is not a convenience. It is the budget.

Loop it over your list

Put one domain per line in domains.txt, and write one file per domain:

mkdir -p out
while read -r d; do
  monid run -p ahrefs -e /site-explorer/domain-rating \
    --query "{\"target\":\"$d\",\"date\":\"$(date -u +%F)\"}" > "out/$d.json"
done < domains.txt

Each domain bills one row. The loop uses the UTC date, which keeps date in step with the provider when your machine runs in a timezone ahead of it.

Give this to your agent

$Set up https://monid.ai/SKILL.md, and then use Monid to pull the top 50 referring domains for my site, keep only the ones with at least one dofollow link, and tell me how much authority I am actually receiving versus how much it looks like I have.

📖 See also Backlink API: What It Returns

Can you pull Ahrefs data yourself with Python?

Yes, and there are two ways to do it. You can call the API with requests from your own Python script, or you can scrape the web interface, which is the same method scraping social platforms needs: a logged-in session and a parser. The API route needs a key and an agreement for the access you buy. The scraping route needs a logged-in account session and a parser for pages that change.

The cost is everything around the call. You hold the key and the plan, you learn each report's parameters (the date parameter alone is required on one endpoint and absent on another), you write the paging and the filter syntax, and you repair the script when a response changes shape. For one report a day that is fine. For a changing list of domains it is a small project.

Through Monid the same job is a CLI call with the same parameters, so a Python script reaches it with subprocess and no client library:

import json, subprocess

out = subprocess.run(
    ["monid", "run", "-p", "ahrefs", "-e", "/site-explorer/domain-rating",
     "--query", json.dumps({"target": "monid.ai", "date": "2026-10-16"})],
    capture_output=True, text=True,
)
print(out.stdout)

The CLI works from any language that can start a process, and your agent can make the same call without any script at all.

What does Ahrefs API data look like, and what can you build with it?

Two layers: a score for the domain and a list of the domains that link to it. We ran both on 2026-10-16.

Domain Rating

ahrefs/site-explorer/domain-rating for monid.ai returned:

{ "type": "domain_rating", "data": { "domain_rating": 55, "ahrefs_rank": 467500 } }

For apify.com on the same day it returned domain_rating 82 and ahrefs_rank 9,486. Two fields per domain. Per the endpoint description, Domain Rating is the 0 to 100 backlink-authority score, and Ahrefs Rank is the domain's global position by that score, so the lower rank number is the stronger domain.

Referring domains

ahrefs/site-explorer/refdomains for monid.ai, top ten by rating:

DomainDRLinksDofollowFirst seen
youtube.com99402026-09-09
github.com974002026-06-09
github.io94112026-09-20
substack.com94442026-09-12
bsky.app94112026-09-29
arxiv.org93112026-09-07
gumroad.com92102026-09-21
pypi.org91102026-09-10
producthunt.com91602026-04-23
luma.com911202026-06-18

Six fields per row: domain, domain_rating, links_to_target, dofollow_links, first_seen and last_seen. last_seen was null on every row.

What you can build with it

  • An outreach vetting list. Pull the rating of every site on a prospect list and drop the weak ones before anyone writes an email. The loop above gives you one file per domain, and the filter is one line.
  • A backlink audit. Pull the referring domains of your site, sort by the dofollow column, and read what your profile does instead of what it looks like.
  • A competitor comparison. Pull the score of five rivals in five calls and put them in one table, as the Domain Rating pair above does for monid.ai and apify.com.

📖 See also Ahrefs vs KWFinder: The Link Half

Three things showed up in the runs of 2026-10-16.

Why does sorting by Domain Rating mislead you?

Because the highest-rated linking domains often pass nothing. Our top ten were rated 91 to 99, and the 71 links in them included 7 dofollow links, all from four domains: github.io, substack.com, bsky.app and arxiv.org. YouTube, GitHub, Product Hunt, PyPI, Gumroad and Luma returned 0 in dofollow_links. Six of the ten domains passed nothing.

The rule: sort by dofollow_links, not by domain_rating. The rating says how strong a referring domain is. dofollow_links says whether it does anything for you. The API returns both columns so you can lead with the second.

Why does the date parameter sometimes not apply?

Because sibling endpoints on one provider take different parameters. domain-rating requires date. The refdomains input schema lists target, mode, protocol, limit, where and order_by, and sets additionalProperties to false, so a date key does not belong in that call. paid-pages requires date again. Read the schema of each endpoint with monid inspect instead of assuming the family shares one parameter set.

A second detail: date should be today in the provider's clock. Our run on 2026-10-16 returned a 200, and the loop above computes the date in UTC so a machine ahead of UTC does not send tomorrow's date.

What does a bulk pull cost, and how long does it take?

Cost tracks the rows you request. The ten-row refdomains call billed 10 rows, $0.0387, and the filtered call with limit 2 billed 2 rows, $0.00774 (Verified 2026-10-16). A limit of 100 on refdomains is 100 rows, $0.387. The monid inspect timings are a median of 1,557 ms for domain-rating and 1,901 ms for refdomains, with a 95th percentile of 1,863 ms and 13,770 ms. Our refdomains calls took about one second each, but a loop should expect the slow tail.

Which endpoint should I use for which job?

EndpointWhat it doesInputBillingPrice (Verified 2026-10-16)
ahrefs/site-explorer/domain-ratingAuthority score and ranktarget, datePer row$0.00129
ahrefs/site-explorer/domain-rating-historyDomain Rating over time, up to 60 buckets a requesttarget, date_from, date_to, history_groupingPer bucket$0.00129
ahrefs/site-explorer/refdomainsDomains linking to a target, with dofollow countstarget, limit, where, order_byPer row$0.00387
ahrefs/site-explorer/anchorsBacklinks grouped by anchor texttarget, limit, wherePer row$0.005805
ahrefs/site-explorer/paid-pagesLanding pages a domain runs search ads totarget, date, countryPer row$0.008385

Prices Verified 2026-10-16 with monid inspect. We ran the first and third rows. The others were inspected for their input and billing and not run. Every one bills per returned row and every one's notes say an empty result is free, so limit and where are the whole cost model: ask for the rows you need and no more. For history, history_grouping sets the bucket size, and each bucket is one billed row.

When is another route a better fit?

You run a daily SERP tracking job across hundreds of keywords. That is steady, predictable volume, and steady volume is what a plan prices well. Pay per call is for bursty and occasional use, and a keyword tracker that checks positions every day is the opposite. The structured-search route for that keyword tracking job is compared in automating SERP tracking.

You want the dashboard. The Ahrefs interface, with its alerts and keyword tools, is a workspace. These endpoints return Site Explorer reports as rows, not the workspace around them.

You need the full backlink index. refdomains returns at most 100 rows a request. For a crawl of every link to a very large domain, the volume alone argues for a direct contract with the data owner.

You are sorting by rating and calling it an audit. That is a reading mistake, not a purchase mistake, and the most common one: six of our top ten referring domains passed nothing. Filter on dofollow_links first.

And the disclosure: this is the blog of Monid, and we resell these endpoints. The most useful thing in this post costs nothing: use the where filter so you buy fewer rows.

Conclusion

The quickest way to get Domain Rating and backlinks from the Ahrefs API is one call per domain through Monid: $0.00129 for a rating and $0.00387 for each referring domain (Verified 2026-10-16), one key for this and every other tool, about a minute to set up, and ready inside your agent whenever you need it.

Two things matter more than the endpoint. Sort backlinks by dofollow_links, because in our ten-row sample the highest ratings sat on domains that passed nothing. And read the schema of each endpoint, because date is required on one Ahrefs call and absent on the next.

How we estimated the time saved: getting a key and learning the access route is 1 to 2 hours, working out the date and filter parameters for each report is another 1 to 2 hours, and building the dofollow audit and the list loop is 1 to 4 hours. That is 3 to 8 hours. The 1 minute is the install, key and first call once you already have a Monid key.

Free next step: run monid inspect -p ahrefs -e /site-explorer/refdomains, then pull your own top ten referring domains with limit 10 and count the dofollow column. Ten rows cost $0.0387 (Verified 2026-10-16). Start at monid.ai.

FAQ

Is there a free Ahrefs API?

Not free, but you can start without a plan: through Monid a Domain Rating lookup costs $0.00129 a row (Verified 2026-10-16), with no monthly plan and no minimum top-up. Discovery and inspection cost nothing, and an empty result is not billed.

Where is the Ahrefs API documentation?

monid inspect on any Ahrefs endpoint prints the exact parameters, which ones are required, the allowed values and the billing for each endpoint, and links the Ahrefs documentation at docs.ahrefs.com/en/api/docs/introduction. Use the Ahrefs page for the filter expressions behind where and inspect for everything else.

Can I use the Ahrefs API from Python?

Yes. The endpoints are plain calls behind one key, so a Python script reaches them with subprocess and the CLI, as in the example above, with no Ahrefs-specific client to install. Carry over the date handling: compute it in UTC for domain-rating.

What is the difference between Domain Rating and Ahrefs Rank?

Domain Rating is the 0 to 100 backlink-authority score of a domain, and Ahrefs Rank is the domain's global position ordered by that score. A higher rating and a lower rank number both mean a stronger domain: apify.com returned 82 and rank 9,486 on 2026-10-16, monid.ai returned 55 and rank 467,500.

How do I get only the backlinks that pass authority?

Add a where filter on dofollow_links to the refdomains call, as in Step 3. In our run the filter with limit 2 returned github.io and substack.com and billed 2 rows, $0.00774, instead of ten (Verified 2026-10-16).

Published September 2026.

ahrefs apiahrefs api documentationdomain rating apibacklinks apiseo data api