Places API: Get an API Key

Note: The Google Maps Platform Premium Plan is no longer available for sign up or new customers.

To use the Places API you must have an API key. The API key is a unique identifier that is used to authenticate requests associated with your project for usage and billing purposes.

By using an API key to authenticate requests, you can:

Get more information on reports available to Premium Plan customers.

Creating API keys

You must have at least one API key associated with your project.

To get an API key:

  1. Go to the Google Cloud Platform Console.
  2. Click the project drop-down and select the project created for you when you purchased the Premium Plan. The project name starts with Google Maps APIs for Business or Google Maps for Work or Google Maps.
  3. Note: To have full access to the features in their plan, Premium customers should use the project associated with their Premium account. When you purchased your license, you received the name of your Premium asset in the following format: gme-[company] & proj-[number] ([type]). To ensure you are accessing the correct project, log in to the console as the project owner using console.cloud.google.com/project/number (replace number with your project number). You can locate the project owner in your welcome letter.

  4. Click the menu button and select APIs & Services > Credentials.
  5. On the Credentials page, click Create credentials > API key.
    The API key created dialog displays the newly created API key (an encrypted string).
  6. Click Close.
    The new API key is listed on the Credentials page under API keys.

Adding the API key to your request

You must include an API key with every Places API request. In the following example, replace YOUR_API_KEY with your API key.

https://maps.googleapis.com/maps/api/place/nearbysearch/json
  ?location=-33.8670522,151.1957362
  &radius=500
  &types=food
  &name=harbour
  &key=YOUR_API_KEY

Restricting API keys

Restricting API Keys adds security to your application by ensuring only authorized requests are made with your API Key. We strongly recommend that you follow the instructions to set restrictions for your API Keys. For more information, see API Key best practices.

To restrict an API key:

  1. In the GCP Console, on the project selector page, select or create a Google Cloud project for which you want to add an API Key.

    Go to the project selector page

  2. Go to the APIs & Services > Credentials page.

    Go to the Credentials page

  3. Select the API key that you want to set a restriction on. The API key property page appears.
  4. Under Key restrictions, set the following restrictions:
    • Application restrictions:
      1. To accept requests from the list of web server IP addresses that you supply, select IP addresses (web servers, cron jobs, etc.) from the list of Application restrictions.
      2. specify one IPv4 or IPv6 address or a subnet using CIDR notation (e.g. 192.168.0.0/22). If you need to enter another entry, a new box appears after you complete adding the previous entry.
    • API restrictions:
      1. Click Restrict key.
      2. Select Google Maps Platform Premium Plan from Select APIs dropdown.
        (If the Google Maps Platform Premium Plan is not listed, you need to enable it.)
  5. To finalize your changes, click Save.

Troubleshooting authentication issues

If your request is malformed or supplies an invalid signature, the Google Maps Platform Premium Plan returns an HTTP 403 (Forbidden) error.

To troubleshoot individual URLs, you can use the URL Signing Debugger. It allows you to quickly validate a URL and signature generated by your application.

Alternatively, Premium Plan customers can troubleshoot individual URLs by logging in to the Google Cloud Support Portal and selecting Resources > Google Maps Platform Premium Plan online tools > URL Signing Debugger for Web Service and Image APIs.