---
title: "Rank Tracking API: Track Google Positions as JSON"
description: "Build a daily rank check from one Google search call per keyword and location: read organic_results position and link, store them, 1 credit a check."
url: https://perceptlayer.com/blog/rank-tracking-api
---

[Blog](https://perceptlayer.com/blog) / [API guides](https://perceptlayer.com/blog/category/api-guides)

# Rank Tracking API: Track Google Positions as JSON

25 Oct 2026 Perceptlayer 7 min read

A rank tracking API gives you search results as JSON, so you can find where your domain sits for a keyword without opening a browser. With Perceptlayer, one `GET /v1/google-search/search` call per keyword and location returns `organic_results` with a `position` and a `link` for each result, at 1 credit per successful call. Run it once a day, match your domain against each `link`, and store the date, keyword, position and URL. This guide shows the request, the fields, a working script and the cost.

## Key takeaways

-   `GET /v1/google-search/search` takes a required `query` plus optional `location`, `gl`, `hl`, `google_domain`, `device`, `start` and `page`, and costs 1 credit per successful call.
-   Each entry in `organic_results` carries `position`, `title`, `link`, `displayed_link`, `snippet`, `rank_group` and `rank_absolute`.
-   A daily check is one call per keyword, location and device: 50 keywords × 2 locations × 30 days = 3,000 credits a month.
-   Failed calls cost nothing and return `X-Credits-Used: 0`, so only the retry that succeeds after a 429 or 503 is billed.
-   Store `position` and `rank_absolute` together: in the recorded response, the first organic result has `position` 1 and `rank_absolute` 4, after three local result modules.

## What does a rank check need from a search API?

A rank check needs three things from each search: the results in order, the URL of each result, and a way to fix the search context so today's result compares with yesterday's. The Google Search API's `search` endpoint returns the first two as fields in `organic_results`, and takes parameters such as `location`, `gl`, `hl`, `google_domain` and `device` for the third. Everything else is your own bookkeeping.

That bookkeeping is small. For each keyword you send one request, walk the `organic_results` array, and compare the host of each `link` with your domain. The first match gives you the position and the ranking URL. If nothing matches on the page you fetched, record that the domain wasn't found rather than guessing a number. Over weeks, those rows become a position history per keyword that you can chart, alert on or join to traffic data.

The same approach works for a competitor's domain or for several domains at once, because each call returns the full list of organic results for the page you asked for. You pay per search, not per domain you check.

## How do you request Google results for one keyword?

Send a `GET` request to `https://api.perceptlayer.com/v1/google-search/search` with your keyword in `query` and your key in the `X-API-Key` header. This is the request behind the recorded response used throughout this guide:

```bash
curl "https://api.perceptlayer.com/v1/google-search/search?query=best+restaurants+in+Berlin&hl=en&safe=off" \
  -H "X-API-Key: $API_KEY"
```

Keys start with `sk_live_`. Where you can't set a header, the key can go in the `api_key` query parameter instead; the [authentication docs](https://docs.perceptlayer.com/authentication) cover both. A successful response carries `X-Credits-Used` and `X-Credits-Remaining` headers, so your job can log what each check cost and how much balance is left.

## Which parameters matter for rank tracking?

For rank tracking, the parameters that matter are the ones that pin down the search context: the query, where it's searched from, the interface language, the device and which page of results you want. Keep them identical from one day to the next for each keyword, or your history mixes different searches. The endpoint takes about 30 optional parameters in all; the table lists the ones a rank check uses, with the constraints the API documents.

| Parameter | Type | Required | Documented constraint |
| --- | --- | --- | --- |
| `query` | string | yes | The keyword you track |
| `location` | string | no | Up to 500 characters |
| `uule` | string | no | Up to 500 characters |
| `gl` | string | no | Up to 2 characters |
| `hl` | string | no | Up to 2 characters |
| `google_domain` | string | no | Up to 50 characters |
| `device` | string | no | One of `desktop`, `tablet`, `mobile` |
| `start` | integer | no | No further constraint documented |
| `page` | integer | no | No further constraint documented |
| `amount` | integer | no | No further constraint documented |
| `safe` | string | no | One of `active`, `off` |
| `nfpr` | integer | no | One of `0`, `1` |

The recorded request sets `hl=en`, and the response's `search_url` is a Google search URL with `gl=us` and `hl=en` in it. Log `search_url` with each check: it records the context of every stored position. The full list of parameters is on the [search endpoint page](https://perceptlayer.com/apis/google-search/search), and you can try combinations in the playground before you fix them in a job.

## What does the response contain?

The response is one JSON object with the organic results, the search context and the other blocks on the results page. For rank tracking, the important parts are `organic_results`, `search_information` and `pagination`. This is the recorded response, trimmed to the parts a rank check reads:

```json
{
  "search_information": {
    "query_displayed": "best restaurants in Berlin",
    "organic_results_count": 6
  },
  "organic_results": [
    {
      "position": 1,
      "title": "The Best Restaurants in Berlin - Food Guide & Map",
      "link": "https://andershusa.com/best-restaurants-berlin-germany-guide/",
      "displayed_link": "https://andershusa.com › best-restaurants-berlin-german...",
      …
      "rank_group": 1,
      "rank_absolute": 4
    },
    {
      "position": 2,
      "title": "Restaurants - Berlin",
      "link": "https://guide.michelin.com/us/en/berlin-region/berlin/restaurants",
      …
      "rank_group": 2,
      "rank_absolute": 5
    }
  ],
  …
  "pagination": [
    {
      "start": 10,
      …
    },
    {
      "start": 20,
      …
    }
  ],
  "search_url": "https://www.google.com/search?q=best+restaurants+in+Berlin&gl=us&hl=en&safe=off&complete=0&pws=0&nfpr=1",
  "serp_results": [
    {
      "type": "local_results",
      "module_index": 0,
      "rank_group": 1,
      "rank_absolute": 1
    },
    …
  ]
}
```

| Field | What a rank check does with it |
| --- | --- |
| `organic_results[].position` | The organic position you store |
| `organic_results[].link` | Matched against your domain; stored as the ranking URL |
| `organic_results[].rank_absolute` | Stored next to `position` |
| `search_information.organic_results_count` | Logged, so you know how many results the page held |
| `pagination[].start` | Shows the `start` values of later pages |
| `search_url` | Logged as the search context |

### Why store both position and rank\_absolute?

In the recorded response, `serp_results` lists three `local_results` modules with `rank_absolute` 1, 2 and 3, and the first organic result has `position` 1 but `rank_absolute` 4. That suggests `position` counts organic results only, while `rank_absolute` also counts other blocks on the page; check it against your own keywords in the playground. Store both, and you can switch which one you report later without collecting history again.

### How do you check beyond the first page?

The recorded `pagination` entries carry `start` values of 10 and 20, and the endpoint takes a `start` parameter; the names match. If your domain isn't on the page you fetched, send the same request with the next `start` value. Each extra page is another call and another credit, so decide how deep you track before you budget.

## How do you build the daily rank check?

The daily check is a loop over keyword and location pairs: one request each, a scan of `organic_results` for your domain, and one row appended to a CSV file. The script below does that with Python and `requests`. It waits when it gets a 429 or 503, using the `Retry-After` header, and records "not found" when the domain isn't on the page.

```python
import csv
import datetime
import os
import time
from urllib.parse import urlparse

import requests

API_KEY = os.environ["API_KEY"]
URL = "https://api.perceptlayer.com/v1/google-search/search"
DOMAIN = "example.com"
CHECKS = [
    {"query": "rank tracking api", "location": "United States", "hl": "en"},
    {"query": "serp api", "location": "United Kingdom", "hl": "en"},
]

def fetch(params, attempts=3):
    for _ in range(attempts):
        r = requests.get(URL, params=params, headers={"X-API-Key": API_KEY}, timeout=60)
        if r.status_code in (429, 503):
            time.sleep(int(r.headers.get("Retry-After", "5")))
            continue
        r.raise_for_status()
        return r.json(), r.headers.get("X-Credits-Used")
    raise RuntimeError(f"gave up on {params['query']}")

def host(link):
    h = urlparse(link).netloc.lower()
    return h[4:] if h.startswith("www.") else h

def find(results, domain):
    for item in results:
        h = host(item.get("link", ""))
        if h == domain or h.endswith("." + domain):
            return item
    return None

today = datetime.date.today().isoformat()
with open("ranks.csv", "a", newline="") as f:
    out = csv.writer(f)
    for params in CHECKS:
        data, credits = fetch(params)
        hit = find(data.get("organic_results", []), DOMAIN)
        out.writerow([
            today,
            params["query"],
            params["location"],
            hit["position"] if hit else "",
            hit["rank_absolute"] if hit else "",
            hit["link"] if hit else "not found",
            data.get("search_url", ""),
            credits,
        ])
        time.sleep(1)
```

Each row holds the date, keyword, location, `position`, `rank_absolute`, the ranking URL, the `search_url` and the credits the call used. The one-second pause keeps the script within the free tier's 1 request a second. Run it from cron once a day; a paying account runs at least 5 requests a second, so you can shorten the pause.

### What should the job do with errors?

Every error comes back with an HTTP status and a JSON body with `code`, `message` and `request_id`. A `rate_limited` (429) or `temporarily_unavailable` (503) response carries `Retry-After`, which the script honours. Treat `invalid_parameters` (422) as a bug in your check list and `source_error` (502) as a day to retry later. Requests have no idempotency key, so a client timeout may hide a call that succeeded and was billed; keep the timeout generous. The [errors docs](https://docs.perceptlayer.com/errors) list every code, and [HTTP 429 Too Many Requests](https://perceptlayer.com/blog/http-429-too-many-requests) covers backoff in more detail.

## What does daily rank tracking cost?

Daily rank tracking costs one credit per keyword, per location, per device, per page, per day. Only successful calls are billed, so a failed check followed by a successful retry costs 1 credit, not 2. Multiply your keyword list by the contexts you track and by the days in the month, and you have the monthly credit bill.

| Plan | Arithmetic | Credits a month |
| --- | --- | --- |
| 30 keywords, 1 location, page 1 | 30 × 1 × 30 days × 1 credit | 900 |
| 50 keywords, 2 locations, page 1 | 50 × 2 × 30 days × 1 credit | 3,000 |
| 200 keywords, 2 devices, page 1 | 200 × 2 × 30 days × 1 credit | 12,000 |
| 200 keywords, 2 devices, pages 1 and 2 | 200 × 2 × 2 × 30 days × 1 credit | 24,000 |

The 100 free credits on signup that come with a verified email cover the first 3 days of the first plan, and after that it fits the Starter pack's 10,000 credits for 11 months. The second fits the Starter pack's 10,000 credits for three months, and the last two fit the Build pack's 50,000. Purchased credits last 12 months, with no subscription. See [pricing](https://perceptlayer.com/pricing) for what credits cost, and the [credits docs](https://docs.perceptlayer.com/credits) for how debits work.

To try it, run the `search` endpoint in the playground on the [Google Search API page](https://perceptlayer.com/apis/google-search) with one of your own keywords, check that your domain shows up in `organic_results`, then [get a free API key](https://perceptlayer.com/signup) and schedule the script. [SERP API: What It Returns](https://perceptlayer.com/blog/serp-api-explained) covers the rest of the response if you want to track more than organic positions.

## APIs in this post

-   [Google Search **1 credit per call** · 7 endpoints](https://perceptlayer.com/apis/google-search)

## Frequently asked questions

### How much does a rank tracking API call cost?

Each successful call to `GET /v1/google-search/search` costs 1 credit, and one call checks one keyword in one search context for one page of results. A failed call costs nothing and returns `X-Credits-Used: 0`. Tracking 50 keywords in 2 locations daily is 50 × 2 × 30 = 3,000 credits a month. The pricing page lists what credit packs cost.

### Can I track rankings in different countries and on mobile?

Yes. The `search` endpoint takes `location`, `gl`, `hl`, `google_domain` and `uule` for the search context, and `device` with one of `desktop`, `tablet` or `mobile`. Each combination is a separate call at 1 credit. Keep the parameters fixed per keyword from day to day, and log `search_url` so every stored position records the search that produced it.

### What is the difference between position and rank\_absolute?

`position` numbers the entries in `organic_results`. `rank_absolute` differs from it in the recorded response: three local result modules have `rank_absolute` 1, 2 and 3, and the first organic result has `position` 1 with `rank_absolute` 4. Store both, so you can report organic position or on-page placement without collecting history again.

### How fast can I run rank checks?

Request rates are per account, shared by all its keys, and counted per minute. Free accounts get 1 request a second, 60 a minute. Paying accounts run at least 5 a second, 300 a minute, depending on the pack. Every response carries `RateLimit-Remaining` and `RateLimit-Reset`, and a 429 carries `Retry-After`. The rate limits docs have the details.

### Can an AI agent check rankings?

Yes. Through the MCP server at `https://perceptlayer.com/mcp`, an agent finds the Google Search endpoints with `search_endpoints`, reads their parameters with `get_endpoint` (both free) and runs a search with `call_endpoint`, which spends credits only on success and reports the credits used and remaining. The agent can then scan `organic_results` for a domain itself.

rank tracking seo google search serp data python

## More from the blog

1.  [API guides](https://perceptlayer.com/blog/category/api-guides) 25 Oct 2026 Perceptlayer 8 min read
    
    ## [Scrape Google Search Results with Python](https://perceptlayer.com/blog/scrape-google-search-results-python)
    
    Get Google results in Python as JSON: organic\_results, related\_questions and related\_searches from one call to /v1/google-search/search, at 1 credit a page.
    
2.  [API guides](https://perceptlayer.com/blog/category/api-guides) 11 Oct 2026 Perceptlayer 7 min read
    
    ## [SERP API: What It Returns and What a Query Costs](https://perceptlayer.com/blog/serp-api-explained)
    
    A SERP API returns a results page as JSON: organic results, People also ask, related searches, local results. Real responses from 3 engines, 1 credit each.
    
3.  [API guides](https://perceptlayer.com/blog/category/api-guides) 14 Jul 2026 Perceptlayer 7 min read
    
    ## [Google AI Overview API: Get AI Overviews as JSON](https://perceptlayer.com/blog/google-ai-overview-api)
    
    Google has no AI Overview API. GET /v1/google-search/search-ai-overview takes a query, hl and gl, costs 1 credit, and suits daily keyword tracking.
