You're all set!

To start developing, please head over to our developer documentation.

Activate the Google Maps JavaScript API

To get you started we'll guide you through the Google Developers Console to do a few things first:

  1. Create or choose a project
  2. Activate the Google Maps JavaScript API and related services
  3. Create appropriate keys
Continue

Get a Key/Authentication

All Google Maps JavaScript API applications require authentication.

  • Standard API users: If you're using the API under the standard plan, you must use an API key set up in a project of your choice. See more about API keys for the standard API.
  • Premium Plan users: If you're using the API under the Google Maps APIs Premium Plan you have two authentication options:
    • Use an API key set up in the Google Maps APIs Premium Plan project created for you when you purchased the Premium Plan.
        or
    • Use your client ID instead of an API key.

    See the Google Maps APIs Premium Plan section below for information on choosing the best authentication method.

Authentication for the standard API — API keys

To use the standard API, you must include an API key when loading the API.

Benefits of using an API key:

  • The API key allows you to monitor your application's API usage in the Google API Console. See Google API Console help for more information.
  • With a key, you have access to generous free daily quota, as well as the option increase your daily quota by enabling pay-as-you-go billing.
  • Registering for an API key ensures that Google can contact you about your application if necessary.

Get an API key

To get started using the Google Maps JavaScript API, click the button below, which guides you through the process of activating the Google Maps JavaScript API and any related services automatically.

Get a Key

Alternatively, follow these steps to get an API key:

  1. Go to the Google API Console.
  2. Create or select a project.
  3. Click Continue to enable the API and any related services.
  4. On the Credentials page, get an API key (and set the API key restrictions).
    Note: If you have an existing unrestricted API key, or a key with browser restrictions, you may use that key.
  5. To prevent quota theft, secure your API key following these best practices.
  6. (Optional) Enable billing. See Usage Limits for more information.


In the Google API Console, you can also look up an existing key or view a list of enabled APIs.

For more information on using the Google API Console, see API Console Help.

Types of API key restrictions

Google Maps APIs are available for Android or iOS apps, Web browsers, and via HTTP web services. APIs in any platform can use a generic (unrestricted) API key. You can optionally add a restriction (for example, HTTP referrer) to the API key. Once restricted, a key will only work on platforms that support that type of restriction. Learn more about keys and credentials.

Specify a key when loading the API

To specify a key, include it as the value of a key parameter when loading the API.

For example:

  <script async defer src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap"
  type="text/javascript"></script>

Authentication for Google Maps APIs Premium Plan customers

The information in this section applies only to the new Google Maps APIs Premium Plan, which became available on January 6, 2016.

Have a previous Maps APIs for Work or Maps API for Business license? See our Maps APIs for Work Licenses guide. To determine whether you have a previous license: In the Google Cloud Support Portal, click Maps: Usage Report on the left. If the ID at the top of the report is in the following format, you have the new Premium Plan:
gme-[company] & proj-[number] ([type])
Otherwise, you have a previous license.

When using the Google Maps JavaScript API with a Google Maps APIs Premium Plan license, you must authenticate your application with either an API key or a client ID. Note: If you have a previous Maps API for Business license, you must use a client ID, not an API key.

When deciding on which authentication method to use, consider the following:

  • API key (available to Google Maps APIs Premium Plan customers but not to holders of a previous Maps API for Business license) — By using an API key to authenticate requests, you can:
  • Client ID — By using your client ID (instead of an API key) to authenticate requests, you can:
    • Add the channel parameter to requests so you can view more detailed usage reports
    • View usage reports with more than 30 days of data in the Google Cloud Support Portal
    • Use Maps Analytics tools for the Maps JavaScript API

Get more information on reports available to Premium Plan customers.

Using an API key

To authenticate the Google Maps JavaScript API using an API key, click the button below which guides you through the process of getting an API key.

Important: In the project drop-down menu, be sure to select the project created for you when you purchased the Premium Plan. The project name starts with Google Maps APIs for Business or Google Maps for Work or Google Maps.*

