Preferences

Privacy is important to us, so you have the option of disabling certain types of storage that may not be necessary for the basic functioning of the website. Blocking categories may impact your experience on the website. More information

Accept all cookies

Check Keyword Position Using Google API: 2026 Guide

Google has no live rank API. Here is what the Search Console API really returns, why Custom Search misleads, and the working Python code for each route.

Published on:
4/8/2026
-
Updated on:
4/8/2026
Lines of programming code displayed on a developer's screen while querying a search API
Lines of programming code displayed on a developer's screen while querying a search API
Thibault Besson-Magdelain fondateur de Sorank

About Author

Thibault Besson-Magdelain

Founder of Sorank, 5+ years of experience in SEO, GEO enthusiast.

In short: Google does not publish an API that returns live keyword rankings. The Search Console API returns average position for queries your own verified site already ranks for — free, first-party, but limited to your property and averaged over time. The Custom Search JSON API returns results from a custom engine, not from google.com, so its positions do not match what users see. For true live SERP positions, including competitors, you need a third-party SERP API. This guide shows the working code for each and where each one breaks.

Trying to check keyword position using Google API is one of those tasks that looks like a solved problem until you actually try it. There is no rankings.get() endpoint, and the two Google APIs people reach for first each answer a subtly different question than the one being asked. The Search Console Search Analytics documentation is the right place to start, provided you understand what "position" means there.

Does Google have an official keyword ranking API?

No. Google has never released an API that accepts a keyword and returns your live position on google.com. This is deliberate: automated querying of the search results page is prohibited by Google's terms, and the company has no commercial interest in supplying rank-tracking infrastructure.

What exists instead are three partial routes, each with a hard boundary:

RouteReturnsCovers competitors?Cost
Search Console APIAverage position, your site onlyNoFree
Custom Search JSON APIResults from a custom engineYes, but not real SERP100 queries/day free
Third-party SERP APILive, exact SERP positionsYesPaid, per query

How do I get keyword positions from the Search Console API?

Query the searchAnalytics endpoint with the query dimension and read the position field. This is first-party data straight from Google, it is free, and it has no keyword limit — you get every query your site received impressions for.

The working request, in Python:

from google.oauth2 import service_account
from googleapiclient.discovery import build

creds = service_account.Credentials.from_service_account_file(
    "service-account.json",
    scopes=["https://www.googleapis.com/auth/webmasters.readonly"],
)
service = build("searchconsole", "v1", credentials=creds)

response = service.searchanalytics().query(
    siteUrl="https://example.com/",
    body={
        "startDate": "2026-07-01",
        "endDate": "2026-07-31",
        "dimensions": ["query", "page"],
        "rowLimit": 25000,
    },
).execute()

for row in response.get("rows", []):
    query, page = row["keys"]
    print(f"{row['position']:.1f}  {query}  ->  {page}")
An analytics dashboard with performance charts displayed on a computer monitor
Search Console returns averaged position data, not a live ranking snapshot.

The three limitations that catch people out

  • Position is an average, not a rank. A value of 7.4 does not mean you sit at position 7; it means impressions were spread across positions averaging 7.4, possibly ranging from 3 to 15 across devices and locations.
  • Your site only. There is no way to see a competitor's position. Search Console is a property-scoped API by design.
  • Zero-impression keywords are invisible. If you rank at position 60 and nobody scrolled that far, the query never appears in the data at all.

That third point is the one that quietly ruins reporting. A keyword you have not yet cracked into the first pages for simply does not exist in Search Console, which makes it impossible to measure progress from position 60 to position 20 using this API alone.

Can I use the Custom Search JSON API to check rankings?

Technically yes, meaningfully no. The Custom Search JSON API requires you to create a Programmable Search Engine first. Even when configured to search the entire web, it applies its own ranking and its own restrictions, so the order it returns is not the order google.com returns.

It is also capped at 100 queries per day on the free tier, with paid usage billed per thousand queries and a daily ceiling. For a handful of keywords checked occasionally it is workable. As a rank tracker it produces numbers that look authoritative and are quietly wrong, which is worse than having no data.

What about scraping Google directly?

Don't. Automated querying of Google Search without permission is contrary to Google's Terms of Service, and at any volume it invites IP blocking and CAPTCHA walls. Beyond the policy question, the engineering reality is unpleasant: results are personalised, localised and increasingly assembled with AI features, so a scraped "position" varies by data centre, location and session even when nothing about your site changed.

If you need competitor positions, a commercial SERP API is the route that is both legal under the provider's own agreements and operationally stable. It is a paid line item, and that cost is the honest price of data Google does not give away.

A software developer writing code at a computer workstation
Rank tracking at scale is an integration problem more than a scraping problem.

What should you actually build?

For most teams the pragmatic architecture is a hybrid, and it looks like this:

  • Search Console API as the backbone. Free, unlimited keywords, first-party, and the only source that tells you what you are genuinely getting impressions for.
  • A SERP API for a small, curated keyword set. Your twenty or thirty commercially critical terms, checked daily, including competitor positions.
  • An AI visibility layer. Increasingly, the question is not only "what position am I" but "am I cited when someone asks an assistant". Classic rank APIs answer none of that.

That last point is not a future concern. When an AI answer resolves the query in the interface, position ten and position three converge on the same outcome — no click. Tracking citations alongside positions is what our Search Console MCP server and AI visibility platform are built to do, and the documentation covers the setup end to end.

Conclusion

There is no official Google API for live keyword positions: use the Search Console API for your own averaged data, a third-party SERP API for exact and competitive positions, and skip the Custom Search JSON API for ranking work entirely. Building on the wrong one is the most common mistake here, and it produces a dashboard that is confidently inaccurate.

If you would rather not build and maintain that pipeline yourself, Sorank connects your Search Console and tracks AI citations in one place.

Frequently questions asked

Does Google have a keyword ranking API?

No. Google has never published an API that accepts a keyword and returns your live position on google.com. The Search Console API returns an averaged position for your own verified property only, and the Custom Search JSON API queries a custom engine whose ordering does not match google.com.

Is Search Console position the same as ranking?

No. Search Console reports an average position across every impression, blended over devices, locations and dates. A reported value of 7.4 does not mean position 7; impressions may have ranged from position 3 to position 15 during the period.

Can I scrape Google to check my rankings?

Automated querying of Google Search without permission is contrary to Google's Terms of Service, and at any volume it triggers IP blocking and CAPTCHAs. A commercial SERP API is the route that is both permitted under its provider's agreement and operationally stable.

THEY WIN WITH SORANK

Our clients' case studies

Our Blog for Ambitious Company