DEV Community

Cover image for Which search API supports country, language and city-level results for an AI agent?
Ricardo Batista for cloro

Posted on Edited on

Which search API supports country, language and city-level results for an AI agent?

For city-level results, use a Google SERP API such as SerpApi or cloro, which take a Google location name like Austin,Texas,United States, or Firecrawl's search, which takes the same kind of location string, or Brave, which takes the city, state and coordinates as X-Loc-* request headers. Exa, Tavily, Parallel and Perplexity's Search API stop at country level, and Linkup's docs show no location parameter at all. Language is a separate setting on most APIs, and an agent needs both.

  • Country is common, but the lists differ. Brave and Parallel each accept 37 countries. Tavily takes a country name and only boosts results from it. Exa's userLocation biases results toward a country.
  • Language is a second parameter. Brave has search_lang and ui_lang, Tavily has language with an optional strict filter, Perplexity has search_language_filter, and Google takes hl. Exa and Parallel document no language parameter.
  • City level is rare. Only the Google SERP APIs, Firecrawl and Brave document it for web search. A location that does not match can fall back to country level with no error, so check the response.

Why does an agent need more than the country?

Without a location, most APIs search from a default, and the default is usually the US in English. An Open WebUI feature request shows the effect. Its Brave integration sent no country or search_lang, so Brave used country=us and search_lang=en. For the Portuguese query como visitar o Parque Nacional da Chapada Diamantina, the default request returned planetaexo.com, alltrails.com and tripsavvy.com. With country=BR&search_lang=pt-br, the top results were gov.br (ICMBio) and parquesbrasil.turismo.gov.br.

City matters for anything local: "best electrician", "pharmacy open now", rules that change by state, prices that change by store. A country-level search for those returns the national answer, which is often the wrong one.

What does each search API support?

Each row comes from the vendor's docs, read on November 16, 2026.

API Country Language Below country level
Brave country: 37 countries plus ALL, default US search_lang (default en), ui_lang Headers X-Loc-City, X-Loc-State, X-Loc-Postal-Code, X-Loc-Lat and X-Loc-Long
Firecrawl country: ISO code, default US No separate parameter found location, such as San Francisco,California,United States
SerpApi gl, and cr to limit to countries hl, and lr to limit to languages location (city level recommended), uule, GPS coordinates with a radius
cloro country or gl, ISO code hl location as a Google canonical name, or uule, on Google Search and AI Mode
Perplexity Search API country, ISO code search_language_filter, up to 20 languages None on the Search API
Tavily country, a lowercase English name; boosts only, and only with topic: "general" language boost, or a strict filter with filter_by_language None found
Parallel advanced_settings.location: 37 countries None found None for web search
Exa userLocation, ISO code, biases results None found None found
Linkup None found None found None found

Some details change the result:

  • Tavily lists countries as lowercase English names, such as "united states". Send a name, and keep topic on general.
  • Parallel ignores an unsupported code and returns a warning, so a typo silently gives global results. Its separate Place Search API takes a city, a neighborhood or a postal code, but its results are places with an address and opening hours.
  • Perplexity has city targeting on its Agent API: the web_search tool takes user_location with country, region, city and coordinates. The plain Search API takes country only.
  • Brave turns on local recall in LLM Context by itself when you send X-Loc-City or coordinates.

How do you request city-level results?

On a Google SERP API, the location is a Google canonical name, City,Region,Country, from Google's geotargets list. This is a cloro request body for POST /v1/monitor/google:

{
  "query": "best electricians",
  "country": "US",
  "hl": "en",
  "location": "Austin,Texas,United States"
}
Enter fullscreen mode Exit fullscreen mode

SerpApi takes the same name in its location parameter. A state works too: California,United States.

On Brave, the location goes in headers, and the country and language in the query string:

curl "https://api.search.brave.com/res/v1/web/search?q=best+electricians&country=US&search_lang=en" \
  -H "X-Subscription-Token: $BRAVE_API_KEY" \
  -H "X-Loc-City: Austin" \
  -H "X-Loc-State: TX" \
  -H "X-Loc-Country: US"
Enter fullscreen mode Exit fullscreen mode

On Firecrawl, location is a string in the request body, next to country:

{ "query": "best electricians", "country": "US", "location": "Austin,Texas,United States" }
Enter fullscreen mode Exit fullscreen mode

How do you check that the location was applied?

City targeting fails quietly. cloro's docs say it plainly: a location that is not a canonical name is "accepted and encoded as-is rather than rejected", and Google falls back to country level, so the response is a 200 with national results. Parallel does the same with a country it does not support: it ignores the value and adds a warning.

Three checks catch it:

  1. Read what the API used. SerpApi returns location_requested and location_used in its search metadata. Compare them on every request.
  2. Use a local test query. Run "plumber near me" or "weather" for two cities. If the results are the same, the city was not applied.
  3. Validate names before the call. Keep the canonical names your agent needs in a table, and map user input to them. Do not pass free text from the user to location.

What is supported below city level?

Not much. On Google Search and Google AI Mode, cloro supports country, US state through location, and city. Its docs list postal codes, metro areas and latitude and longitude as unsupported. It also takes a US state code on its ChatGPT, Gemini and Bing AI Mode endpoints (Bing AI Mode is Copilot Search in Bing, not the Copilot app), at 2 extra credits. For a postal code, Brave's X-Loc-Postal-Code header and Parallel's Place Search are the documented options here. For coordinates, Brave and SerpApi accept latitude and longitude.

Your agent needs Use
Results in one country and language Brave, Perplexity, Tavily, Parallel, Firecrawl or a Google SERP API
Results for a city A Google SERP API, Firecrawl or Brave
Results for a postal code or coordinates Brave headers, or SerpApi coordinates
What Google shows in one city, with the AI Overview A Google SERP API
Local businesses, not web pages Parallel Place Search or Brave's local endpoints

How this was checked

This comparison is published by cloro, which is one of the APIs in the table. The parameters of the other APIs come from each vendor's own docs, read on November 16, 2026, and linked in the table. "None found" means the vendor's full docs were searched for a location or language parameter on that date and none was found; it may exist under another name. The cloro row comes from its geo-targeting docs. The Open WebUI example is from the issue's author, who ran both requests. Serper was left out because its parameter docs did not open without an account.

Top comments (0)