Get a Key

Alternatively, follow these steps to get an API key:

  1. Go to the Google API Console.
  2. From the Project drop-down menu, select the Google Maps Premium project.*
  3. Click Continue.
  4. On the Credentials page, get an API key (and set the API key restrictions).
    Note: If you have an existing unrestricted API key, or a key with browser restrictions, you may use that key.
  5. To prevent quota theft, secure your API key following these best practices.

* Note: In the project drop-down menu, you must select the project created for you when you purchased the Premium Plan. The project name starts with Google Maps APIs for Business or Google Maps for Work or Google Maps. Important: If you have a previous Maps API for Business license, you must use a client ID, not an API key.


You can also look up an existing key in the Google API Console.

For more information on using the Google API Console, see API Console Help.

Specify a key when loading the API

To specify a key, include it as the value of a key parameter when loading the API.

For example:

  <script async defer src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap"
  type="text/javascript"></script>

Using a client ID

Authentication of the Google Maps JavaScript API using a client ID (instead of an API key) requires a unique client ID in combination with URL registration.

If you were previously using an API key for authentication and are switching to using a client ID, you must remove the key parameter before loading the API. The API will fail to load if both a client ID and an API key are included.

Your client ID

Upon purchasing your Google Maps APIs Premium Plan license, you will receive a welcome email from Google that contains your client ID. Your client ID is used to access the special features of Google Maps APIs Premium Plan. All client IDs begin with a gme- prefix.

This client ID is not a key. It will only work from URLs which you authorize, so you don't need to worry about keeping it secret.

Specify a client ID when loading the API

Specify your client ID as the value of a client parameter when loading the Google Maps JavaScript API:

<script async defer src="https://maps.googleapis.com/maps/api/js?client=YOUR_CLIENT_ID &v=3.26&callback=initMap"></script>

As shown in the above example, you must specify the release version (also referred to as the feature-stable version) or an earlier version, by appending a v=3.26 parameter. Applications that use the experimental version are not covered under the Google Maps APIs Premium Plan SLA.

Registering authorized URLs

To prevent a third party from using your client ID on their own website, the use of your client ID is restricted to a list of URLs that you specifically authorize.

To see the URLs you have already authorized or to authorize additional URLs:

  1. Log in to the Google Cloud Support Portal.
  2. In the left-hand menu, click Maps: Manage Client ID.

You can add up to 100 URLs at a time, to a total of 3000 URLs. If you require higher limits, please contact support.

The following considerations apply regarding URLs that are authorized:

The domain name or IP address does not have to be publicly accessible.
For example, http://myintranet and http://192.168.1.1 are valid entries.
All subdomains of a specified domain are also authorized.
For example, if http://example.com is authorized, then http://www.example.com is also authorized. The reverse is not true: if http://www.example.com is authorized, http://example.com is not necessarily authorized.
All subpaths of an authorized path are also authorized.
For example, if http://example.com is authorized, then http://example.com/foo is also authorized. In addition, because subdomains of a specified domain are also authorized, http://sub.example.com/bar is authorized.
Paths are case sensitive.
For example, http://www.example.com/ThisPath/ is not the same as http://www.example.com/thispath/.
You may restrict valid URLs to those using certain ports.
For example, if http://example.com:8080/foo is specified, that doesn't authorize http://example.com.
HTTP and HTTPS protocols are considered different URLs.
For example, if https://example.com is authorized, http://example.com is not necessarily authorized. If you'd like to authorize both at once, you may add a domain without using a protocol: example.com/

All the rules above are applied to each authorization, so you should take care to plan your authorizations carefully. For example, because all subpaths of a specified path are authorized, and all subdomains, you may end up authorizing pages that you didn't intend to. For example:

http://example.com/ also authorizes http://sub.example.com/path.

For more information, see Troubleshooting Google Maps APIs Premium Plan Authorization.

Send feedback about...

Google Maps JavaScript API
Google Maps JavaScript API
Need help? Visit our support page.