You're all set!

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

Activate the Google Maps Roads 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 Roads API
  3. Create appropriate keys
Continue

Troubleshooting Errors

In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status.

The response contains an object with a single error object with the following keys:

  • code: This is the same as the HTTP status of the response.
  • message: A short description of the error.
  • status: A status code indicating the nature of the error.

For example, sending an invalid placeId parameter will return the following error:

{
  "error": {
    "code": 400,
    "message": "\"placeId\" value is malformed: \"aChIJqaknMTeuEmsRUYCD5Wd9ARM\"",
    "status": "INVALID_ARGUMENT"
  }
}

Possible errors include:

Code Status Message Troubleshooting
400 INVALID_ARGUMENT The key you provided is invalid. Your API key is not valid or was not included in the request. Please ensure that you've included the entire key, and that you've enabled the API for this key.
400 INVALID_ARGUMENT "\"path\" parameter contains an invalid value: ☃" Your request contained invalid arguments. The most likely causes of this error are:
  • A problem with your path parameter.
    Please ensure you have at least 1, and fewer than 100 points. Each point should be a pair of numbers separated by a comma, such as: 48.409114,-123.369158. Points should be separated by a pipe: '|'.
  • Your request included an invalid placeId.
  • Your request included both placeIds and a path. Only one of these parameters may be specified for each request.

This error will not be returned if a placeId is passed for a road which no longer exists, or for a place which is not a road.

403 PERMISSION_DENIED Unregistered request was blocked. Please sign up using Google Developers Console. Your API key is not valid or was not included in the request. Please ensure that you've included the entire key, and that you've enabled the API for this key.
404 NOT_FOUND HTTPS is required for this service. Ensure that you are sending requests to https://roads.googleapis.com/ and not http://roads.googleapis.com/.
429 RESOURCE_EXHAUSTED The request was throttled due to project QPS limit being reached. You've exceeded the requests per second per user limit that you configured in the Developers Console. This limit should be configured to prevent a single or small group of users from exhausting your daily quota, while still allowing reasonable access to all users.
429 RESOURCE_EXHAUSTED The request was throttled due to daily limit being reached. You've exceeded the daily quota for your project.

Exponential backoff

When requests fail, you should ensure that you retry requests with exponential backoff. For example, if a request fails once, retry after a second, if it fails again, retry after two seconds, then four seconds, and so on. This ensures that broken requests or wide scale failures do not flood Google’s servers, as many clients try to retry requests very quickly.

Send feedback about...

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