This is how to get Google Maps API key:

1. Go to the Google Cloud Platform Console and login using your Gmail ID or create an account.

2. Click the project drop-down on the top of the page and select or create the project for which you want to add an API key.

google api, select project

3. Navigate to credentials page: APIs and Services > Dashboard in navigation menu on the left.

google cloud platform select api and services

4. Click Enable APIs and Services button on the top of the page

google cloud platform enable api and services

5. Choose Maps JavaScript API and enable it.

google cloud platform map javascript api

6. After that navigate to APIs and Services > Credentials

7. Click Create Credentials button on the top of the page and choose API Key from a drop down.

google cloud platform create api key

That is all, simply copy your API key.

Restrict API key

One more important step that we suggest to do is to restrict your key. You can always do this by clicking pencil icon opposite your API key on APIs and Services > Credentials page.

If you are going to use it for google maps extension for Magento 2 store then you can add following restrictions:

Set API restriction to Maps JavaScript API

restrict google api key by application

and add your website in Application restrictions so this key can only be used on your website.

restrict google api key to website

We suggest to add restriction after you setup google map on your website. In this case if map won’t work you will now that it is due to wrong restriction and not other map/extension settings.