# Google API

## Make a Google Project and Enable APIs

To utilize the Maps JavaScript, Places API, and Geolocation API, you'll need an API key. This key serves as a unique identifier, authenticating requests linked to your project for usage and billing tracking.

To obtain an API key:

1. Visit the [Google API Console](https://console.developers.google.com/).
2. Click the project drop-down and either select an existing project or create a new one where you intend to add the API key.

<figure><img src="/files/h7L0lwF4CvJKrtyIDcYD" alt=""><figcaption></figcaption></figure>

3. Select the menu button and then choose **Library**.

<figure><img src="/files/GYjCGGSeSbA9wFstMNza" alt=""><figcaption></figcaption></figure>

4. Locate the **Maps JavaScript API** and activate it.

<figure><img src="/files/cukGGJI1KQL6D04SSzIx" alt=""><figcaption></figcaption></figure>

5. Return to the Library menu, locate the **Places API**, and enable it.

<figure><img src="/files/QIZeUYZktVQTBY2smHj0" alt=""><figcaption></figcaption></figure>

6. Return to the Library menu, locate the **Geocoding API**, and enable it.

<figure><img src="/files/dy4lvoHm1AzVnOPMGdqy" alt=""><figcaption></figcaption></figure>

7. Select the menu button, then go to **Credentials,** and click on **Create credentials > API key.**

<figure><img src="/files/vKhs5vi5yfz9uDp2vUEy" alt=""><figcaption></figcaption></figure>

The **API key created** dialog displays your newly created API key.

<figure><img src="/files/kMcjfs2EoIGDm03eNWIh" alt=""><figcaption></figcaption></figure>

Your new API key will be listed on the **Credentials** page under **API keys**. (Remember to [restrict the API key](https://developers.google.com/maps/documentation/javascript/get-api-key#restrict_key) before using it in production environment.)

8. Select **RESTRICT KEY**.

An application restriction manages which websites, IP addresses, or applications can utilize your API key. You can set one application restriction per key.

* Select **HTTP referrers (web sites)**
* Click on **ADD AN ITEM** and input your domain. Your domain should follow this format: `https://yourdomain.com/*` and `yourdomain.com/*`

<figure><img src="/files/llDNGu0UyXgMxWAjusDS" alt=""><figcaption></figcaption></figure>

* Select **Restrict key**.
* In the **Select APIs dropdown menu**, pick the **Maps JavaScript API**, **Places API,** and **Geocoding API**.

<figure><img src="/files/2j996qlTcABgliFf7OWV" alt=""><figcaption></figcaption></figure>

Now your API Key is ready for use.

9. Copy the API Key and paste it in your `.env` file.

```
GOOGLE_MAPS_API_KEY="" //API KEY
```

## Possible Problems

{% hint style="danger" %}
**IMPORTANT**\
Please ensure that everything is functioning correctly, including displaying maps and adding new client addresses on the order checkout page.

Additionally, you must enable Billing on the Google Cloud Project at [https://console.cloud.google.com/project/\_/billing/enable](https://console.cloud.google.com/project/_/billing/enable%20Learn%20more%20at%20https://developers.google.com/maps/gmp-get-started)

[Learn more at ](https://console.cloud.google.com/project/_/billing/enable%20Learn%20more%20at%20https://developers.google.com/maps/gmp-get-started)[https://developers.google.com/maps/gmp-get-started](https://console.cloud.google.com/project/_/billing/enable%20Learn%20more%20at%20https://developers.google.com/maps/gmp-get-started)
{% endhint %}

1. **Change Application Restrictions**

If your server/domain configuration doesn't accept **HTTP referrer** restrictions, try changing the application restrictions back to **None**.

<figure><img src="/files/nM6mKPfVqN1bvRauoLeI" alt=""><figcaption></figcaption></figure>

2. **Enable Billing on your project**

Occasionally, after adding the key, these features may cease to function. In such cases, it might be necessary to enable billing, depending on the Google account associated with the created project.

Find more information here: [Billing](https://console.cloud.google.com/project/_/billing/enable) or [Getting started with Google Maps Platform](https://developers.google.com/maps/gmp-get-started)

If you encounter ongoing issues with this configuration, please submit a ticket on our [website](https://natadtech.com).

## When you permit us to configure the Google project on your behalf

{% hint style="info" %}
Notice\
This type of support is not included in the standard package and may incur an additional fee. You can check and avail of this extra service on our official website [natadtech.com](https://natadtech.com) under the services page.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://foodmonkey-docs.natadtech.com/define-basics/google-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
