Get Google Maps API Key: Step 2 – Enable APIs & Restrict Key

Setting up your Google Maps widget involves three simple steps. You're currently on:

In this step, you’ll enable the required Google Maps APIs and secure your API key with proper restrictions. API restrictions limit which Google services your key can use, while website restrictions make sure the key works only on selected websites.

For security reasons, we recommend restricting your API key before adding it. Since API keys are publicly accessible, restrictions help protect you from unauthorized use and quota abuse.

In this guide

1. Enable required APIs

1
Find or create your project

Make sure you’re working in the correct Google Cloud project by checking the project picker at the top of the Google Cloud Console: If you don’t have a project yet, create one by following Google’s official guide: How to create a Google Cloud project.

2

Check for required APIs
Go to Navigation MenuAPIs & ServicesEnabled APIs & services:

Scroll down to the list and check whether these three APIs are enabled:

  1. Directions API
  2. Geocoding API
  3. Maps JavaScript API

If all three APIs are listed, you’re good to go. If you don’t see any of them in the list, you'll need to activate them first.

If all three APIs are already enabled, you can move on to the next step: Restrict your API key.
3
Add missing APIs

If one or more APIs are missing, enable them manually:

  1. Click + Enable APIs and services.
  2. Search for the required API in the Library.
  3. Open the API page and click Enable.
  4. Repeat these steps for each required API.

It may take up to 5 minutes for newly enabled APIs to become fully active.

2. Restrict your API key

To protect your API key, restrict where it can be used and which APIs it can access.

1
Open your API key settings

Go to Navigation Menu → APIs & Services → Credentials:

Find your API key and click on it:

2
Set website restrictions
Under Application restrictions, select Websites and click Add:

We suggest limiting your API key to your domain and Elfsight apps only. Add each domain separately:

  1. *.elfsight.com/*
  2. https://your-domain.com/*
  3. https://www.your-domain.com/*
Replace your-domain.com with your actual website domain.

If you’re installing the widget via Share Link, also add:

  1. *.elf.site/*
  2. https://widget.elfsig.ht/*

If needed, you can restrict domains differently, depending on where you want the API key to work. Refer to the instructions on the right side of the API key editor or check Google's documentation on HTTP referrers.
3
Set API restrictions

This step restricts your API key to work only with the APIs enabled in Step 1. Scroll to API restrictions, select Restrict key, and allow access only to these three APIs:

  1. Directions API
  2. Geocoding API
  3. Maps JavaScript API

Click Save to apply all changes.

It may take up to 5 minutes for the restrictions to take effect.

✅ That’s it! Your API key is now properly secured and ready to be added to your widget.

Did this article answer your question? Share your feedback: Thanks for sharing your feedback. It helps us grow! There was a problem submitting your feedback. Please try again later.

Still looking for assistance? Contact Us Contact Us