Bulk domain rating checker: check Ahrefs DR for hundreds of domains with an API
Checking Domain Rating one site at a time in a browser tab is fine for five domains and painful for five hundred. In this tutorial you will build a bulk DR checker: send a list of domains, get each one's Ahrefs Domain Rating, backlinks and linking websites back as JSON, and save the lot to a CSV. You will need an API key, a few lines of Python and one credit per domain.
How the UnblockingAPI template works
Ahrefs runs a free Website Authority Checker at ahrefs.com/website-authority-checker. Our UnblockingAPI Website Authority Checker template (kjellberg/ahrefs-website-authority-checker) loads that page in a real browser for the domain you pass, waits for the result to appear and returns it as JSON. You send one request to /unblock with two parameters:
- — template
kjellberg/ahrefs-website-authority-checker. Add@1to pin version 1, so your code keeps getting the same shape if the template is updated. - — url
https://ahrefs.com/website-authority-checker?input=followed by the domain, for example?input=prisjakt.nu.
The template sets its own browser, wait and country settings, so there is nothing else to tune. It returns six fields:
| Field | Example | What it is |
|---|---|---|
domain | prisjakt.nu | The domain Ahrefs checked. |
domain_rating | 74 | Domain Rating, 0-100. |
backlinks_count | 40M | Backlinks, rounded the way Ahrefs displays them. |
backlinks_dofollow | 72% dofollow | Share of those backlinks that are dofollow. |
linking_websites | 6.8K | Linking websites (referring domains), rounded. |
linking_websites_dofollow | 63% dofollow | Share of linking websites with a dofollow link. |
"6.8K", "72% dofollow". The Python example below converts them to numbers. The template has no history, Ahrefs Rank or list of referring domains: it returns what the free checker shows today.Prerequisites
- — An API key. Sign up and copy your key from the dashboard. New accounts get 500 free credits, no card needed - enough for 500 DR checks.
- — The key in an environment variable. Keep it out of your code:
export UNBLOCKINGAPI_KEY="your_api_key". - — Python 3.9+ with requests for the bulk script (
pip install requests). curl is enough for a single check.
First request
Check one domain with curl. Pass your key in the X-Api-Key header (Authorization: Bearer works too):
export UNBLOCKINGAPI_KEY="your_api_key"
curl -G "https://api.unblockingapi.com/unblock" \
-H "X-Api-Key: $UNBLOCKINGAPI_KEY" \
--data-urlencode "template=kjellberg/ahrefs-website-authority-checker@1" \
--data-urlencode "url=https://ahrefs.com/website-authority-checker?input=prisjakt.nu"The response wraps the template's fields in response. This is a real reply, trimmed of timing details; the values are from October 2026:
{
"job_id": "f064a4e9-577c-4691-9ef5-3b0e84e45de5",
"url": "https://ahrefs.com/website-authority-checker?input=prisjakt.nu",
"status": "succeeded",
"http_response_code": 200,
"render": true,
"location": "es",
"response_format": "json",
"api_name": "ahrefs-website-authority-checker",
"template_version": 1,
"response": {
"domain": "prisjakt.nu",
"domain_rating": "74",
"backlinks_count": "40M",
"backlinks_dofollow": "72% dofollow",
"linking_websites": "6.8K",
"linking_websites_dofollow": "63% dofollow"
}
}The page is rendered in a real browser, so a check can take a while - give your HTTP client a generous timeout (we use 180 seconds below). You can also send the same parameters as a JSON body with POST, which is what the Python example does. The full parameter list is in the API documentation.
Check DR in bulk (Python)
This script reads one domain per line from a text file, checks them in parallel and writes a CSV. It cleans up input like https://www.example.com/page to example.com, drops duplicates, converts the display values to numbers and retries the errors that are worth retrying.
"""Bulk domain rating checker: Ahrefs DR for a list of domains, saved to CSV.
Usage: UNBLOCKINGAPI_KEY=... python bulk_dr.py domains.txt dr.csv
"""
import csv
import os
import re
import sys
import time
from concurrent.futures import ThreadPoolExecutor
from datetime import datetime, timezone
from urllib.parse import quote, urlparse
import requests
API_URL = "https://api.unblockingapi.com/unblock"
TEMPLATE = "kjellberg/ahrefs-website-authority-checker@1" # pinned version
API_KEY = os.environ["UNBLOCKINGAPI_KEY"]
WORKERS = 2 # requests in flight; keep it modest (account limit is the ceiling)
PAUSE = 1.0 # seconds between requests per worker, to pace the checker
RETRY_STATUSES = {429, 500, 503, 504}
MAX_ATTEMPTS = 3
FIELDS = ["checked_at", "domain", "domain_rating", "backlinks",
"backlinks_dofollow_pct", "linking_websites",
"linking_websites_dofollow_pct", "error"]
class StopRun(Exception):
"""A problem retrying will not fix (bad key, no credits, bad request)."""
def clean_domain(raw):
raw = raw.strip()
host = urlparse(raw if "//" in raw else "//" + raw).hostname or ""
return host.removeprefix("www.")
def to_number(text):
"""'74' -> 74, '6.8K' -> 6800, '40M' -> 40000000, '72% dofollow' -> 72."""
if not text:
return None
m = re.search(r"([\d.,]+)\s*([KMB])?", text, re.I)
if not m:
return None
value = float(m.group(1).replace(",", ""))
value *= {"K": 1e3, "M": 1e6, "B": 1e9}.get((m.group(2) or "").upper(), 1)
return round(value)
def check(domain):
target = "https://ahrefs.com/website-authority-checker?input=" + quote(domain)
time.sleep(PAUSE)
row = {"checked_at": datetime.now(timezone.utc).isoformat(timespec="seconds"),
"domain": domain}
for attempt in range(1, MAX_ATTEMPTS + 1):
res = requests.post(
API_URL,
headers={"X-Api-Key": API_KEY},
json={"template": TEMPLATE, "url": target},
timeout=180, # a browser render can take a couple of minutes
)
try:
body = res.json()
except ValueError:
body = {} # 401 comes back with an empty body
if res.status_code == 200:
# A 200 is a successful request: it costs 1 credit even with no DR in it.
data = body.get("response") if body.get("response_format") == "json" else None
dr = to_number(data.get("domain_rating")) if isinstance(data, dict) else None
if body.get("wait_timed_out") or body.get("parse_error") or dr is None:
reason = ("wait_timed_out" if body.get("wait_timed_out")
else "parse_error" if body.get("parse_error")
else "no domain_rating on the page")
row["error"] = f"no data (charged): {reason}"
return row
row.update(
domain_rating=dr,
backlinks=to_number(data.get("backlinks_count")),
backlinks_dofollow_pct=to_number(data.get("backlinks_dofollow")),
linking_websites=to_number(data.get("linking_websites")),
linking_websites_dofollow_pct=to_number(data.get("linking_websites_dofollow")),
)
return row
if res.status_code in (401, 402, 422) or (res.status_code == 404 and body.get("error")):
raise StopRun(f"{res.status_code}: {body.get('error', 'missing or invalid API key')}")
if res.status_code in RETRY_STATUSES and attempt < MAX_ATTEMPTS:
time.sleep(5 * attempt) # back off, then try again (failures are free)
continue
row["error"] = f"failed (free): {res.status_code}: {body.get('error', 'request failed')}"
return row
def main(infile, outfile):
with open(infile) as f:
domains = sorted({clean_domain(line) for line in f if line.strip()} - {""})
with ThreadPoolExecutor(max_workers=WORKERS) as pool:
rows = list(pool.map(check, domains))
with open(outfile, "w", newline="") as f:
writer = csv.DictWriter(f, fieldnames=FIELDS)
writer.writeheader()
writer.writerows(rows)
no_data = sum(1 for r in rows if (r.get("error") or "").startswith("no data"))
failed = sum(1 for r in rows if (r.get("error") or "").startswith("failed"))
print(f"Checked {len(rows)} domains: {no_data} no data (charged), "
f"{failed} failed (free) -> {outfile}")
if __name__ == "__main__":
main(sys.argv[1], sys.argv[2])Run it with python bulk_dr.py domains.txt dr.csv. WORKERS and PAUSE keep the pace modest on purpose: your plan's concurrency limit is a ceiling, not a target (see responsible use).
CSV output
One row per domain, with the check time in UTC so rows from different runs line up:
checked_at,domain,domain_rating,backlinks,backlinks_dofollow_pct,linking_websites,linking_websites_dofollow_pct,error
2026-10-20T19:24:31+00:00,prisjakt.nu,74,40000000,72,6800,63,backlinks and linking_websites inherit Ahrefs' rounding (40M becomes 40000000), so treat them as approximate. The dofollow columns are percentages. The error column says which kind of problem a row had. failed (free) rows were blocked or errored, cost nothing and can simply be re-run later. no data (charged) rows came back as a 200 without a usable DR (wait_timed_out, parse_error or no domain_rating): the page was delivered, so each one cost a credit, and a re-run costs another.
Errors, retries and limits
You pay one credit per successful request and nothing for failed ones, so retrying a blocked or failed check costs nothing. The status codes the script handles:
| Status | Meaning | Script |
|---|---|---|
| 200 | Done, and charged 1 credit. response normally holds the six fields. If wait_timed_out or parse_error is true, or domain_rating is missing, the page came back without usable data - record it as no data and move on. | Save |
| 401 | Missing or invalid API key. | Stop |
| 402 | Out of credits (or the account is still being set up). | Stop |
| 404 | With an error message: unknown template name or version. | Stop |
| 422 | Invalid parameters - the message says which. | Stop |
| 429 | More requests in flight than your account allows. | Retry |
| 500 | The target page could not be fetched; the original code is in http_response_code. | Retry |
| 503 | Temporarily unavailable, or the template catalogue is warming up. | Retry |
| 504 | Timed out waiting for the page. | Retry |
- — Concurrency, not a request quota. Limits are on requests in flight per account: 25 for every account, more on request (see pricing). Keep
WORKERSbelow that number and you will rarely see a 429. - — Credits. A successful check is one credit, browser render included. Every 200 counts, including one flagged
wait_timed_out(a browser wait reached its limit, so the page may be incomplete) orparse_error. 404s the target genuinely returns also count as delivered results. When the balance hits zero you get a 402. - — Layout changes. If Ahrefs changes the checker page, the template can stop finding the fields. You then get a 200 with
parse_error: trueand the raw HTML rather than an error, so a run never breaks halfway. That 200 still costs a credit, which is why the script records it as no data (charged). If the fields stop coming back, tell us and we will update the template.
All codes are documented under errors in the API docs.
From an AI agent (MCP)
If you work in Claude, Cursor, VS Code or another MCP app, your agent can run the same check without any code. Add our hosted MCP server as a connector and sign in - nothing to install, and the app never sees your key:
https://mcp.unblockingapi.com/mcpPrefer to run it yourself? The same server runs locally over stdio with Node.js 18+ and your key in UNBLOCKINGAPI_KEY. Apps that connect to the hosted URL without sign-in can send the key as an Authorization: Bearer header instead.
# Claude Code, running the server locally
claude mcp add unblockingapi -e UNBLOCKINGAPI_KEY=your_api_key -- npx -y @unblockingapi/mcpThen ask for the DR of a few domains. The agent finds the template with find_templates (free) and runs it with unblock_fetch (one credit per success):
find_templates(url: "https://ahrefs.com/website-authority-checker?input=example.com")
→ kjellberg/ahrefs-website-authority-checker
unblock_fetch(url: "https://ahrefs.com/website-authority-checker?input=example.com",
template: "kjellberg/ahrefs-website-authority-checker")
→ { domain, domain_rating, backlinks_count, backlinks_dofollow,
linking_websites, linking_websites_dofollow }When you want the agent to write the bulk script for you, it can call get_build_guide first for the REST reference and app guides. Setup steps for each app are on the tools page, and the agent frameworks guide covers the Vercel AI SDK, LangChain and the Claude API - the same scraping API for AI agents, wired into your own code.
Responsible use
Frequently asked questions
Yes. Call /unblock with our UnblockingAPI DR template (template=kjellberg/ahrefs-website-authority-checker) and the URL of Ahrefs' free Website Authority Checker for the domain. You get back JSON with the domain, its Domain Rating, backlinks, linking websites and the dofollow share of each - one domain per request.
No. It reads Ahrefs' free, public Website Authority Checker page and returns what that page shows. Ahrefs' own API is the right choice when you need their full dataset, such as DR history or lists of referring domains. We are not affiliated with Ahrefs.
One credit per successful lookup, with the browser render included and no multipliers. Failed requests are free. New accounts get 500 free credits with no card, so you can check up to 500 domains before you pay anything.
No. It returns the values the checker shows today. To build a history, run the check on a schedule and store each snapshot with a timestamp - the section on tracking DR over time shows how.
Six text fields: domain, domain_rating, backlinks_count, backlinks_dofollow, linking_websites and linking_websites_dofollow. Values come back as Ahrefs displays them (for example "6.8K" or "72% dofollow"), so convert them to numbers in your code. Ahrefs Rank, referring-domain lists and Moz or Semrush scores are not included.
One domain per request. Every account can run up to 25 in parallel, but for Ahrefs' free checker we recommend a modest pace - a couple of requests at a time with a short pause - and a reasonable list of domains.
Yes. Connect the hosted MCP server at https://mcp.unblockingapi.com/mcp, and the agent can find the template with find_templates and run it with unblock_fetch.
Run your first bulk DR check free.
Test the fetching layer before building your parser. Start with 500 free credits and no credit card. See pricing for credits from €5, with no subscription.
One successful request is one credit. No multipliers for rendering, proxies or retries.
Related guidesBrowse all guides
How to scrape public property listing pages
Fetch JavaScript-rendered property listing pages with country-level routing and parse the returned HTML.
How to scrape e-commerce product pages and pricing data
Fetch public product pages through UnblockingAPI, parse pricing and product details from the returned HTML.
How to scrape JavaScript-rendered pages
Use real browser rendering to fetch pages that load content dynamically through client-side JavaScript.
How to scrape hundreds of websites every day without breaking your pipeline
Separate fetching from parsing, queue small jobs, validate content and work out monthly credits before you buy.
Zyte vs UnblockingAPI for large-scale web data collection
Compare Zyte API tiered pricing with a flat one credit per request, with worked examples at three volumes and where Zyte may fit better.
A ZenRows alternative: credit multipliers compared
Compare ZenRows and UnblockingAPI on published rates, with worked examples at three volumes and where ZenRows may be the better fit.
A Bright Data alternative with flat per-request pricing
Compare Bright Data Web Unlocker and UnblockingAPI on published rates, with worked examples and where Bright Data is the better fit.
How to give your AI app live web data
Build a fetch tool for your agent, clean pages for the model and keep RAG sources fresh with rendered, unblocked page fetches.
Connect your AI agent framework to the live web over MCP
Give agents built with the Vercel AI SDK, LangChain or the Claude API a real browser through UnblockingAPI's hosted MCP server.
Scraping API cost at scale: estimate monthly credits for 500,000 requests
Count requests, find the credit multiplier, price the credits and leave headroom, with a worked example for 500,000 requests a month.
Last updated November 2026