Check Any Domain's Ahrefs DR for Free in Python (No Subscription, Pure Stdlib)
Domain Rating is the number every link-building conversation starts with, and the tool to check it costs hundreds of dollars a month — unless you know about Ahrefs' free public DR API. This post walks through domain_rating, the DR lookup CLI in the zens-ink package: single domains, batch files, CSV export, and a local cache that keeps repeat runs instant. Real runs included — stripe.com at DR 95, metamask.io at DR 89, and our own portfolio pulled from cache in half a second. Plus the caveats that matter: DR is Ahrefs' metric (attribution required), cached values go stale (we caught our own site showing a two-month-old DR), and DR alone never tells you whether a link is worth chasing.
TL;DR — Ahrefs exposes a free public endpoint for Domain Rating, and python3 -m zens_ink.domain_rating example.com reads it in pure Python stdlib: no API key dance beyond one env var, no dependencies, no subscription. Batch a hundred domains from a file, export to CSV, and repeat runs hit a local cache (dr-cache.json) so you don't hammer the endpoint. In this post: a live two-domain lookup (stripe.com DR 95, metamask.io DR 89), a cached portfolio pull, and the honest fine print — DR is Ahrefs' proprietary metric, the License requires attribution, and a stale cache once showed our own site two months out of date.
Every link-building conversation starts with the same number. Someone mentions a site, and the first question is not “is it relevant” or “does it have traffic” — it’s “what’s the DR?”
For years, answering that question meant either an Ahrefs subscription (from a couple hundred dollars a month) or a sketchy group-buy account. Then Ahrefs quietly shipped a public DR endpoint under its free API tier, and the math changed: for the specific job of reading a domain’s DR, the data is free. What was missing was a tolerable way to use it — hence domain_rating, the DR lookup CLI in the free zens-ink package.
This post shows the tool on real domains, then the fine print that actually matters when you act on the numbers.
The 30-second version
Install (pure stdlib, zero dependencies):
pip install zens-ink
Set your Ahrefs API key once (free account → API section → copy key):
export AHREFS_API_KEY=your_key_here
Then just call it:
python3 -m zens_ink.domain_rating stripe.com metamask.io
Output from the run behind this post:
Domain Rating | 2 target(s) | Data: Domain Rating by Ahrefs (https://ahrefs.com/)
[1/2] stripe.com DR 95
[2/2] metamask.io DR 89
── 2/2 resolved | avg DR 92.0 | strongest: stripe.com (DR 95)
That’s a live API call — no cache on those two domains, fresh values, and the attribution line Ahrefs’ License requires is printed in every run. DR 95 for Stripe, DR 89 for MetaMask. Numbers that pass the smell test, which is your first sanity check with any DR source: values for famous domains should be high, and if a free tool tells you stripe.com is DR 12, the tool is broken.
The cache is the quiet feature
The second run in this post pulled our own portfolio:
python3 -m zens_ink.domain_rating zens.ink theonchaindiary.com uzenlabs.com liteink.co
Domain Rating | 4 target(s) | Data: Domain Rating by Ahrefs (https://ahrefs.com/)
[1/4] zens.ink DR 10 (cache)
[2/4] theonchaindiary.com DR 8 (cache)
[3/4] uzenlabs.com DR 33 (cache)
[4/4] liteink.co DR 10 (cache)
── 4/4 resolved | avg DR 15.2 | strongest: uzenlabs.com (DR 33)
Every value marked (cache) came from the local dr-cache.json instead of the API — the whole run is instant and costs zero API calls. That matters for two reasons:
- Rate limits are real. The free endpoint throttles by requests, and a batch of a hundred domains is a hundred calls on a cold cache. Once cached, re-checking the same list daily is free.
- DR barely moves day to day. Ahrefs recomputes DR on its own crawling schedule. For monitoring your own site or a target list, a value from last week is fine. Re-checking hourly is theater.
The cache file sits next to wherever you run the command, and it’s just JSON — open it, diff it, commit it, delete it. Nothing hidden.
Where the cache bites you
Here’s the honest lesson from our own data above: theonchaindiary.com shows DR 8 in that cached pull, but its live DR at the time of writing is 18 — the cache was roughly two months old, from before a content-and-links push more than doubled the number.
That gap is exactly why the tool has --no-cache:
python3 -m zens_ink.domain_rating theonchaindiary.com --no-cache
Bypasses the local file, hits the live API, and refreshes the cache entry. The rule of thumb: use the cache for monitoring, bypass it for decisions. If a DR number is about to change what you do — pitch a site, price a placement, report to a client — re-run with --no-cache first.
Batch mode: screening a hundred targets
The real workflow for link building is not two domains — it’s the export from a directory scrape or a competitor’s backlink list, with junk mixed in. That’s what --file is for:
python3 -m zens_ink.domain_rating --file targets.txt --csv results.csv
One domain or full URL per line (URLs are normalized automatically), results written to CSV for your spreadsheet. There’s also --json when the next step is another script instead of a human.
A practical screening pattern that has worked for us:
- Dump every domain you’re considering into a file.
- Run the batch once (cold cache, expect it to take a while on big lists).
- Sort by DR, but don’t sort only by DR — cut the obvious junk (DR < 10 that isn’t a brand-new real site), then manually check traffic and topical relevance on what survives.
That last step is where most people skip and regret. DR measures backlink strength, nothing else. A DR 60 domain with zero organic traffic is very often an expired domain being resold or a link farm — high DR, worthless citation. DR is the cheap first filter; relevance is the expensive filter that actually decides value.
What DR is, in one paragraph
Domain Rating is Ahrefs’ proprietary 0-100 score of a domain’s backlink profile strength, based on the number and quality of referring domains linking to it, on a logarithmic scale — the jump from 30 to 40 is much easier than 70 to 80. It is domain-level (page-level authority is a separate metric, URL Rating), it is not used by Google as a ranking signal (Google’s John Mueller has said repeatedly they don’t use DR-like third-party scores), and two tools’ “authority” numbers are not comparable — DR 30 and Moz’s DA 30 are unrelated scales. It’s a useful common currency for link conversations precisely because everyone in SEO recognizes it, not because it’s a ranking input.
For a deeper dive into how we use DR next to actual ranking data — and why one of our sites moved DR 8 → 18 while its Google traffic barely moved, until real third-party referring domains showed up — the GSC quick wins workflow covers the on-page half of that story.
Fine print, in full
- Attribution is required. Ahrefs’ API License requires it; the tool prints “Domain Rating by Ahrefs” on every run, and you should keep that line when you publish results.
- The free endpoint is DR-only. Referring domains, anchors, and backlink lists are paid API territory. If you need those, no free tool will save you.
- DR is Ahrefs’ opinion. It’s one company’s model of link strength. Treat it as a filter, not a truth.
- API key required. It’s a free key from a free account — set it as
AHREFS_API_KEYand the tool handles the rest.
The tool is part of the free open-source zens-ink package (pip install zens-ink), alongside the rest of the zero-dependency CLI toolchain — Reddit blue-ocean mining, SERP intent classification, and AI crawler audits. Everything runs on Python stdlib; nothing phones home except the API call you asked for.
FAQ
Is Ahrefs' Domain Rating API really free?
The specific endpoint the tool uses — Ahrefs' public domain-rating API — is free to call with an API key from a free Ahrefs account, subject to rate limits. It returns only the DR number (and closely related fields), not backlink data. The full Site Explorer dataset that Ahrefs sells subscriptions for is a different API. For the common job of 'what is this domain's DR,' the free endpoint is enough, which is why zens_ink's domain_rating tool ships in the free open-source package.
Why did my cached DR not match what Ahrefs shows on its site?
The tool caches every lookup to dr-cache.json so repeat runs are instant and rate-limit friendly — but Ahrefs recomputes DR on its own schedule, so a cached value can lag by weeks. The fix is --no-cache, which bypasses the local file and hits the live API. We caught this on our own sites: a cached lookup showed a DR from two months earlier while the live value had already moved. If you are about to make a decision based on a DR number, re-run with --no-cache.
Can I check DR for a list of domains at once?
Yes. Pass domains as arguments (python -m zens_ink.domain_rating a.com b.com c.com), pipe them via stdin, or point at a file with --file domains.txt (one domain or full URL per line). Full URLs are normalized automatically. Add --csv out.csv to write results for spreadsheets, or --json for piping into other scripts.
What does DR actually measure, and what doesn't it tell me?
DR measures the strength of a domain's backlink profile on a logarithmic 0-100 scale, based on the quantity and quality of referring domains pointing at it — it is a domain-level metric, not a page-level one (that's UR), and it says nothing about traffic, relevance, or whether the site is real. A DR 60 site with zero organic traffic is usually a PBN or an expired domain being resold. Use DR as a cheap first filter, then check traffic and topical relevance before chasing any link.
Do I need to attribute Ahrefs when I publish DR numbers?
Yes. Ahrefs' API License requires attribution — the tool prints 'Domain Rating by Ahrefs' in every run, and you should keep that attribution when you publish or screenshot the numbers. Our tool output includes it by design.
Want to run this analysis on your own site?
ZensInk Pro automates this pipeline. One command, from seed keywords to content plan.
Get Pro →