← All posts

SEO Rank Tracking API: How to Track Search Engine Rankings Programmatically

Quick answer: A rank tracking API runs a search query (keyword + location + device), parses the results page, and returns the position of your domain along with everything ranking around it. You can buy this as a finished product from a rank tracking platform, or build it yourself on top of a SERP or search API like link.sc, which handles the hard part: getting reliable search results without getting blocked.

I've built rank trackers twice now, once the wrong way (scraping Google directly) and once the right way. Here's what I learned, and how to decide which path makes sense for you.

What a Rank Tracking API Actually Does

Strip away the dashboards and the term "search engine rankings API" describes something simple: for a given keyword, tell me where a given site ranks.

To do that, any rank tracking system performs the same loop:

  1. Run a search for the keyword.
  2. Parse the results into an ordered list of URLs.
  3. Find the target domain in that list and record its position.
  4. Repeat on a schedule and store the history.

The value is in the details. A real ranking position depends on three variables, not one:

Variable Why it matters
Query Obvious, but includes spelling variants and modifiers
Location Rankings differ by country, region, and even city
Device Mobile and desktop results diverge, sometimes a lot

If a tool reports "position 4" without telling you the location and device it checked from, that number is close to meaningless. Any API you use, or build, needs to control all three.

There's a fourth complication: SERP features. Your "position 3" organic result might sit below an AI overview, a featured snippet, a map pack, and four ads. Pixel position matters more than list position for click-through, which is why the better tracking setups record which features appeared, not just where the blue links landed.

Build vs Buy: The Honest Breakdown

You have three options, in increasing order of control and effort.

Buy a rank tracking platform. Tools in this category give you scheduled tracking, historical charts, competitor comparisons, and alerts out of the box. If you're an agency reporting to clients, or an in-house team tracking a few hundred keywords, this is usually the right call. You're paying for the workflow, not just the data.

Buy raw SERP data, build your own tracking. This is the middle path: use a search API to get structured results, then write your own position extraction, storage, and alerting. It makes sense when you're tracking at scale (thousands of keywords), need the data inside your own systems, or want to compute things platforms don't offer, like tracking every competitor in the top 20 rather than just your own domain.

Scrape Google yourself. I'll be blunt: don't. I've done it, and the maintenance cost is brutal. Google actively detects and blocks automated queries, the HTML changes constantly, and you'll spend more on proxies and CAPTCHA workarounds than you'd spend on an API. I wrote up the mechanics of why this fails in how to avoid Google blocking automated searches if you want the gory details.

The build-on-an-API option is more viable than most people assume, so let's look at what that takes.

Building a Rank Tracker on a Search API

The core of a rank tracker is about 40 lines of code once someone else handles retrieving the results. With link.sc, a search call returns structured results with positions already parsed:

curl -X POST https://api.link.sc/v1/search \
  -H "x-api-key: lsc_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "q": "best crm for small business",
    "engine": "google"
  }'

Then position extraction is a lookup:

import requests

API_KEY = "lsc_your_api_key"

def get_rank(keyword: str, domain: str) -> dict:
    resp = requests.post(
        "https://api.link.sc/v1/search",
        headers={"x-api-key": API_KEY},
        json={"q": keyword, "engine": "google"},
    )
    results = resp.json().get("serpData", {}).get("results", [])
    for result in results[:20]:  # slice client-side; the API returns the full parsed SERP
        if domain in result.get("targetUrl", ""):
            return {
                "keyword": keyword,
                "position": result["realPosition"],
                "url": result["targetUrl"],
            }
    return {"keyword": keyword, "position": None, "url": None}

print(get_rank("best crm for small business", "example.com"))

Wrap that in a daily cron job, write results to a database table keyed on (keyword, date), and you have a functioning rank tracker. Add a diff check against yesterday's positions and you have alerting.

One thing worth knowing: each result in link.sc's search response carries a targetUrl, and a follow-up POST to /v1/fetch with that URL returns the page's full content as markdown. For rank tracking you may not need that, but it enables a nice upgrade: when a competitor jumps above you, you can immediately fetch their page and see what changed. That's a workflow no off-the-shelf rank tracker gives you.

What Trips People Up

A few lessons from running this in production:

Rankings are noisy. The same query can return slightly different results minutes apart. Don't alert on single-day movements of one or two positions; smooth over a 3-day window or you'll drown in false alarms.

Track the whole top 20, not just your position. Storage is cheap. When your rankings drop, the first question is always "who took the spot," and if you only stored your own position, you can't answer it.

SERP features eat clicks silently. Your position can hold steady while your traffic drops because an AI overview or featured snippet appeared above you. If you're parsing full SERPs, record feature presence per keyword per day. My guide to SERP scraping in 2026 covers what's actually on a modern results page.

Keyword lists rot. Review quarterly. Half the keywords people track were chosen years ago and no longer map to anything the business cares about.

When a Dedicated Platform Wins

I'm not going to pretend building is always right. Buy a platform when:

  • Non-technical stakeholders need dashboards and PDF reports.
  • You need years of historical data you didn't collect yourself.
  • Your keyword count is small enough that platform pricing beats engineering time.
  • You want local pack tracking, share-of-voice models, and other features that took those companies years to refine.

Build on a search API when the ranking data needs to live inside your product or pipeline, when you're tracking at a scale where per-keyword platform pricing hurts, or when you want to combine rank data with page content analysis in ways platforms don't support.

Getting Started

If you're going the build route, the minimum viable version is genuinely a weekend project: pick 50 keywords, run the script above daily, store the results, and chart them. You'll learn more about your rankings in two weeks of owning the data than in a year of skimming a dashboard.

The link.sc docs cover the search endpoint parameters, and the free tier gives you 500 credits a month, which is enough to prototype a small tracker before committing to anything.


Want to build your own rank tracker without fighting Google's bot detection? Sign up for link.sc and get 500 free credits a month to start.