Get Geolocation
curl --request GET \
--url https://api.lobstr.io/v1/googlelocations \
--header 'Authorization: <authorization>'import requests
url = "https://api.lobstr.io/v1/googlelocations"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.lobstr.io/v1/googlelocations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lobstr.io/v1/googlelocations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.lobstr.io/v1/googlelocations"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.lobstr.io/v1/googlelocations")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lobstr.io/v1/googlelocations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_bodyGoogle Search Scraper
Get Geolocation
Fetch valid location values for geographic search bias
GET
/
v1
/
googlelocations
Get Geolocation
curl --request GET \
--url https://api.lobstr.io/v1/googlelocations \
--header 'Authorization: <authorization>'import requests
url = "https://api.lobstr.io/v1/googlelocations"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.lobstr.io/v1/googlelocations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lobstr.io/v1/googlelocations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.lobstr.io/v1/googlelocations"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.lobstr.io/v1/googlelocations")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lobstr.io/v1/googlelocations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_bodyUse 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
string
required
Your API authentication token. Value:
Token YOUR_API_KEYQuery Parameters
string
required
Search substring for location names. Example:
Alabamastring
required
Full country name. Example:
United StatesQuery 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"
import requests
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.lobstr.io/v1"
headers = {"Authorization": f"Token {API_KEY}"}
# Search for locations containing "Alabama" in United States
response = requests.get(f"{BASE_URL}/googlelocations",
headers=headers,
params={
"q": "Alabama",
"country_name": "United States"
}
)
data = response.json()
print(f"Found {len(data['data'])} locations")
for location in data["data"][:5]:
print(f" {location['name']} ({location['country_code']})")
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"
}
]
}
⌘I