Places UI Kit: A ready-to-use library that provides room for customization and low-code development. Try it out, and share yourinput on your UI Kit experience.

Get Started

  • This guide explains how to prepare your application to work with the Google Maps Places API's Place class.

  • You'll need to set up a Cloud project, obtain an API key, and enable necessary APIs including Maps JavaScript API, Places API, and Places API (New).

  • The Places Library is loaded by including the Maps JavaScript API bootstrap loader and then callingimportLibrary("places").

  • Once set up, you can utilize the Place class for searching places, retrieving details, and using Place Autocomplete.

European Economic Area (EEA) developers If your billing address is in the European Economic Area, effective on 8 July 2025, the Google Maps Platform EEA Terms of Service will apply to your use of the Services. Functionality varies by region.Learn more.

This page shows you how to get an API key, enable the required APIs, and load the Places Library, so that you can work with the Place class.

Get an API key and enable the required APIs

Before using the Place class, you need to:

  • Create a Cloud project with a billing account.
  • Get an API key.
  • Enable the following APIs:
    • Maps JavaScript API
    • Places API
    • Places API (New) (required to use Text Search (New) and Place Autocomplete)

To learn more, seeSet up your Google Cloud project.

Get an API key

Enable Places API (New)

Load the Places Library

To load the Places Library, first load the Maps JavaScript API, by adding the inline bootstrap loader to your application code, as shown in the following snippet:

<script>(g=>{varh,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});vard=b.maps||(b.maps={}),r=newSet,e=newURLSearchParams,u=()=>h||(h=newPromise(async(f,n)=>{await(a=m.createElement("script"));e.set("libraries",[...r]+"");for(king)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})({key:"YOUR_API_KEY",v:"weekly",// Use the 'v' parameter to indicate theversion to use (weekly, beta, alpha, etc.).// Add otherbootstrap parameters as needed, using camel case.});</script>

Next, use theawait operator to callimportLibrary() from within anasync function, as shown here:

const{Place}=awaitgoogle.maps.importLibrary("places");

Your function can also load libraries without declaring a variable for the needed classes:

asyncfunctioninitMap(){google.maps.importLibrary("places");...}initMap();

Alternatively, you can load the libraries directly in HTML as shown here:

<script>google.maps.importLibrary("places");</script>

For more information about loading libraries, seeLoad the Maps JavaScript API.

Next steps

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-11 UTC.