You're all set!

To start developing, please head over to our developer documentation.

Activate the Google Places API Web Service

To get you started we'll guide you through the Google Developers Console to do a few things first:

  1. Create or choose a project
  2. Activate the Google Places API Web Service
  3. Create appropriate keys
Continue

Place IDs

Place IDs uniquely identify a place in the Google Places database and on Google Maps.

Find the ID of a particular place

Are you looking for the place ID of a specific place? Use the place ID finder below to search for a place and get its ID:

Alternatively, you can view the place ID finder with its code in the Google Maps JavaScript API documentation.

Overview

A place ID is a textual identifier that uniquely identifies a place. The length of the identifier may vary. Examples:

  • ChIJrTLr-GyuEmsRBfy61i59si0
    
  • EisxMyBNYXJrZXQgU3RyZWV0LCBXaWxtaW5ndG9uLCBOQyAyODQwMSwgVVNB
    

Place IDs are available for most locations, including businesses, landmarks, parks, and intersections.

You can use the same place ID across the Google Places API and a number of Google Maps APIs. For example, you can use the same place ID to reference a place in the Places API, the Google Maps JavaScript API, the Google Maps Geocoding API, the Google Maps Embed API and the Google Maps Roads API.

Retrieve place details using the place ID

The place ID provides a reliable means of referencing information for a particular place. These IDs are stable, meaning that once you've identified the place ID for a place, you can reuse that value when you next look up that place. If the place still exists, the API returns the same place. Read about multiple IDs and scoping below.

A common way of using place IDs is to search for a place (using the Google Places API Web Service or the Places library in the Google Maps JavaScript API, for example) then use the returned place ID to retrieve place details. You can store the place ID and use it to retrieve the same place details later. Read about saving place IDs below.

Example using the Places API Web Service

Using the Google Places API Web Service, you can find a place ID by doing a Place Search request.

The following example is a search request for places of type 'restaurant' within a 500m radius of a point in Sydney, Australia, containing the word 'cruise':

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&type=restaurant&keyword=cruise&key=YOUR_API_KEY

The response includes a place ID in the place_id field, as shown in this snippet:

{
  "html_attributions" : [],
  "results" : [
    {
      "geometry" : {
        "location" : {
          "lat" : -33.870775,
          "lng" : 151.199025
        }
      },
      ...
      "place_id" : "ChIJrTLr-GyuEmsRBfy61i59si0",
      ...
    }
  ],
  "status" : "OK"
}

For a description of all the fields in the response, see the Place Search documentation.

Now you can send a Place Details request, putting the place ID in the placeid parameter:

https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJrTLr-GyuEmsRBfy61i59si0&key=YOUR_API_KEY

Handle multiple place IDs and place ID scoping

Each place ID can refer to only one place, but a single place can have more than one place ID.

A place may get a new ID in the following situations:

  • When a business moves to a new location.
  • When your application adds a place. If you add a place using the Places API Web Service, you receive a place ID for the new place immediately. This place ID is scoped for your application only. The place then enters a moderation queue, awaiting approval for addition to the Google Places database. If approved, the place receives a new place ID, available to all applications and on Google Maps. See the documentation on adding a place.

The following diagram shows a possible scenario where a place has more than one place ID:

Retrieving a place with multiple IDs

When a place has multiple IDs, it will have no impact on a Places API request. However, it will affect the response.

When you request a place by specifying a place ID, you can be confident that you will always receive the same place in the response, provided the place still exists and the place ID is still active. (Read about saving place IDs below.)

Note, however, that the response may contain more than one place ID for the requested place, or it may contain a place ID that is different from the one in your request.

  • Behavior in the Places API Web Service: If the place has multiple IDs, the Places API Web Service will return the primary ID for the place, and an array containing all the alternative IDs for that place. See the documentation on place details and place search.
  • Behavior in the Places JavaScript library and other APIs: When you request place details for a specific place ID, you receive the details for the requested place. Note however that the place ID may be different, if the place has received a new ID since your previous request. You can safely continue to use the original place ID to access the place, but it's best practise to swap to the most recently-returned place ID whenever possible.

Save place IDs for later use

Place IDs are exempt from the caching restrictions stated in Section 10.5.d of the Google Maps APIs Terms of Service. You can therefore store place ID values for later use.

Note that you may receive a NOT_FOUND status code when you use a saved place ID. Best practise is to refresh your stored place IDs periodically, after 100 days for example. One strategy is to store the original request that returned each place ID. If a place ID becomes invalid, you can re-issue that request to get fresh results. These results may or may not include the original place.

A place ID may become obsolete if a business closes or moves to a new location.

Place IDs may change due to large-scale updates on the Google Maps database. In such cases, a place may receive a new place ID, and the old ID returns a NOT_FOUND response.

In particular, some types of place IDs may sometimes cause a NOT_FOUND response, or the API may return a different place ID in the response. These place ID types include:

  • Street addresses that do not exist in Google Maps as precise addresses, but are inferred from a range of addresses.
  • Segments of a long route, where the request also specifies a city or locality.
  • Intersections.
  • Places with an address component of type subpremise.

These IDs often take the form of a long string. Example:

ElMxNjIsIExhbmUgTnVtYmVyIDcsIEJsb2NrIEgsIE5lYiBTYXJhaSwgU2FpbmlrIEZhcm0sIE5ldyBEZWxoaSwgRGVsaGkgMTEwMDYyLCBJbmRpYQ

Send feedback about...

location_on
Google Places API Web Service