← Back to blog

Google Search API for Local SEO: Rankings by Country

Track Google rankings by country with a Google Search API: use the gl parameter across 12 markets for local SEO, with code examples.

1 min read

Rankings differ by market — the same keyword can show completely different results in the US, Brazil and Germany. A Google Search API with a country parameter lets you track each market accurately. Here’s how with serp.cheap.

The gl parameter

gl selects which country’s Google you query, using the right TLD and regional language:

import requests

def rank_in(keyword, domain, gl):
    data = requests.post("https://api.serp.cheap/v1/search",
        headers={"X-API-Key": "YOUR_KEY"},
        json={"q": keyword, "gl": gl}).json()
    for r in data["organic"]:
        if domain in r["link"]:
            return r["position"]
    return None

for market in ["us", "gb", "de", "br"]:
    print(market, rank_in("running shoes", "nike.com", market))

Supported countries

us, br, gb, de, fr, es, it, mx, ca, au, jp, nl — 12 markets, each with the correct Google TLD and language. Add hl to override the display language within a country (e.g. French results in Canada).

City-level intent

serp.cheap localises at the country level. For city or neighbourhood intent, bake the location into the query — "emergency plumber austin tx" — and pin gl to the country. That captures the local-intent SERP for that phrase.

Build a multi-market dashboard

Loop your keyword list across gl values and store (date, keyword, market, position). You now have a location-aware rank tracker — see build a rank tracker in Python for the storage/scheduling pattern.

Cost

One request per keyword per market. 50 keywords × 4 markets daily = 200 requests ≈ $0.12/day fresh, less with cache hits.

Next

Try serp.cheap

Track your keywords across all 12 markets with one API. 100 free searches on signup — no card required; pay-as-you-go from $0.75/1k after that, and credits stay valid for 12 months.

Frequently asked questions

How do I get country-specific Google results from an API?+

Set the gl parameter to the country code (e.g. gl='br' for Brazil). serp.cheap supports 12 countries, each using the correct Google TLD and regional language, so rankings match what local users see.

Can a SERP API do city-level local results?+

serp.cheap targets country-level localisation via gl (12 countries). For city-level intent, include the locale in the query (e.g. 'plumber chicago') and pin gl to the country.

Get your API key

Cheapest direct, pay by card or crypto, no KYC. Or use a marketplace.