New pricing changes went into effect on July 16, 2018. For more information, check out the Guide for Existing Users.

Get API Key

To use the Roads API, you must register your app project on the Google Cloud Platform Console and get a Google API key which you can add to your app or website.

Quick guide to getting a key

Step 1: Get an API Key from the Google Cloud Platform Console

Click the button below, which guides you through the process of registering a project in the Google Cloud Platform Console, activates the Roads API automatically, and generates a generic, unrestricted API key.

Get Started

Notes:

  • Tip: During development and testing, you can register a project for testing purposes in the Google Cloud Platform Console and use a generic, unrestricted API key. When you are ready to move your app or website into production, register a separate project for production, create a server-restricted API key, and add the key to your application.
  • Premium Plan customers: For production-ready apps, you must use a server-restricted API key that is set up in the Google Maps APIs Premium Plan project created for you when you purchased the Premium Plan.
  • For more information, see the detailed guides below for Standard Plan and Premium Plan customers.

Step 2: Add the API key to your application

When loading the Roads API, substitute YOUR_API_KEY in the code below with the API key you got from the previous step.

https://roads.googleapis.com/v1/snapToRoads?path=-35.27801,149.12958|-35.28032,149.12907|-35.28099,149.12929|-35.28144,149.12984|-35.28194,149.13003|-35.28282,149.12956|-35.28302,149.12881|-35.28473,149.12836 &interpolate=true &key=YOUR_API_KEY

More about API keys

  • The API key allows you to monitor your application's API usage in the Google Cloud Platform Console. See Google Cloud Platform Console help for more information.
  • If you are a Standard Plan customer, with an API key you have access to generous free daily quota, as well as the option to increase your daily quota by enabling pay-as-you-go billing.
  • If you are a Premium Plan customer, you must use an API key to access all the custom features and benefits of your Premium Plan.
  • Registering for an API key ensures that Google can contact you about your application if necessary.

Detailed guide for users of the standard Roads API

Follow these steps to get an API key:

  1. Go to the Google Cloud Platform Console.
  2. Create or select a project.
  3. Click Continue to enable the API.
  4. On the Credentials page, get an API key.
    Note: If you have an existing unrestricted API key, or a key with server restrictions, you may use that key.
  5. From the dialog displaying the API key, select Restrict key to set a server restriction on the API key.
  6. In the Key restriction section, select IP addresses (web servers, cron jobs, etc.), follow the on-screen instructions to add server IP addresses, then click Save. Read more about restricting API keys.
  7. (Optional) Enable billing. See Usage Limits for more information.


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

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

Detailed guide for users of the Google Maps APIs Premium Plan license

When using the Roads API with a Google Maps APIs Premium Plan license, you must authenticate your application with an API key.

By using an API key to authenticate your applications, you can:

Get more information on reports available to Premium Plan customers.

Follow these steps to get an API key:

  1. Go to the Google Cloud Platform Console.
  2. From the Project drop-down menu, 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.
  3. Click Continue.
  4. On the Credentials page, get an API key.
    Note: If you have an existing unrestricted API key, or a key with server restrictions, you may use that key.
  5. From the dialog displaying the API key, select Restrict key to set a server restriction on the API key.
  6. In the Key restriction section, select IP addresses (web servers, cron jobs, etc.), follow the on-screen instructions to add server IP addresses, then click Save. Read more about restricting API keys.

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

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

Restricting an API key

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

Tip: Before moving your app or website to production, you should secure your API key. Keys for the Roads API use the IP addresses (web servers, cron jobs, etc.) key restriction. Learn more about keys and credentials.

To add server restrictions to an existing, generic API key, do the following:

  1. Go to the Credentials page of the Google Cloud Platform Console.
  2. Select the project that contains the API key you want to edit.
  3. On the Credentials page, from the list of API keys, select the name of the API key to edit the details of the key.
  4. In the Key restriction section of the page, select IP addresses (web servers, cron jobs, etc.), follow the on-screen instructions to add server IP addresses, then click Save.

Feedback geben zu...