Place Search (Geocoding)
Freegeo:geocoding
Search cities and places worldwide by name and get their coordinates, country, time zone and population. Useful as the first step for the weather and air quality APIs.
No key yet? Sign up free
GET/v1/geo:geocoding/cari
Search places by name.
Cache 604800 s
1 quota / request
geo.geocoding.cari
cURL
curl -H "x-api-key: ga_live_..." "https://kajidata.artonlabs.com/v1/geo:geocoding/cari?q=Bandung&country=ID"
Python
import requests
response = requests.get(
"https://kajidata.artonlabs.com/v1/geo:geocoding/cari",
params={"q": "Bandung", "country": "ID"},
headers={"x-api-key": "ga_live_..."},
timeout=30,
)
body = response.json()
print(body["data"] if body["ok"] else body["error"])
JavaScript
const params = new URLSearchParams({"q": "Bandung", "country": "ID"});
const response = await fetch(`https://kajidata.artonlabs.com/v1/geo:geocoding/cari?${params}`, {
headers: { "x-api-key": "ga_live_..." },
});
const body = await response.json();
console.log(body.ok ? body.data : body.error);
PHP
<?php
$ch = curl_init('https://kajidata.artonlabs.com/v1/geo:geocoding/cari?' . http_build_query(['q' => 'Bandung', 'country' => 'ID']));
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['x-api-key: ga_live_...'],
CURLOPT_TIMEOUT => 30,
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($body['ok'] ? $body['data'] : $body['error']);
Go
package main
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
)
func main() {
params := url.Values{}
params.Set("q", "Bandung")
params.Set("country", "ID")
req, _ := http.NewRequest("GET", "https://kajidata.artonlabs.com/v1/geo:geocoding/cari?"+params.Encode(), nil)
req.Header.Set("x-api-key", "ga_live_...")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
var body map[string]any
json.NewDecoder(res.Body).Decode(&body)
fmt.Println(body["data"])
}
Java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder(URI.create("https://kajidata.artonlabs.com/v1/geo:geocoding/cari?q=Bandung&country=ID"))
.header("x-api-key", "ga_live_...")
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
Ruby
require "net/http"
require "json"
uri = URI("https://kajidata.artonlabs.com/v1/geo:geocoding/cari")
uri.query = URI.encode_www_form({"q" => "Bandung", "country" => "ID"})
request = Net::HTTP::Get.new(uri)
request["x-api-key"] = "ga_live_..."
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
body = JSON.parse(response.body)
puts body["ok"] ? body["data"] : body["error"]
C#
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("x-api-key", "ga_live_...");
var json = await client.GetStringAsync("https://kajidata.artonlabs.com/v1/geo:geocoding/cari?q=Bandung&country=ID");
Console.WriteLine(json);