Find an API

Search public APIs with auth details & Postman guides

← All APIs

Google Maps Geocoding API

google · Location

Location API Key Technology Real Estate Transportation & Logistics Geocoding Maps Location

Convert addresses to latitude/longitude (geocoding) and coordinates back to addresses (reverse geocoding). Part of the Google Maps Platform — also covers Directions, Distance Matrix, and Places.

Authentication

API Key API key required as a query parameter on every request. Enable the Geocoding API in Google Cloud Console and create a key under APIs & Services → Credentials.

Parameter name: key (in query)

Sample Requests

GET Geocode an address

Convert a street address to latitude/longitude coordinates.

https://maps.googleapis.com/maps/api/geocode/json?key=YOUR_API_KEY&address=1600 Amphitheatre Parkway, Mountain View, CA

Hover any highlighted part to learn what it does

curl -X GET "https://maps.googleapis.com/maps/api/geocode/json?key=YOUR_API_KEY&address=1600%20Amphitheatre%20Parkway%2C%20Mountain%20View%2C%20CA"
import requests
params = {
    "key": "YOUR_API_KEY",
    "address": "1600 Amphitheatre Parkway, Mountain View, CA"
}
response = requests.get(
    "https://maps.googleapis.com/maps/api/geocode/json",
    params=params,
)
print(response.json())
const url = new URL('https://maps.googleapis.com/maps/api/geocode/json');
url.searchParams.set('key', 'YOUR_API_KEY');
url.searchParams.set('address', '1600 Amphitheatre Parkway, Mountain View, CA');

const response = await fetch(url); 
const data = await response.json();
console.log(data);
package main

import (
	"fmt"
	"io"
	"net/http"
	"net/url"
)

func main() {
	baseURL, _ := url.Parse("https://maps.googleapis.com/maps/api/geocode/json")
	q := baseURL.Query()
	q.Set("key", "YOUR_API_KEY")
	q.Set("address", "1600 Amphitheatre Parkway, Mountain View, CA")
	baseURL.RawQuery = q.Encode()
	targetURL := baseURL.String()
	req, _ := http.NewRequest("GET", targetURL, nil)

	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
require "net/http"
require "json"

uri = URI("https://maps.googleapis.com/maps/api/geocode/json")
uri.query = URI.encode_www_form({
  "key" => "YOUR_API_KEY",
  "address" => "1600 Amphitheatre Parkway, Mountain View, CA"
})

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"

req = Net::HTTP::Get.new(uri)

res = http.request(req)
puts JSON.parse(res.body)
<?php
$url = "https://maps.googleapis.com/maps/api/geocode/json?" . http_build_query([
    "key" => "YOUR_API_KEY",
    "address" => "1600 Amphitheatre Parkway, Mountain View, CA"
]);
$opts = ["http" => [
    "method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
GET Reverse geocode coordinates

Convert latitude/longitude to a human-readable address.

https://maps.googleapis.com/maps/api/geocode/json?key=YOUR_API_KEY&latlng=37.4224764,-122.0842499

Hover any highlighted part to learn what it does

curl -X GET "https://maps.googleapis.com/maps/api/geocode/json?key=YOUR_API_KEY&latlng=37.4224764%2C-122.0842499"
import requests
params = {
    "key": "YOUR_API_KEY",
    "latlng": "37.4224764,-122.0842499"
}
response = requests.get(
    "https://maps.googleapis.com/maps/api/geocode/json",
    params=params,
)
print(response.json())
const url = new URL('https://maps.googleapis.com/maps/api/geocode/json');
url.searchParams.set('key', 'YOUR_API_KEY');
url.searchParams.set('latlng', '37.4224764,-122.0842499');

const response = await fetch(url); 
const data = await response.json();
console.log(data);
package main

import (
	"fmt"
	"io"
	"net/http"
	"net/url"
)

func main() {
	baseURL, _ := url.Parse("https://maps.googleapis.com/maps/api/geocode/json")
	q := baseURL.Query()
	q.Set("key", "YOUR_API_KEY")
	q.Set("latlng", "37.4224764,-122.0842499")
	baseURL.RawQuery = q.Encode()
	targetURL := baseURL.String()
	req, _ := http.NewRequest("GET", targetURL, nil)

	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
require "net/http"
require "json"

uri = URI("https://maps.googleapis.com/maps/api/geocode/json")
uri.query = URI.encode_www_form({
  "key" => "YOUR_API_KEY",
  "latlng" => "37.4224764,-122.0842499"
})

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"

req = Net::HTTP::Get.new(uri)

res = http.request(req)
puts JSON.parse(res.body)
<?php
$url = "https://maps.googleapis.com/maps/api/geocode/json?" . http_build_query([
    "key" => "YOUR_API_KEY",
    "latlng" => "37.4224764,-122.0842499"
]);
$opts = ["http" => [
    "method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));

Postman Setup Guide

Get Postman ↗
  1. Go to console.cloud.google.com and create or select a project
  2. Enable the Geocoding API under APIs & Services → Library
  3. Create an API key under APIs & Services → Credentials → Create Credentials
  4. In Postman, set the URL to https://maps.googleapis.com/maps/api/geocode/json
  5. Add query param: key = YOUR_API_KEY
  6. Add query param: address = the address to geocode (URL-encode spaces as +)
  7. Send the GET request — check results[0].geometry.location for lat/lng

What can you build with Google Maps Geocoding API?

Google Maps Geocoding API is a Location API. Developers commonly use location APIs for:

  • tracking assets and vehicles in real time
  • building delivery and logistics apps
  • finding nearby businesses or services
  • geo-fencing and location-based notifications
  • address validation and autocomplete

API Key authentication. You'll receive a key after signing up. Send it with every request — in a header or query parameter. Keep it out of client-side code and never commit it to version control.

New to APIs? Read our beginner's guide · Learn about API keys · What is REST?

Open documentation ↗