Migrate to Autocomplete (New)

Places API supports the existing Autocomplete and Query Autocomplete APIs. If you are familiar with these APIs, Autocomplete (New) makes the following changes:

  • Autocomplete (New) uses HTTP POST requests. Pass parameters in the request body or in headers as part of an HTTP POST request. In contrast, with the existing APIs, you pass URL parameters using an HTTP GET request.
  • Autocomplete (New) supports both API keys and OAuth tokens as the authentication mechanism.
  • Only JSON is supported as a response format in Autocomplete (New).

The following table lists parameters in the existing Autocomplete and Query Autocomplete APIs that have been renamed or modified for Autocomplete (New), or parameters that are no longer supported.

Current parameter New parameter Notes
components includedRegionCodes
language languageCode
location locationBias
ipbias If you omit both locationBias and locationRestriction, then the API uses IP biasing by default.
offset inputOffset
radius locationBias or locationRestriction
region regionCode
stricbounds locationRestriction
sessiontoken sessionToken
types includedPrimaryTypes

Example request

The following example GET request uses the existing Place Autocomplete. In this example, you request a JSON response containing information about places called "Amoeba" that are of type establishment and pass all parameters as URL parameters:

curl -L -X GET 'https://maps.googleapis.com/maps/api/place/autocomplete/json?input=amoeba&types=establishment&location=37.76999%2C-122.44696&radius=500&key=YOUR_API_KEY'

With Autocomplete (New), you make a POST request and pass all parameters in the JSON request body or in headers as part of the POST request.

Field masks are not required for Autocomplete (New) requests, but they can be used to filter for specific results in the response. For example, the following request uses a field mask so the response only includes the suggestions.placePrediction.text of the suggestion:

curl -X POST -d '{
  "input": "Amoeba",
  "locationBias": {
    "circle": {
      "center": {
        "latitude": 37.76999,
        "longitude": -122.44696
      },
      "radius": 500.0
    }
  }
}' \
-H 'Content-Type: application/json' -H 'X-Goog-Api-Key: API_KEY' \
-H 'X-Goog-FieldMask: suggestions.placePrediction.text' \
https://places.googleapis.com/v1/places:autocomplete

To learn more about using field masks, see Places Details (New).