How to Add a Domain that Works with All Google Maps Platform APIs

July 3, 2024


In this guide, we will walk you through the steps to add a domain that works with all Google Maps Platform APIs using the Google Cloud Console. This includes creating an account, setting up billing, generating an API key, and adding necessary restrictions.

Step 1: Create a Google Cloud Account

To get started, you need to create a Google Cloud account:

  1. Go to the Google Cloud Console.
  2. Click on “Create account” and follow the prompts to set up your account.

Step 2: Set Up Billing

Next, you need to set up billing for your Google Cloud account:

  1. Sign in to the Manage billing accounts page.
  2. Click on “Create account”.
  3. Enter the name of your Cloud Billing account.
  4. Select your country and currency (note that these cannot be changed later).
  5. Choose or create a Google payments profile to associate with this billing account.
  6. Click “Submit and enable billing”.

For more detailed instructions, refer to the Google Cloud Billing documentation.

Step 3: Create a New Project

Now, create a new project in the Google Cloud Console:

  1. In the Cloud Console, click on the project dropdown at the top.
  2. Click “New Project”.
  3. Enter a name for your project and click “Create”.

Step 4: Enable Google Maps Platform APIs

Enable the necessary APIs for your project:

  1. Go to the APIs & Services dashboard.
  2. Click “Enable APIs and Services”.
  3. Search for and enable the APIs you need, such as the Maps JavaScript API and Places API.

For more information, visit the Google Maps Platform Getting Started page.

Step 5: Create an API Key

Generate an API key to use with the Google Maps Platform APIs:

  1. Go to the Credentials page.
  2. Click “Create Credentials” and select “API key”.
  3. Your new API key will be displayed. Copy and store it securely.

For more details, see the Google Cloud API Keys documentation.

Step 6: Add Domain Restrictions

To restrict your API key to specific domains:

  1. On the API key details page, under “Application restrictions”, select “HTTP referrers (web sites)”.
  2. Add your domain in the format: *.yourdomain.com/*.
  3. Click “Save”.

Step 7: Set API Restrictions

To restrict your API key to specific APIs:

  1. On the API key details page, under “API restrictions”, select “Restrict key”.
  2. Choose “All Google Maps Platform APIs” from the dropdown.
  3. Click “Save”.

For more information on adding restrictions, refer to the Google Cloud API Key Restrictions documentation.