> ## Content Index
> Fetch the complete content index at: https://blog.afi.io/llms.txt
> Use this file to discover other available public pages before exploring further.

# Finding the right place with the Google Places API
- URL: https://blog.afi.io/blog/finding-the-right-place-with-the-google-places-api/
- Published: 2024-05-25T10:12:00.000Z
- Updated: 2026-08-21T05:45:56.000Z
- Description: How to use the Google Places API for address autocomplete, nearby search, and to retrieve place details.
- Author: Afian Anwar
- Tags: googlemaps

In this tutorial series, I'll show you how to use the [Google Places API](https://developers.google.com/maps/documentation/places/web-service/overview?ref=blog.afi.io) for [address autocomplete](https://developers.google.com/maps/documentation/places/web-service/autocomplete?ref=blog.afi.io), [nearby search](https://developers.google.com/maps/documentation/places/web-service/search-nearby?ref=blog.afi.io), [text search](https://developers.google.com/maps/documentation/places/web-service/search-text?ref=blog.afi.io), and [retrieving place details](https://developers.google.com/maps/documentation/places/web-service/details?ref=blog.afi.io). I'll explain what each API does, cover pricing, and end each blog post with a hands-on example to help you quickly implement the Places API in your web app.

![Autocomplete, Place Details, Place Photos, Nearby Search and Text Search APIs](https://storage.ghost.io/c/c6/4d/c64da7e8-63a6-4cff-acdc-2782a6ebc377/content/images/2024/10/Frame.png)

Autocomplete, Place Details, Place Photos, Nearby Search and Text Search APIs

**Part 1: Finding the right place with the Google Places API (this article)**  
Part 2: [Google address autocomplete with the Places API](https://www.afi.io/blog/google-address-autocomplete-with-the-places-api/?ref=blog.afi.io)  
Part 3: [Google Place Details and Place Photos API](https://www.afi.io/blog/google-place-details-and-place-photos-api/?ref=blog.afi.io)  
Part 4: [Google Nearby Search API](https://afi.io/blog/google-nearby-search-api/?ref=blog.afi.io)  
Part 5: [Google Places Text Search](https://www.afi.io/blog/google-places-text-search/?ref=blog.afi.io)

[Autocomplete Place DemoHow to use a Google Places autocomplete widget to validate addresses as a user types![](https://storage.ghost.io/c/c6/4d/c64da7e8-63a6-4cff-acdc-2782a6ebc377/content/images/icon/logo192-22.png)![](https://storage.ghost.io/c/c6/4d/c64da7e8-63a6-4cff-acdc-2782a6ebc377/content/images/thumbnail/logo512-27.png)](https://autocomplete-place.afi.dev/?ref=blog.afi.io)

[Places API DemoHow to use the Google Nearby Search API to find nearby places, businesses and points of interest.![](https://storage.ghost.io/c/c6/4d/c64da7e8-63a6-4cff-acdc-2782a6ebc377/content/images/icon/logo192-24.png)![](https://storage.ghost.io/c/c6/4d/c64da7e8-63a6-4cff-acdc-2782a6ebc377/content/images/thumbnail/logo512-29.png)](https://places-api-demo.afi.dev/?ref=blog.afi.io)

[Google Places API Text Search DemoDemo app for the Google Places Text Search API.![](https://storage.ghost.io/c/c6/4d/c64da7e8-63a6-4cff-acdc-2782a6ebc377/content/images/icon/logo192-25.png)![](https://storage.ghost.io/c/c6/4d/c64da7e8-63a6-4cff-acdc-2782a6ebc377/content/images/thumbnail/logo512-30.png)](https://places-api-text-search.afi.dev/?ref=blog.afi.io)

### What is the Google Places API?

The [Google Places API](https://developers.google.com/maps/documentation/places/web-service/overview?ref=blog.afi.io) is a collection of APIs that transforms Google Maps into a powerful search engine. While many view Google Maps simply as a mapping tool, it actually functions more like a modern address book. Each "place" in this address book is an entry that includes details such as a name, type, address, geographic coordinates, and a unique identifier known as the `place_id`. Some places may also feature user-submitted photos and reviews. Because Google Maps is so popular, users are encouraged to leave honest reviews, whether to praise good service or highlight poor experiences.

The Google Places API allows you to look up entries in the address book and use this information directly in your app.

### Google Places API Categories

Here are the five most used APIs within the Google Places API family:

[Place Autocomplete](https://developers.google.com/maps/documentation/places/web-service/autocomplete?ref=blog.afi.io) provides location-based suggestions as users type into a search input field. It’s commonly used for address fields in applications, allowing users to quickly select from suggested results rather than typing out the full address.

![Using Place Autocomplete to provide location-based suggestions in a search input text field](https://storage.ghost.io/c/c6/4d/c64da7e8-63a6-4cff-acdc-2782a6ebc377/content/images/2024/10/Screenshot-2024-10-06-at-9.03.03-AM.png)

Using Place Autocomplete to provide location-based suggestions in a search input text field

[Place Details](https://developers.google.com/maps/documentation/places/web-service/details?ref=blog.afi.io) and [Place Photos](https://developers.google.com/maps/documentation/places/web-service/photos?ref=blog.afi.io) gives you access to a wide variety of data about a location, from basic information like its name and address to rich user-generated content such as reviews and photos. It’s especially useful when you need to offer users comprehensive details about a place beyond just its name and location.

![Using Place Details and Place Photos to include user ratings and photos to a listing](https://storage.ghost.io/c/c6/4d/c64da7e8-63a6-4cff-acdc-2782a6ebc377/content/images/2024/10/Screenshot-2024-10-06-at-12.56.06-PM.png)

Using Place Details and Place Photos to include user ratings and photos to a listing

[Nearby Search](https://afi.io/blog/google-nearby-search-api/?ref=blog.afi.io) lets you search for places within a specified area. You can refine your search by providing keywords or specifying the type of place you are looking for, making this API perfect for building apps to helps users discover relevant places around them.

![Using nearby search to find restaurants, bakeries and supermarkets near a given location](https://storage.ghost.io/c/c6/4d/c64da7e8-63a6-4cff-acdc-2782a6ebc377/content/images/2024/10/Screenshot-2024-10-06-at-12.59.08-PM.png)

Using nearby search to find restaurants, bakeries and supermarkets near a given location

[Text Search](https://developers.google.com/maps/documentation/places/web-service/search-text?ref=blog.afi.io) serves as a drop in replacement for the Google Maps search box, enabling users to search for places with free-form text, whether it's a specific place name, address, or type of location. Unlike Nearby Search, which focuses on proximity, Text Search leverages AI to interpret user queries. These can range from specific searches like a restaurant name or address to more general ones such as "Best brewery in Vancouver."

![](https://storage.ghost.io/c/c6/4d/c64da7e8-63a6-4cff-acdc-2782a6ebc377/content/images/2024/10/image-2.png)

Using the Text Search API to search for places using free-form text

### Google Places API key

To start using the Google Places API, the first thing you need to do is set it up it in your [Google Cloud console](https://console.cloud.google.com/?ref=blog.afi.io). First, create a new project from the console dashboard at [https://console.cloud.google.com/](https://console.cloud.google.com/?ref=blog.afi.io) and name it `places-api-demo`. Click \[CREATE\].

![Creating a new GCP project to test the Google Places API](https://storage.ghost.io/c/c6/4d/c64da7e8-63a6-4cff-acdc-2782a6ebc377/content/images/2024/10/Screenshot-2024-10-06-at-5.33.47-PM.png)

Creating a new GCP project to test the Google Places API

To enable the Google Places APIs, go to the APIs & Services page by selecting it on the left hand menu. Once there, choose \[+ Enable APIs and Services\] and search for the "Places API". Two options should show up - "Places API" and "Places API (New)". We'll need both. 

![Enabling the Places API in our GCP project](https://storage.ghost.io/c/c6/4d/c64da7e8-63a6-4cff-acdc-2782a6ebc377/content/images/2024/10/Screenshot-2024-10-06-at-6.04.28-PM.png)

Enabling the Places API in our GCP project

Click on each option and enable the API by selecting \[ENABLE\].

![Adding the Places API to our GCP project](https://storage.ghost.io/c/c6/4d/c64da7e8-63a6-4cff-acdc-2782a6ebc377/content/images/2024/10/Screenshot-2024-10-06-at-5.38.21-PM.png)

Adding the Places API to our GCP project

Next, while still in the `places-api-demo` project, use the left hand navigation bar to head to the Credentials page. Click on the \[+ Create Credentials\] button and choose the \[API Key\] option. On the next page, use the drop down menu to make sure that `Places API` and `Places API (New)` are both enabled.

![Verifying that both the Places API has been added to our project](https://storage.ghost.io/c/c6/4d/c64da7e8-63a6-4cff-acdc-2782a6ebc377/content/images/2024/10/Screenshot_2024-10-06_at_6_10_40-PM.png)

Verifying that both the Places API has been added to our project

For added security, it's important to set up a website restriction for your Google Maps API key to prevent unauthorized access. You can do this by clicking the \[Add\] button under the API Restrictions section. Since Google API keys are often used on the frontend, it can be exposed by inspecting the source code in a browser. To protect it, you can restrict the key to specific domains. In the example above, I've added `*.afi.dev/*` as a restriction, ensuring that the key can only be used by websites under the afi.dev domain.

Click \[Save\] and your Google API key should be good to go. To use it, click the \[Show Key\] button on the Credentials page.

### Google Places API pricing

The Google Places API follows a [pay-as-you-go pricing model](https://developers.google.com/maps/documentation/places/web-service/usage-and-billing?ref=blog.afi.io), similar to other Google Maps Platform services. Pricing (in CPM, or cost per thousand requests) for the Places API is divided into three categories - Essentials, Pro and Enterprise (see [Build more for free and access more discounts online with Google Maps Platform updates](https://mapsplatform.google.com/resources/blog/build-more-for-free-and-access-more-discounts-online-with-google-maps-platform-updates/?ref=blog.afi.io)) and looks like this:

**Essentials**

| **0 - 10k**   | **10k - 100k** | **100k - 500k** | **500k - 1M** | **1M - 5M** | **5M+** |       |
| ------------- | -------------- | --------------- | ------------- | ----------- | ------- | ----- |
| Autocomplete  | FREE           | $2.83           | $2.27         | $1.70       | $0.85   | $0.21 |
| Place Details | FREE           | $5.00           | $4.00         | $3.00       | $1.50   | $0.38 |

**Pro**

| **0 - 5k**    | **5k - 100k** | **100k - 500k** | **500k - 1M** | **1M - 5M** | **5M+** |       |
| ------------- | ------------- | --------------- | ------------- | ----------- | ------- | ----- |
| Nearby Search | FREE          | $32.00          | $35.60        | $19.20      | $9.60   | $2.40 |
| Text Search   | FREE          | $32.00          | $35.60        | $19.20      | $9.60   | $2.40 |

**Enterprise**

| **0 - 1k**   | **1k - 100k** | **100k - 500k** | **500k - 1M** | **1M - 5M** | **5M+** |       |
| ------------ | ------------- | --------------- | ------------- | ----------- | ------- | ----- |
| Place Photos | FREE          | $7.00           | $5.60         | $4.20       | $2.10   | $0.53 |

The first two tiers (0 - 100k and 100k - 500k) are available to the public. You just need to [set up a GCP billing account](https://cloud.google.com/billing/docs/how-to/manage-billing-account?ref=blog.afi.io) with your credit card and every month and you'll be charged automatically based on volume. The higher tiers (500k and up) are only available if you work with a [Google Maps Partner](https://cloud.google.com/find-a-partner/?products=Google+Maps+Platform&ref=blog.afi.io).

### Typical use cases for the Google Places API

The Google Places API is widely used across various industries. Ride sharing companies leverage Place Autocomplete to help customers accurately enter pickup and drop-off locations. Meanwhile, real estate companies often use [Nearby Search](https://afi.io/blog/google-nearby-search-api/?ref=blog.afi.io) to display amenities within walking distance of a specific property listing, enhancing the user experience.

It is also popular with the travel industry, which uses the Place Details and Place Photo APIs to add contact information, opening hours, user reviews, photos, and ratings to tourist attractions, hotels and restaurants. This allows travelers to make informed decisions about where to visit, stay, or eat during their trip.

One new and increasingly common way that the travel industry is using the Google Places API is by combining it with a Large Language Model, or LLM. For example, you can give [ChatGPT-4o](https://chatgpt.com/?ref=blog.afi.io) the following prompt:

*"I'm interested in museums, cultural landmarks, nice neighborhoods and French restaurants. Plan a three day itinerary in France for me, starting at my hotel, Le Meurice, that takes my preferences into account. Provide your answer in JSON format and for each place, include the Google Maps place\_id in your response."*

And it will generate an itinerary that includes `place_ids` for each location suggested by the engine.

![Using ChatGPT to generate place_ids in the response](https://storage.ghost.io/c/c6/4d/c64da7e8-63a6-4cff-acdc-2782a6ebc377/content/images/2024/10/Screenshot-2024-10-06-at-8.56.31-PM.png)

Using ChatGPT to generate place\_ids in the response

The response from the LLM and included `place_ids` can then be used by a trip planning app to provide personalized recommendations, together with reviews, photos, and ratings for tourist attractions and major landmarks.

![Integrating the output of an LLM with the Google Places API](https://storage.ghost.io/c/c6/4d/c64da7e8-63a6-4cff-acdc-2782a6ebc377/content/images/2024/10/image-3.png)

Integrating the output of an LLM with the Google Places API

### What you'll learn in this tutorial series

By the end of this tutorial, you'll be an expert at the Google Places API. Specifically, you will:

- Gain hands-on experience setting up [Place Autocomplete](https://afi.io/blog/google-address-autocomplete-with-the-places-api/?ref=blog.afi.io) for address and location suggestions.
- Understand how to use [Place Details](https://www.afi.io/blog/google-place-details-and-place-photos-api/?ref=blog.afi.io) and [Place Photos](https://www.afi.io/blog/google-place-details-and-place-photos-api/?ref=blog.afi.io) to fetch information about places, including address, phone number, opening hours, user ratings, and photos.
- Learn how [Nearby Search](https://afi.io/blog/google-nearby-search-api/?ref=blog.afi.io) can help find nearby places such as restaurants, hotels, and attractions based on the user’s location.
- Use [Text Search](https://www.afi.io/blog/google-places-text-search/?ref=blog.afi.io) to search for places by name, address, or type using a free-form text input.

**This article was written by** [**Afi Labs**](https://afi.io/?ref=blog.afi.io)**, a** [**Google Maps Premier Partner**](https://www.afi.io/?ref=blog.afi.io) **and reseller. We build route optimization, navigation, and fleet tracking software on Google Maps, and offer volume pricing on GMP licensing.** [**Talk to an engineer**](https://www.afi.io/contact%5Fus?ref=blog.afi.io) **or** [**follow Afian on LinkedIn**](https://www.linkedin.com/in/afian-anwar/?ref=blog.afi.io)**.**

Next: [Part 2: Google address autocomplete with the Places API](https://www.afi.io/blog/google-address-autocomplete-with-the-places-api/?ref=blog.afi.io)