Geolocation API overview

  • The Geolocation API determines the latitude and longitude of a device using cell tower and WiFi access point data, returning results with an accuracy radius.

  • This API is primarily for devices lacking native geolocation features; devices with such features should leverage HTML5 geolocation or the Geocoding API.

  • By sending an HTTPS POST request with device data to the API endpoint, developers can retrieve location information for mobile devices.

  • Developers can utilize various data resources like cell device fields, cell tower data, and WiFi access point data to pinpoint device locations.

  • Client libraries are available in Java, Python, Go, and Node.js for seamless integration with the Geolocation API.

The Geolocation API is a service that accepts an HTTPS request with thecell tower and Wi-Fi access points that a mobile client can detect. It returnslatitude/longitude coordinates and a radius indicating the accuracy of theresult for each valid input.

Note: To get device location information using latitude and longitude coordinates, addresses, or Place IDs, go to theGeocoding API.

Why use the Geolocation API

Use the Geolocation API to locate mobile devices that do not provide native geolocation features.

For web browsers and mobile devices thatalready provide geolocation capabilities, use the following instead:

For more information on the W3C Geolocation standard, seeW3C Geolocation standard.

What you can do with the Geolocation API

With the Geolocation API, you can use geospatial data from cell towers and WiFi nodes to get the location of a device that does not have native geolocation or GPS.

How the Geolocation API works

The Geolocation API uses cellular device data fields, cell tower data, and WiFi access point array data to return latitude/longitude coordinates and an accuracy radius. It accepts an HTTPS POST request to its endpoint along with a JSON structured request body. The following example shows the request URL and an example request body:

curl-XPOST"https://www.googleapis.com/geolocation/v1/geolocate?key=YOUR_API_KEY"\-H"Content-Type: application/json"\-d\'{"homeMobileCountryCode":310,"homeMobileNetworkCode":410,"radioType":"gsm","carrier":"Vodafone","considerIp":true}'
The API can return data for a number of common cellular data fields as indicated below.

Resources

The following table summarizes the fields in the request body of the geolocation endpointcall, along with the type of data provided from such queries.

Data resourcesData returnedReturn format
Cell device data fields such as carrier, device, and network information.Latitude/longitude coordinates and an accuracy radiusJSON
Cell tower data, such as location area code and mobile country codes.
WiFi access points data, such as MAC address and signal strength.

How to use the Geolocation API

1Get set upStart withSet up your Google Cloud project and complete the setup instructions that follow.
2Try a geolocation requestOnce you have an API key, you can start testing out the Geolocation API using cURL or Postman. SeeSample requests in theGeolocation requests and response guide for details.
3Get the cellID from different radio towersSeeCalculating cellID andCalculating newRadioCellID to get access to older and newer towers, respectively.
4Understand response basicsExplore the geolocation data responses to prepare to use elevation data for your app. SeeGeolocation responses for details.

Available client libraries

Call this API in the language ofyour choice through one of the following client libraries:

The Java Client, Python Client, Go Client and Node.js Client for Google MapsServices are community-supported client libraries, open sourced under theApache 2.0 License.Download them from GitHub, where you can also find installation instructions and sample code.

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-11 UTC.