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.

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.
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:
| Route | Returns | Covers competitors? | Cost |
|---|---|---|---|
| Search Console API | Average position, your site only | No | Free |
| Custom Search JSON API | Results from a custom engine | Yes, but not real SERP | 100 queries/day free |
| Third-party SERP API | Live, exact SERP positions | Yes | Paid, per query |
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}")
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.
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.
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.

For most teams the pragmatic architecture is a hybrid, and it looks like this:
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.
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.
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.
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.
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.