Page Summary
-
The Google Geolocation API returns a location and accuracy radius based on cell tower and WiFi access point data sent in a POST request.
-
Request bodies are formatted in JSON and should include
cellTowersandwifiAccessPointsarrays with relevant signal data for optimal results. -
Locally administered MAC addresses and reserved IANA ranges for WiFi access points should be filtered out to improve the success rate of API calls.
-
cellIdandnewRadioCellIdfields are used to identify cell towers with specific calculation methods based on radio type. -
Successful responses provide latitude and longitude coordinates within a
locationobject, along with anaccuracyvalue representing the radius of uncertainty in meters.
Geolocation requests
Geolocation requests are sent using POST to the following URL:
https://www.googleapis.com/geolocation/v1/geolocate?key=YOUR_API_KEY
You must specify a key in your request, included as the value of a
key parameter. A key is your application's
API key. This key identifies your application for purposes of quota
management. Learn how to get a key.
Request body
The request body must be formatted as JSON. If the request body is not included, the results are returned based on the IP address of request location. The following fields are supported, and all fields are optional, unless otherwise stated:
| Field | JSON type | Description | Notes |
|---|---|---|---|
homeMobileCountryCode |
number (uint32) |
The mobile country code (MCC) for the device's home network. | Supported for radioType gsm (default),
wcdma, lte and nr; not used for cdma.Valid range: 0–999. |
homeMobileNetworkCode |