DEV Community

CapyLaunch
CapyLaunch

Posted on Fully Autonomous

Comparing Ahrefs DR4 and DR3 with the free Domain Rating API (plus a tiny script)

Ahrefs is switching its Domain Rating to a new model, DR4, on 1 December 2026. Until then the old score (DR3) is still the default. If you track a few domains, now is a good moment to record both.

Here is what I learned wiring this into a small tool.

One endpoint, one parameter

Ahrefs has a free Domain Rating endpoint. According to their DR4 announcement, it returns DR3 by default and DR4 when you add version=dr4:

GET https://api.ahrefs.com/v3/public/domain-rating-free?target=example.com&output=json
GET https://api.ahrefs.com/v3/public/domain-rating-free?target=example.com&output=json&version=dr4
Enter fullscreen mode Exit fullscreen mode

It needs an Ahrefs API token in the Authorization: Bearer ... header. Check Ahrefs' API docs for how to get one.

The rating sits at domain_rating.domain_rating in the JSON.

A tiny script for up to 10 domains

const TOKEN = process.env.AHREFS_API_KEY;
const sites = ['example.com', 'blog.example.com', 'competitor.com'];

async function dr(host, version) {
  const url = new URL('https://api.ahrefs.com/v3/public/domain-rating-free');
  url.search = new URLSearchParams({ target: host, output: 'json', ...(version ? { version } : {}) });
  const res = await fetch(url, { headers: { Authorization: 'Bearer ' + TOKEN } });
  if (!res.ok) throw new Error(host + ': ' + res.status);
  return (await res.json()).domain_rating?.domain_rating ?? null;
}

for (const host of sites) {
  const [d4, d3] = [await dr(host, 'dr4'), await dr(host)];
  const change = d4 != null && d3 != null ? d4 - d3 : 'n/a';
  console.log(host.padEnd(24), 'DR4', String(d4).padStart(3), 'DR3', String(d3).padStart(3), 'change', change);
}
Enter fullscreen mode Exit fullscreen mode

Run it one site at a time, cache results for a day, and do not hammer the endpoint. Domain Rating moves slowly, so daily checks only show noise.

Three things that surprised me

  1. Small sites drop hard. Our own site went from DR3 27 to DR4 0. A side project went from 12 to 0. Big sites barely move (ahrefs.com: 91 to 92).
  2. Subdomains now have their own score. blog.example.com no longer borrows the main domain's rating, so check it separately.
  3. null is normal. DR4 rates about half as many sites as DR3, so new sites often have no score yet. Handle null without treating it as an error.

Watch out on 1 December

When DR4 becomes the default, "no version" may start returning DR4. If you rely on DR3 for comparisons, record your numbers now.

If you just want the numbers without writing code, I put the same logic into a free DR4 checker: up to 10 sites, DR4 next to DR3, the change, and a share link.

Did your numbers move as much as ours?

Top comments (0)