Try the next generation of Directions features with the Routes API.

Directions API overview

Stay organized with collections Save and categorize content based on your preferences.

The Directions API is a web service that uses an HTTP request to return JSON or XML-formatted directions between locations. Directions is available in several forms:

What can you do with Directions?

Directions lets you calculate directions between locations.

Why use Directions?

With Directions, you can retrieve more than simple driving directions. You can get directions for several modes of transportation, such as transit, driving, walking, or cycling.

To use Directions functionality and get serialization of requests and deserialization of responses, automatic retries, and some client validation of requests, try one of our client libraries.

If you want direction calculations that respond in real time to user input (for example, within a user interface element), then use the Directions API. If you're already using the Maps JavaScript API, then use the Directions service to get the Directions API's functionality.

How to use Directions

You can access the Directions API through an HTTP interface, with requests constructed as a URL string. The string contains an origin and a destination. You must also provide your API key with each Directions request.

https://maps.googleapis.com/maps/api/directions/json?origin=Disneyland&destination=Universal+Studios+Hollywood&key=YOUR_API_KEY

Follow this procedure to use the Directions API.

  1. If you want to use one of our client libraries instead of the standalone Directions API or the client-side web service, download and install it. Learn about our client libraries.
  2. Choose or create a project, enable billing, and enable the Directions API. See Set up in the Cloud Console.
  3. Create and restrict an API key, and add it to your code. See Use an API Key.
  4. View a Directions request and response and try a sample request.

Recommended content