![](http://developers.google.com/static/maps/images/landing/hero_distance_matrix_api.png)

# Distance Matrix API (Legacy)

> [!NOTE]
> This product is in [Legacy status](https://developers.google.com/maps/legacy.md.txt). As of October 2026, Distance Matrix API (Legacy) can no longer be enabled for new Google Cloud projects. Existing projects remain fully supported. For new features and improved performance, [migrate to the
> Routes API](https://developers.google.com/maps/documentation/routes/migrate-routes).

Get the travel distance and time for a matrix of origins and
destinations.

*** ** * ** ***

## Get Started

Start building with the Distance Matrix API (Legacy). [](http://developers.google.com/maps/documentation/distance-matrix/cloud-setup.md.txt)

### [Get started with Google Maps Platform](http://developers.google.com/maps/documentation/distance-matrix/cloud-setup.md.txt)

Create an account, generate an API key, and start building. [](http://developers.google.com/maps/documentation/distance-matrix/start.md.txt)

### [Make a distance matrix request](http://developers.google.com/maps/documentation/distance-matrix/start.md.txt)

Get the travel distance and journey duration for a matrix of origins and destinations. [](http://developers.google.com/maps/documentation/distance-matrix/client-library.md.txt)

### [Client libraries](http://developers.google.com/maps/documentation/distance-matrix/client-library.md.txt)

Use Java, Python, Go, or Node.js client libraries to work with Google Maps Services on your server. [](http://developers.google.com/maps/documentation/distance-matrix/start.md.txt#openapi-spec)

### [OpenAPI Specification](http://developers.google.com/maps/documentation/distance-matrix/start.md.txt#openapi-spec)

Get the OpenAPI specification for the Distance Matrix API, also available as a Postman collection.

## Features

Learn about core features of the Distance Matrix API.

### [Get traffic information](http://developers.google.com/maps/documentation/distance-matrix/distance-matrix.md.txt#distance-matrix-advanced)

Make a distance matrix request that calculates travel time based on current traffic conditions.

### [Specify side of road](http://developers.google.com/maps/documentation/distance-matrix/distance-matrix.md.txt#location-modifiers)

Specify whether a calculated route should pass through a particular side of the road.

*** ** * ** ***

## Example app

Run live code samples on your local machine and favorite code playgrounds with the Maps JavaScript API. [](http://developers.google.com/maps/documentation/javascript/examples/distance-matrix.md.txt)

### [Distance Matrix Service](http://developers.google.com/maps/documentation/javascript/examples/distance-matrix.md.txt)

Use the DistanceMatrixService object to fetch the distances between a set of locations.

*** ** * ** ***

## Help \& support

Get help. Give help. Join the community. [![](http://developers.google.com/static/site-assets/logo-stack-overflow.svg)](https://stackoverflow.com/questions/tagged/google-maps)

### [Stack Overflow](https://stackoverflow.com/questions/tagged/google-maps)

Get help. Give Help. Build Maps karma.
[![](http://developers.google.com/static/maps/images/landing/buganizer.svg)](https://issuetracker.google.com/issues/new?component=188832)

### [Issue Tracker](https://issuetracker.google.com/issues/new?component=188832)

Report a bug or open a feature request.
[![](http://developers.google.com/static/maps/images/landing/warning.svg)](https://status.cloud.google.com/maps-platform/)

### [Platform status](https://status.cloud.google.com/maps-platform/)

Find out about platform incidents and outages.
[![](http://developers.google.com/static/maps/images/landing/help.svg)](http://developers.google.com/maps/documentation/distance-matrix/support.md.txt)

### [Support](http://developers.google.com/maps/documentation/distance-matrix/support.md.txt)

Get help from the Google Maps Platform team.