---
title: "Generating a Google Maps API Key"
canonical: "https://kb.myframeworks.com.au/space/FRAM/28401830/Generating%20a%20Google%20Maps%20API%20Key"
format: markdown
---
# Overview

To allow Frameworks and the Trade Portal to display a map, assign latitude and longitude, show directions and distances within [Sales Orders](https://sterlandsupport.atlassian.net/wiki/spaces/FRAM/pages/28391206) and [Transport Scheduling](https://sterlandsupport.atlassian.net/wiki/spaces/FRAM/pages/28389732) a **Google Maps API key** is required. 

> ℹ️ This document displayed the process of Generating a Google Maps API Key.

# 1. Google Cloud Account Setup

1. Navigate to [https://cloud.google.com/](https://cloud.google.com/)  in your favourite browser.

> ℹ️ Google Chrome was used in this case.

2. On the Google Cloud page, select any one of the **Getting Started for Free** buttons or drop-down menu options.
3. Create the Google Cloud account.

> ✅ Refer to the following link for additional information:
> ✅ 
> ✅ - [Creating the Google Cloud Account (Youtube)](https://www.youtube.com/watch?v=76IHbUMwz9k&list=PLIivdWyY5sqIij_cgINUHZDMnGjVx3rxi&index=57)
> ✅ - [Google Cloud Free Tier Documentation](https://cloud.google.com/free/docs/gcp-free-tier)
> ✅ - [Google Cloud Billing FAQ](https://cloud.google.com/billing/docs/how-to)

# 2. Defining the Billing Details

> ⚠️ You must have a Google account with [billing enabled](https://developers.google.com/maps/documentation/javascript/usage-and-billing) to generate a key for Google Maps API.

1. Navigate to the **Billing** menu and follow the instructions on the screen to change the account to a billing account. This is only required after the trial period expires.

![image](media://f221459d-1ad7-4e20-aec7-5dab6a5bc8f0)

<details>
<summary>For more information about Billing Prices, click here. </summary>

## Billing prices

Pricing for the Google Maps, Routes and Places and the APIs connected with them (Maps JavaScript API, Directions API, Timezone API, Geocoding API ) is pay as you go, and you only pay for what you use. You get a recurring $200 credit on your billing account each month to offset your usage costs, and you can also set usage limits to protect against unexpected cost increases. Typically there will be no additional costs.

The free credits provides up to:

- 28,000 map loads for the Maps JavaScript API
- 70,000 requests to the Places API
- 40,000 calls to the Geocoding API
- 40,000 calls to the Geolocation API

> ℹ️ For a table of Google’s pricing, see [Pricing for Maps, Routes, and Places](https://cloud.google.com/maps-platform/pricing/sheet/). If you need to enable billing, please go to APIs and billing.
</details>

2. Once the billing account has been set up, create a new project or select an existing project.

# 3. Create a Project

1. Next to **Google Cloud Platform** in the top left corner, click on the project selection drop-down.
2. Click on **New Project** in the top right of the window
3. Enter the **Project Name**, select the **Location** and click **Create.**
4. The project will be created and selected ready to create the API key.

# 4. Enable API's

To use Google Maps Platform, you must enable the APIs you plan to use with your project.

> ⚠️ The current API's required to be enabled are:
> ⚠️ 
> ⚠️ - **Directions API** (Transport Scheduling)
> ⚠️ - **Distance Matrix API** (Transport Orders)
> ⚠️ - **GeoCoding API** (assign latitude and longitude to all orders)
> ⚠️ - **Maps Embed API** (Sales orders and Transport Orders)


1. See the Google Maps Platform APIs that you can enable by going to the Maps API Library page in the Cloud Console:
  - Go to the [Maps API Library page](https://console.cloud.google.com/project/_/google/maps-apis/api-list)
2. Click the API you want to enable.
  - If the button says **ENABLE**, click the button to enable the API.
  - If the button says **MANAGE**, the API is already enabled and you don't need to do anything further.
  - Clicking either button will display the dashboard for the API. (Click the **DISABLE** button to remove the API from this project.)

# Generating the API key

1. Navigate to the **APIs & Services** menu and select **Credentials.**
2. On the Credentials page click the **+ CREATE CREDENTIALS** button

![image](media://83946be1-70ef-4a47-b67e-fbe0ad9c401d)

3. Select the **API Key** option

![image](media://92abb152-d4d5-4cd5-9eaf-a560b5ec9dab)

4. The API key will be generated.  At this point you may restrict the key by clicking on the **Edit API Key** link.

![image](media://37afb270-8a50-48dd-9ffd-9b4a14b51312)

> ✅ **Tip:** Click the **Copy** icon to copy the API key.

5. **Name** the key and apply the **Key restrictions**.

## Key Restictions

There are 2 types of key restrictions; these are: 

### Application restrictions

It is recommended that the key is restricted to the company websites using the **HTTP referrers** option, however, The key may be left unrestricted if required.

![image](media://f53cc034-bcd8-4da3-b11e-cfa92c13ac13)

### API Restrictions

The API key usage can also be restricted by using the **Select APIs** menu

The current API's in use are the following:

- **Directions API** (Transport Scheduling)
- **Distance Matrix API** (Transport Orders)
- **GeoCoding API** (assign latitude and longitude to all orders)
- **Maps Embed API** (Sales orders and Transport Orders)

![image](media://cdbfe730-4006-4ce4-8ba6-5e12380fff95)

6. Once the key has been** saved **and entered, there is a small delay while Google activates the key and assigns the restrictions.

> ✅ Refer to [https://developers.google.com/maps/api-security-best-practices#restricting-api-keys](https://developers.google.com/maps/api-security-best-practices#restricting-api-keys)  for more information.

# Update Frameworks

The API key may then be entered into Frameworks and tested using the Map API Configuration Utility.

> ✅ Refer to the [Map API Configuration Utility](https://sterlandsupport.atlassian.net/wiki/spaces/FRAM/pages/28405302) User Manual for more information.

> ⚠️ For customers with the **Trade Portal **you will need to manually update **tomcat/webapps/TPLive/config/configuration.json** file with the API key and copy it to the backup location. Please contact [Support](https://kb.myframeworks.com.au/page/support) for assistance.