Developer guide

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.

Practical guide 10 min read

What Domain Rating measures

Domain Rating (DR) is Ahrefs' 0-100 score for the strength of a site's backlink profile: how many other sites link to it, and how strong those sites are. Other tools have their own versions - Moz's Domain Authority, Semrush's Authority Score - built from different data, so the same site gets a different number in each. None of them is a Google ranking factor.

DR is most useful for comparison: vetting link prospects, sizing up the sites that rank for your keywords, or watching your own site against competitors. That usually means a list of domains, not one, which is where checking in bulk pays off.

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 @1 to 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:

FieldExampleWhat it is
domainprisjakt.nuThe domain Ahrefs checked.
domain_rating74Domain Rating, 0-100.
backlinks_count40MBacklinks, rounded the way Ahrefs displays them.
backlinks_dofollow72% dofollowShare of those backlinks that are dofollow.
linking_websites6.8KLinking websites (referring domains), rounded.
linking_websites_dofollow63% dofollowShare of linking websites with a dofollow link.
Every value is text, exactly as the checker displays it - "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:

StatusMeaningScript
200Done, 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
401Missing or invalid API key.Stop
402Out of credits (or the account is still being set up).Stop
404With an error message: unknown template name or version.Stop
422Invalid parameters - the message says which.Stop
429More requests in flight than your account allows.Retry
500The target page could not be fetched; the original code is in http_response_code.Retry
503Temporarily unavailable, or the template catalogue is warming up.Retry
504Timed 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 WORKERS below 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) or parse_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: true and 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.

Track DR over time

The template returns today's numbers only - there is no history field, and we cannot look up what a domain's DR was last month. What you can do is start your own history: run the check on a schedule and keep every snapshot. This script reuses check() from bulk_dr.py and appends each result to a SQLite table:

"""Run once a day (cron, GitHub Actions, any scheduler) to build your own DR history."""
import sqlite3
import sys

from bulk_dr import check, clean_domain

db = sqlite3.connect("dr_history.db")
db.execute("""CREATE TABLE IF NOT EXISTS dr_snapshots (
    checked_at TEXT, domain TEXT, domain_rating INTEGER,
    backlinks INTEGER, linking_websites INTEGER, error TEXT)""")

with open(sys.argv[1]) as f:
    domains = sorted({clean_domain(line) for line in f if line.strip()} - {""})

for domain in domains:
    row = check(domain)
    db.execute("INSERT INTO dr_snapshots VALUES (?, ?, ?, ?, ?, ?)",
               (row["checked_at"], row["domain"], row.get("domain_rating"),
                row.get("backlinks"), row.get("linking_websites"), row.get("error")))
db.commit()

Schedule it once a day. DR does not move by the hour, so daily is plenty; weekly works for long lists.

# every day at 06:00
0 6 * * * cd /path/to/dr && UNBLOCKINGAPI_KEY=your_api_key python history.py domains.txt

After a few weeks you can see who is gaining and who is slipping:

-- DR change per domain over the last 30 days
SELECT domain,
       MIN(domain_rating) AS low,
       MAX(domain_rating) AS high,
       (SELECT domain_rating FROM dr_snapshots s2
         WHERE s2.domain = s.domain AND s2.domain_rating IS NOT NULL
         ORDER BY checked_at DESC LIMIT 1) AS latest
FROM dr_snapshots s
WHERE checked_at >= datetime('now', '-30 days') AND domain_rating IS NOT NULL
GROUP BY domain
ORDER BY latest DESC;
Your history starts the day you run the first check, and each daily snapshot costs one credit per domain: 100 domains a day is about 3,000 credits a month.

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/mcp

Prefer 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/mcp

Then 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.

What is a good Domain Rating?

There is no universal threshold. Ahrefs describes DR as logarithmic, so moving from 20 to 30 is much easier than moving from 70 to 80, and the number is meant to be read against competitors. A good DR is one at or above the sites currently ranking for the keywords you want - which is exactly the list worth running through the bulk checker.

Increasing Domain Rating

DR follows links, so the lasting way to raise it is to earn links from relevant, credible sites: original data, useful tools and guides people cite. On-page fixes do not move DR by themselves.

Your DR history helps here too. Run your link prospects through the checker before outreach, and watch whether your own DR and linking websites move after a campaign.

Responsible use

Ahrefs' Website Authority Checker is a free public tool, so use it the way it was meant to be used: check your own domains and a reasonable list of competitors or link prospects, pace your requests rather than running everything at once, and don't hammer the checker with huge lists. Respect Ahrefs' terms - if you need their data at scale, a paid Ahrefs plan or their API is the right tool. As always, follow applicable laws, third-party terms and our Acceptable Use Policy.

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