> Documentation index: https://developers.google.com/maps/documentation/llms.txt

The Geolocation API is a web service that accepts an HTTPS POST request with the cell tower and Wi-Fi access point data a mobile client can detect. It returns latitude/longitude coordinates and an accuracy radius, and can fall back to IP-based geolocation.

## Geolocation API: key facts

- **Product:** Geolocation API
- **Category:** Places
- **Platform:** Web service (REST)
- **Runs on:** Server (backend code)
- **Launch stage:** GA
- **Lifecycle:** Active
- **Overview:** [Geolocation API overview](https://developers.google.com/maps/documentation/geolocation/overview.md.txt)

## Geolocation API: when to use it

**Use Geolocation API when:**

- You need to locate a mobile device that has no built-in geolocation or GPS, using the cell tower and Wi-Fi access point data it can detect.
- You need latitude/longitude coordinates plus an accuracy radius (in meters) from a server-side HTTPS POST request.
- You need an approximate device location from the request IP address when Wi-Fi and cell data are missing or insufficient.
**Don't use Geolocation API when:**

- You need the position of a user in a browser that supports HTML5 geolocation. Use [Maps JavaScript API](https://developers.google.com/maps/documentation/javascript/quick-reference.md.txt) instead.
- You need coordinates for an address or Place ID, or an address for given coordinates. Use [Geocoding API](https://developers.google.com/maps/documentation/geocoding/quick-reference.md.txt) instead.
- You need the location of a mobile device with built-in location services (`LocationManager` or Fused Location Provider API on Android, Core Location on iOS).

## Geolocation API: setup

- **Service to enable:** `geolocation.googleapis.com`
- **Authentication:** API key
- **Get started:** [Set up Geolocation API](https://developers.google.com/maps/documentation/geolocation/get-api-key.md.txt)
- **Reference:** [Geolocation API reference](https://developers.google.com/maps/documentation/geolocation/requests-geolocation.md.txt)
- **Pricing:** [Geolocation API usage and billing](https://developers.google.com/maps/documentation/geolocation/usage-and-billing.md.txt)
- **Policies:** [Geolocation API policies](https://developers.google.com/maps/documentation/geolocation/policies.md.txt)

## Geolocation API: common mistakes

- **Problem:** `considerIp` defaults to `true`, so when Wi-Fi and cell signals can't be geolocated the API silently falls back to IP geolocation and returns a very large accuracy radius. **Fix:** Set `considerIp` to `false`; a 404 then confirms that the `wifiAccessPoints` and `cellTowers` couldn't be geolocated. See [/maps/documentation/geolocation/requests-geolocation-errors](https://developers.google.com/maps/documentation/geolocation/requests-geolocation-errors.md.txt).
- **Problem:** `wifiAccessPoints` needs two or more distinct stationary access points, and only universally-administered MAC addresses can be located. A broadcast MAC (`FF:FF:FF:FF:FF:FF`) in the list makes the whole request fail with 400 `invalidRequest` ("Invalid \\"macAddress\\" field."), and too few usable access points returns 404 `notFound`. **Fix:** Filter out broadcast (`FF:FF:FF:FF:FF:FF`) and IANA-reserved (`00:00:5E`) MACs and make sure that at least two usable access points remain. See [/maps/documentation/geolocation/requests-geolocation](https://developers.google.com/maps/documentation/geolocation/requests-geolocation.md.txt).
- **Problem:** For WCDMA and LTE, sending only the 16-bit or 8-bit Cell ID gives incorrect or zero results. Out-of-range values can be truncated or return `NOT_FOUND` with no indicator in the response. **Fix:** Compute the full `cellId` (WCDMA: `rnc_id << 16 | cid`; LTE: `enb_id << 8 | cid`) within the range 0 to 268435455. See [/maps/documentation/geolocation/requests-geolocation](https://developers.google.com/maps/documentation/geolocation/requests-geolocation.md.txt).
- **Problem:** Wi-Fi `signalStrength` values greater than -10 dBm (for example, a missing minus sign) cause the API to return `NOT FOUND`. **Fix:** Send `signalStrength` as a negative dBm value, including the minus sign. See [/maps/documentation/geolocation/requests-geolocation](https://developers.google.com/maps/documentation/geolocation/requests-geolocation.md.txt).

## What you can do with Geolocation API

See the guides linked below for each task, or compare across products in the
[Capabilities Explorer](https://developers.google.com/maps/documentation/capabilities-explorer.md.txt).

- [Return the latitude/longitude coordinates of a the device that made and HTTPS request, based on cell tower and WiFi access point locations.](https://developers.google.com/maps/documentation/geolocation/overview.md.txt#how-the-geolocation-api-works)