Get A Free Google API Key

Introduction



During the previous years, I published several VBA functions that used Google web services, such as GeocodingElevation, and Directions. These functions worked in the same way: a properly formatted request was sent to Google server, and, then, a response was received in XML format. If the response was successful, the requested field was retrieved (latitude, longitude, elevation, trip distance etc.) by reading the XML file. These VBA functions working fine for several years, however, Google started to not allow the requests over HTTP protocol anymore, so these functions have become useless. This is the reason why I decided to rewrite all of these VBA functions while guiding you on how to get a free Google API Key that is now required.



Steps to get a valid API key



The tutorial below can be used for ANY Google API. As an example, I use the Geocoding API. The only prerequisite for this process is to just have a Google account.

1.    First of all, log in to your Google Account.

Logged In With Gmail Account

2.    Search for the appropriate API by using something like “Google API Name API Key”. The first result will probably be the one you need to click.

Search For API Key

3.    On the API page, click on the Get A key button.

Navigate To Google API Page

4.    You need to select the Yes option on the radio button. If you need to change the default project name, then click on “My Project”.
Enable API
5.    Select the Create a new project option to name your new project.
Create A New Project
6.    Rename the project and press the Next button.
New Project
7.    After waiting for a few seconds, your API key will pop up. You can simply copy it and then press the Done button. However, I suggest you click on the API console hyperlink.
Get The API Key
8.    On the page that opens on a new browser tab you can rename your API key, but more importantly, you can restrict its access (if you need to do it). Furthermore, you can regenerate or even delete the key if you no longer need it.

Console Options

9.    If you click on the Dashboard option on the top left of the page, you can see useful information for the particular project, such as the requests, the errors per hour etc. Note that you can use multiple APIs on the same project. In this example, I use only the Geocoding API on my test project.

Console Dashboard

10.    Finally, the previous step is useful (Dashboard) because each API has some limits for free usage. You can check these limits on the corresponding page and make sure you don’t exceed them!

API Usage Limits


Epilogue



If you followed these easy steps, you will get a valid API key that you can use it on your projects. To save you some time, here are the links to the API key pages that I have used in the VBA functions presented in this blog: