Quick answer
How do I get Google results for a specific country and city through a SERP API?
With SerpCrypto, set gl to the country code, hl to the language and location to a city written City, Region, Country, such as Austin, Texas, United States. Add device=mobile for phone results. Each combination is one search at 1 credit, from $0.30/1K searches, and the answer echoes the settings it applied. Paid in crypto, with no KYC.
What does each location parameter do?
Country (gl), language (hl), Google domain and a city-level location string, on desktop or mobile.
| Parameter | Default | Effect |
|---|---|---|
gl | us | Country of the results. Two letters, ISO 3166-1, lower case. Use gb for the United Kingdom. |
hl | en | Language of the interface: labels, People Also Ask and some snippets follow it. |
location | none | A precise place inside the country, for local packs and city-level rankings. |
google_domain | domain of gl | Which Google domain runs the search, such as google.de. Ignored for Bing. |
device | desktop | desktop or mobile: layouts and local blocks differ between the two. |
What is the difference between gl, hl and location?
gl says which country's results you want. hl says which language the person reads, which changes the interface and often the questions and snippets. location narrows the country down to a city or region, which matters as soon as a query has a local intent.
They combine freely. A French speaker in Switzerland is gl=ch, hl=fr. An English-language search from Berlin is gl=de, hl=en, location=Berlin, Berlin, Germany. Keep gl and the country of location the same: a city in one country with gl of another gives results that no real visitor sees.
How do I target a city?
Write the place in English, from the smallest unit to the largest: City, Region, Country. Examples: Austin, Texas, United States, Manchester, England, United Kingdom, Munich, Bavaria, Germany, Lyon, Auvergne-Rhone-Alpes, France. Use the name of the city, not a street or a postcode.
Check search_parameters.location in the answer: it shows the place that was applied. A value that cannot be used returns 400 invalid_parameter and costs nothing, so you can test a list of places cheaply.
# The same query from two cities: compare the local packs
for city in "Austin, Texas, United States" "Denver, Colorado, United States"; do
curl -sG "https://serpcrypto.com/api/v1/search" \
-H "Authorization: Bearer $SERPCRYPTO_API_KEY" \
--data-urlencode "q=emergency plumber" \
--data-urlencode "location=$city" \
-d gl=us -d hl=en -d device=mobile \
| jq -r --arg city "$city" '.local_results[]? | "\($city)\t\(.position)\t\(.title)"'
doneWhich codes should I use for common markets?
25 frequent markets. google_domain defaults to the domain of gl, so you rarely need to set it.
| Country | gl | Typical hl | Google domain |
|---|---|---|---|
| United States | us | en | google.com |
| United Kingdom | gb | en | google.co.uk |
| Canada | ca | en, fr | google.ca |
| Australia | au | en | google.com.au |
| Ireland | ie | en | google.ie |
| New Zealand | nz | en | google.co.nz |
| Germany | de | de | google.de |
| France | fr | fr | google.fr |
| Spain | es | es | google.es |
| Italy | it | it | google.it |
| Netherlands | nl | nl | google.nl |
| Switzerland | ch | de, fr, it | google.ch |
| Poland | pl | pl | google.pl |
| Sweden | se | sv | google.se |
| Turkey | tr | tr | google.com.tr |
| Brazil | br | pt-BR | google.com.br |
| Mexico | mx | es | google.com.mx |
| Argentina | ar | es | google.com.ar |
| India | in | en, hi | google.co.in |
| Japan | jp | ja | google.co.jp |
| South Korea | kr | ko | google.co.kr |
| Indonesia | id | id | google.co.id |
| Vietnam | vn | vi | google.com.vn |
| Singapore | sg | en | google.com.sg |
| South Africa | za | en | google.co.za |
Language codes are the ones Google uses in its interface; for a bilingual country, pick the language your audience reads.
Which Google domain should I use?
Usually none: leave google_domain out and the API uses the domain of the gl country, as in the table above. Set it only to reproduce a specific setup, for example google.com with gl=gb.
The domain alone does not define the country of the results. gl and location do most of the work, which is why the answer records all three in search_parameters.
Do mobile and desktop results differ?
Often, yes. The mobile page can order blocks differently, show more local results for nearby intents and cut snippets shorter. If your visitors mostly use phones, track device=mobile; for a full picture, track both and store the device with each ranking.
Each device is a separate search, so tracking both doubles the credits for those keywords. At $0.56/1K searches on the 100,000 searches pack, 1,000 keywords on two devices for 30 days use 60,000 searches.
How do I compare several countries in one script?
Loop over a list of markets and keep what the API applied. The Python example sends one query to three countries with a city each and prints the domain used and the first link.
import os
import requests
MARKETS = [
{"gl": "de", "hl": "de", "location": "Munich, Bavaria, Germany"},
{"gl": "fr", "hl": "fr", "location": "Lyon, Auvergne-Rhone-Alpes, France"},
{"gl": "br", "hl": "pt-BR", "location": "Curitiba, State of Parana, Brazil"},
]
for market in MARKETS:
r = requests.get(
"https://serpcrypto.com/api/v1/search",
params={"q": "running shoes", **market},
headers={"Authorization": "Bearer " + os.environ["SERPCRYPTO_API_KEY"]},
timeout=60,
)
r.raise_for_status()
applied = r.json()["search_parameters"]
top = r.json().get("organic_results", [])[:1]
print(applied["gl"], applied.get("google_domain"), [x["link"] for x in top])Does Bing take the same parameters?
Yes for q, gl, hl, device and page: use the same codes with engine=bing. google_domain does not apply to Bing and is ignored. The answer has the same frame, with organic_results and related_searches; see the Bing page for its use cases.
Location questions
Can I search from a ZIP code or GPS coordinates?
Not in version 1. location takes a city-level place name. For results around a point on a map, use engine=google_maps with a query that names the area, such as dentist Brooklyn.
Why do I get English labels with gl=de?
Because hl defaults to en. Set hl=de as well to get the German interface, questions and labels a person in Germany sees.
Does a location change the price of a search?
No. Every search costs 1 credit, whatever the country, city, language or device. Prepaid search credits never expire: unused searches stay on your account until you use them.
Which code is the United Kingdom?
Use gb, its ISO 3166-1 code. The Google domain for it is google.co.uk, which the API picks for you when gl=gb.