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 get an API key which you can then add to your mobile app, website, or web server. The API key is used to track API requests associated with your project for usage and billing. To learn more about API keys, see the API Key Best Practices and the FAQs.

Console

You can use the Google Cloud Platform Console to manage projects, get API keys, and add API key restrictions. For more information about the console, see the Google Cloud Platform Console Help.

Quick guide

Step 1: Get an API key

Click the button below, to get an API key using the Google Cloud Platform Console. You will be asked to (1) pick one or more products, (2) select or create a project, and (3) set up a billing account. Once your API key is created you will be prompted to restrict the key's usage. (For more information, see Restricting an API key.)

Get Started

Step 2: Add the API key to your app

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

Detailed guide

Follow these steps to get an API key and add restrictions:

  1. Go to the Google Cloud Platform Console.
  2. From the Project drop-down menu, select or create the project for which you want to add an API key.
  3. From the Navigation menu, select APIs & Services > Credentials.
  4. On the Credentials page, click Create credentials > API key.
    The API key created dialog displays your newly created API key.
  5. On the dialog, click Restrict Key.
    (For more information, see Restricting an API key.)
  6. On the API key page, under Key restrictions, set the Application restrictions.
    • Select IP addresses (web servers, cron jobs, etc.).
    • Add the server IP addresses (see the examples).
    • Click Save.

Detailed guide for Premium Plan customers

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 and add restrictions:

  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. From the Navigation menu, select APIs & Services > Credentials.
  4. On the Credentials page, click Create credentials > API key.
    The API key created dialog displays your newly created API key.
  5. On the dialog, click Restrict Key.
    (For more information, see Restricting an API key.)
  6. On the API key page, under Key restrictions, set the Application restrictions.
    • Select IP addresses (web servers, cron jobs, etc.).
    • Add the server IP addresses (see the examples).
    • Click Save.

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 an 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.

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

  1. Go to the Google Cloud Platform Console.
  2. From the Project drop-down menu, select the project that contains the API key you want to secure.
  3. From the Navigation menu, select APIs & Services > Credentials.
  4. On the Credentials page, click the name of the API key that you want to secure.
  5. On the API key page, under Key restrictions, set the Application restrictions.
    • Select IP addresses (web servers, cron jobs, etc.).
    • Add the server IP addresses (see the examples).
    • Click Save.

Send feedback about...

Need help? Visit our support page.