Recipe
Lost backlinks monitor: snapshot, diff, notify
People ask how to notice dead links before rankings do. The answer is boring and reliable: save the list every week and compare it with the last one.

What you are building
A cron job that runs once a week. It stores the list of your referring domains as a dated file, compares it with the previous file, and posts the difference somewhere a human will see it. That is the whole system.
We pull domains, not URLs. There is a reason. A domain-level list is small, stable and cheap, so a diff of two files stays readable, while URL-level lists churn with every redesign and bury the real losses under noise. When you need page detail for one lost domain, ask for backlinks on demand and pay 2 credits for that one lookup.
Run it twice by hand. The first run has no previous file, and the second proves the diff works. Check the output against a link you know you removed.
The recipe
Pick the cadence
Weekly. Our index refreshes about monthly, so daily runs return the same file most days. The weekly run catches the refresh within seven days whenever it lands.
Take the snapshot
Call refdomains with per=1000 and write the sorted JSON to a dated file. One call, 2 credits, whatever the row count up to 1,000 rows.
Diff against last week
Compare the two files with diff or jq. Lines that only exist in the old file are your lost domains.
Gate the alert
Count the lost lines. Below your SEV2 line, write a log entry. Above it, send the message. The severity table has starting values.
Check the response status
If the status is 402, credit ran out. If 401, the key is wrong. Alert on both, or your monitor will fail in silence.
The script
Bash, curl, jq. Replace the webhook with your own.
#!/usr/bin/env bash
set -euo pipefail
KEY="sk_live_..."
DOM="yourdomain.com"
DIR="$HOME/linkwatch/$DOM"; mkdir -p "$DIR"
NEW="$DIR/$(date +%F).json"
code=$(curl -s -o "$NEW.raw" -w '%{http_code}' \
"https://seouptr.com/api.php?action=refdomains&q=$DOM&per=1000&key=$KEY")
[ "$code" = 200 ] || { echo "api returned $code" >&2; exit 1; }
jq -e '.ok' "$NEW.raw" >/dev/null
jq -S . "$NEW.raw" > "$NEW" && rm "$NEW.raw"
PREV=$(ls "$DIR"/*.json | grep -v "$NEW" | tail -1 || true)
[ -n "$PREV" ] && diff <(cat "$PREV") <(cat "$NEW") > "$DIR/last.diff" || trueA domain missing from this month's index may have been dropped from our crawl, not removed by the linking site. Confirm the important ones by hand before you write to anyone. We do not claim a diff proves a link is gone.
What it costs (hypothetical portfolio)
| Step | Credits per run | Runs a month | Credits a month |
|---|---|---|---|
| refdomains for 20 sites | 40 | 4 | 160 |
| bulk_dr for all 20 together | 1 | 4 | 4 |
| backlinks lookup on 3 flagged domains | 6 | 4 | 24 |
| Total | 188 credits, about $0.019 |

Telling a lost link from a flicker
Most false alarms in a lost backlinks watch are flickers. A link vanishes from one snapshot and returns in the next, and it was probably never gone. Crawlers miss pages. Refreshes lag. A plain diff cannot tell those apart from a real loss, so build the alert to tolerate one missing week before it fires.
Hold a domain before you call it lost
Put a domain in a pending list the first week it disappears. If it is still missing a week later, promote it to lost. That costs one week of latency and removes most of the false alarms that come from a single bad crawl.
Keep the pending list as a plain file beside the snapshots. Clear an entry by hand when the domain comes back, so the list stays short enough to read.
Expect lost and new labels to swap
Some tools mark the same link lost, then new, then lost again across several refresh cycles. Anyone who checks links by hand has seen this. Treat a swap as noise unless the domain stays out for the whole pending window.
Our index refreshes roughly once a month. A diff between two adjacent weekly files can therefore show movement that is really one refresh landing. Compare medians, as the severity page suggests, before you call anything a trend.
Why one Search Console report is not enough
The Search Console links report is free and worth reading. It does not list every link to you, though, and it will not tell you when a link you had last month has gone. Use it as a second source next to the snapshot.
Run both. Where they disagree, the disagreement is itself a lead worth a manual check.

Migrations and the links that land on moved pages
Migrations are a common source of lost links. A migration can leave links pointing at addresses that no longer answer. The damage usually comes from broken redirects and lost on-page signals, not from the move itself. Check links before cutover. Know which external pages point at which of your URLs.
Map the landing URLs first
Pull the list of your pages that receive links and treat each one as a promise. Any that moves needs a 301 to its closest new equivalent. A link aimed at a retired product page should not land on the homepage, because that spends the signal on the wrong page.
Say you have 40 linked URLs and a new structure. Keep one table with the old address, the new address and the linking domains you recorded. A row with no new address is a lost link waiting to happen.
Watch the weeks after the move
Lost counts often rise for a few weeks after a migration while the index catches up. A rising list in that window is expected only if the redirects are in place. Check a sample of the lost domains by hand, one address at a time.
Verify the 301s with a status check on the old addresses. A plain 200 on an old URL, or a chain of several hops, is worth a ticket the same day.
When the target is the problem
If the same domains disappear while their pages still link to you in a browser, the target is the likely problem. Confirm that your address answers, is not blocked and returns the same content as before.
If every lost domain belongs to one vendor or one network, the cause is more likely on their side. Note it and move on rather than chasing it.
Reading the diff without tripping over it
A diff is only as clear as the files behind it. Two exports can differ in ordering, whitespace and field layout. Noise is not movement. Normalise both files before comparing, so the lines you see are the lines that changed.
The recipe already sorts keys with jq -S, which removes most of that noise. The rest comes from row order, and a stable sort fixes it.
Prove the diff is quiet on identical input
Run the comparison twice on the same file. An empty result is the baseline you want. If that run is not empty, fix the normalisation before you trust any alert, because every later result depends on it.
Do the same check after any change to the script, such as a new per value. A new page size can reorder rows and produce a diff with no real content.
Count losses and gains apart
Report the lost count and the new count as two numbers. A net change of zero can hide thirty losses and thirty gains, which are very different weeks. Say you lost 30 and gained 30 in one week. The net is nothing, yet the lost list still deserves a look.
Keep the gains out of the alert message. They are useful for outreach, but they do not decide whether anything is wrong.
Keep the diff file with the snapshot
The recipe writes last.diff each run. Keep it beside the dated snapshot. When someone asks why an alert fired, the file answers without a rerun, and a rerun may not reproduce the result because the index has moved since.
Store the diff files for as long as you store the snapshots. Deleting one of them breaks the chain of evidence for that week.
Edge cases
- Do I need a Search Console export too?
- Search Console shows links Google reports to you, a different list from ours. Use both if you can. Ours works on any domain you name, so one script can watch your own site, a client, a vendor or a rival.
- What if my domain has more than 1,000 referring domains?
- Page through with
pageandper. Each call is billed once for up to 1,000 rows, and deep pagination is capped at 50,000 rows. A site with 5,000 referring domains takes five calls, ten credits, or $0.001. - Can I check old backlinks that were de-indexed?
- We can only show what is in our own index at the last refresh. If a link was in last month's snapshot and is not in this one, treat it as a lead to verify, not a verdict. See the traffic runbook.
Before you trust the first diff
- Two snapshots exist, both sorted with the same sort and order.
- The pending window is written down, for example two missed weeks.
- The 401 and 402 branches send an alert to a person.
- Five domains from the lost list were checked by hand.
- Any migration or relaunch is marked on the chart before the run.