# Google Maps API Key Setup Guide

{% hint style="info" %}
A Google Maps API Key is only needed for accounts who are paying for a Custom Domain.  This is not necessary for account that are using the default "xxxx.bulkdelivery.app" domain.&#x20;
{% endhint %}

### Prerequisites

* A Google account
* Access to Google Cloud Console
* A domain where you'll be using the API
* A valid credit card for billing setup (required for Google Maps Platform APIs)

### Step 1: Access Google Cloud Console

1. Navigate to the [Google Cloud Console](https://console.cloud.google.com/)
2. Sign in with your Google account if not already signed in

### Step 2: Create or Select a Project

#### To Create a New Project:

1. Click on the project dropdown at the top of the page (next to "Google Cloud")
2. Click "NEW PROJECT" in the dialog that appears
3. Enter a project name (e.g., "BulkDelivery PRO Maps")
4. Optionally select an organization if you have one
5. Click "CREATE"
6. Wait for the project to be created and select it

#### To Use an Existing Project:

1. Click on the project dropdown at the top of the page
2. Select your desired project from the list

### Step 3: Set Up Billing Account

**Important:** Google Maps Platform APIs require a billing account with a valid payment method, even if you stay within the free tier limits.

#### Create or Link a Billing Account:

1. In the Google Cloud Console, navigate to "Billing" in the left sidebar
   * If you don't see "Billing", click the hamburger menu (☰) to expand the navigation
2. If you don't have a billing account:
   * Click "CREATE ACCOUNT" or "LINK A BILLING ACCOUNT"
   * Follow the prompts to create a new billing account
3. Enter your billing information:
   * Business or individual account type
   * Contact information
   * **Valid credit card details** (required)
   * Billing address
4. Review and accept the terms of service
5. Click "START MY FREE TRIAL" or "SUBMIT AND ENABLE BILLING"

#### Link Billing Account to Your Project:

1. After creating the billing account, you'll be prompted to link it to your current project
2. If not automatically prompted:
   * Go to "Billing" in the left sidebar
   * Click "LINK A BILLING ACCOUNT"
   * Select your billing account from the dropdown
   * Click "SET ACCOUNT"

#### Verify Billing Status:

1. In the left sidebar, go to "Billing"
2. Confirm that your project shows "Billing Enabled" status
3. You should see your billing account name listed

{% hint style="info" %}
Google provides a generous free tier for Maps APIs ($200 monthly credit), but billing setup is still required for verification purposes.
{% endhint %}

### Step 4: Enable Required APIs

#### Enable Maps JavaScript API:

1. In the left sidebar, navigate to "APIs & Services" > "Library"
2. In the search bar, type "Maps JavaScript API"
3. Click on "Maps JavaScript API" from the results
4. Click the "ENABLE" button
5. Wait for the API to be enabled

#### Enable Places API:

1. While still in the API Library, search for "Places API"
2. Click on "Places API" from the results
3. Click the "ENABLE" button
4. Wait for the API to be enabled

**Note:** If you receive an error about billing when trying to enable these APIs, ensure your billing account is properly linked to your project (see Step 3).

### Step 5: Create API Credentials

1. In the left sidebar, navigate to "APIs & Services" > "Credentials"
2. Click "CREATE CREDENTIALS" at the top of the page
3. Select "API key" from the dropdown menu
4. Your new API key will be generated and displayed in a dialog
5. **Important:** Copy and save this key securely - you'll need it for your application
6. Click "CLOSE" (don't click "RESTRICT KEY" yet - we'll do this in the next step)

### Step 6: Configure API Key Restrictions

#### Access Key Restrictions:

1. On the Credentials page, find your newly created API key
2. Click on the API key name or the pencil icon to edit it

#### Set Application Restrictions:

1. In the "Application restrictions" section, select "HTTP referrers (web sites)"
2. Click "ADD AN ITEM"
3. Enter your domain restrictions in one of these formats:
   * `https://yourdomain.com/*` (for your main domain)
   * `https://*.yourdomain.com/*` (to include all subdomains)
4. Add multiple entries if you need to support different environments (development, staging, production)

#### Set API Restrictions:

1. In the "API restrictions" section, select "Restrict key"
2. From the dropdown, select the APIs you want to allow:
   * ✅ Maps JavaScript API
   * ✅ Places API

#### Save Your Changes:

1. Click "SAVE" at the bottom of the page
2. Wait for the changes to take effect (may take a few minutes)


---

# 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://docs.bulkdelivery.pro/pro-tips/custom-domains/google-maps-api-key-setup-guide.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.
