Skip to content
Examples

Get Geolocation

Fetch valid location values for geographic search bias

The v1 API, for batchesSquids, tasks and runs: many calls on a schedule, delivered where you work. For one call that answers in seconds, use the API v2.
GEThttps://api.lobstr.io/v1/googlelocations

Use this endpoint to fetch valid location values for the params.location setting in the Google Search Scraper. These values provide geographic bias for your search queries.

Headers

Authorizationstringheaderrequired

Your API authentication token. Value: Token YOUR_API_KEY

Query Parameters

qstringqueryrequired

Search substring for location names. Example: Alabama

country_namestringqueryrequired

Full country name. Example: United States

Query Parameters

Parameter Required Description
q Yes Substring to search for in region, district, or city names
country_name Yes Full country name to scope the search (e.g., United States)

Response Fields

Field Type Description
name string Display name of the location (region, district, or city)
canonical_name string Full hierarchical name (e.g., Alabama,United States)
country_name string Country associated with this location
country_code string ISO 2-letter country code (e.g., US)

Use the returned name value as your params.location setting.

Location values provide geographic bias - search results will be relevant to that area.

Code Examples

curl -X GET "https://api.lobstr.io/v1/googlelocations?q=Alabama&country_name=United%20States" \
  -H "Authorization: Token YOUR_API_KEY"

Response

200
{
  "success": true,
  "data": [
    {
      "name": "Alabama",
      "canonical_name": "Alabama,United States",
      "country_name": "United States",
      "country_code": "US"
    },
    {
      "name": "Alabama's 1st Congressional District 2022 redistricting",
      "canonical_name": "Alabama's 1st Congressional District 2022 redistricting,Alabama,United States",
      "country_name": "United States",
      "country_code": "US"
    },
    {
      "name": "The University of Alabama",
      "canonical_name": "The University of Alabama,Alabama,United States",
      "country_name": "United States",
      "country_code": "US"
    },
    {
      "name": "University of Alabama at Birmingham",
      "canonical_name": "University of Alabama at Birmingham,Alabama,United States",
      "country_name": "United States",
      "country_code": "US"
    }
  ]
}