Google Maps API Changes 2025: Migration Guide for Directions API & Distance Matrix API

Picture of Julia Wu

Julia Wu

Marketing, Master Concept
Understand the Google Maps API changes in 2025 and learn how to migrate from Google Directions API & Distance Matrix API to the Routes API with this step-by-step guide.

Effective 1 Mar 2025, the Google Maps Directions API and Distance Matrix API will be discontinued (moved to Legacy status). Customers currently using these APIs will still be able to access these APIs uninterrupted. Customers who have not yet enabled them on the Google Cloud Console will not be able to use them.

Understanding the Google Maps API Changes

The Directions API and Distance Matrix API are developer favorites, and are a popular choice for any application that needs routing and distance computation functionality. In 2022, Google introduced the Routes API, an upgraded service that merges the functionalities of the Directions and Distance Matrix APIs into a single solution. Starting March 1, 2025, the Routes API will fully replace both the Directions and Distance Matrix APIs, making it your preferred choice for routing and distance calculations.

Key Advantages of the Routes API

Improved Performance:

The Routes API is optimized for faster response times, ensuring that applications can retrieve routing and distance information more efficiently. This enhancement is crucial for real-time applications where speed is paramount.

Enhanced Features:

Beyond basic routing and distance calculations, the Routes API offers advanced capabilities such as:

  • Toll Information: Access detailed toll data for routes, allowing users to make cost-effective travel decisions.

  • Real Time Traffic: Incorporate real-time and predictive traffic conditions to provide accurate travel time estimations.

  • Route Optimization: Optimize routes with up to 25 waypoints based on various parameters, ensuring the most efficient path is chosen.

  • Travel Modes: One of the key advantages of the Routes API is the inclusion of bike, walk, and two-wheeler travel modes, which were previously unavailable in the Directions and Distance Matrix APIs.

Google Routes API Migration Guide

Transitioning to the Routes API involves several key steps:

Review Routes API Documentation:

Familiarize yourself with the Routes API documentation and migration guide provided by Google. This resource offers detailed instructions and best practices for a smooth transition.

Update API Calls:

Modify your application’s code to replace calls to the deprecated APIs with the corresponding Routes API calls. Ensure that all parameters and endpoints align with the new API specifications.

Directions API users should now use the Compute Routes endpoint of the Routes API:

POST: https://routes.googleapis.com/directions/v2:computeRoutes

Content-Type: application/json; charset=utf-8

X-Goog-Api-Key: YOUR_API_KEY

X-Goog-FieldMask: routes.duration,routes.distanceMeters,routes.polyline, routes.legs,routes.travelAdvisory.tollInfo,routes.legs.travelAdvisory.tollInfo,routes.travelAdvisory.speedReadingIntervals

{
	"origin": {
		"location": {
			"latLng": {
				"latitude": 49.1951165,
				"longitude": -123.1814285
			}
		}
	},
	"destination": {
		"location": {
			"latLng": {
				"latitude": 50.1042288,
				"longitude": -123.0840866
			}
		}
	},
	"travelMode": "DRIVE",
	"polylineQuality": "OVERVIEW",
    "routingPreference": "TRAFFIC_AWARE",
	"departureTime": "2025-10-23T15:00:00Z"
}

Distance Matrix API users should now use the Compute Route Matrix endpoint of the Routes API:

POST https://routes.googleapis.com/distanceMatrix/v2:computeRouteMatrix

Content-Type: application/json; charset=utf-8

X-Goog-Api-Key: YOUR_API_KEY

X-Goog-FieldMask: originIndex,destinationIndex,duration,distanceMeters,status

{
    "origins": [
        {
            "waypoint": {
                "location": {
                    "latLng": {
                        "latitude": 49.2682989,
                        "longitude": -123.1830924
                    }
                }
            }
        }
    ],
    "destinations": [
        {
            "waypoint": {
                "location": {
                    "latLng": {
                        "latitude": 49.254563,
                        "longitude": -123.1121977
                    }
                }
            }
        },
        {
            "waypoint": {
                "location": {
                    "latLng": {
                        "latitude": 49.3137275,
                        "longitude": -123.0540365
                    }
                }
            }
        },
        {
            "waypoint": {
                "location": {
                    "latLng": {
                        "latitude": 49.2351204,
                        "longitude": -123.1692661
                    }
                }
            }
        }
    ],
    "travelMode": "DRIVE",
    "routingPreference": "TRAFFIC_AWARE",
    "departureTime": "2025-10-23T15:00:00Z"
}

Testing:

Thoroughly test your application to ensure that the integration with the Routes API functions as expected. Pay particular attention to any new features or changes in data formats.

Monitor Usage and Costs: After migration, monitor your application’s usage of the Routes API and review billing statements to stay informed about any cost implications. Like other Google Maps Platform APIs, the Routes API uses a pay-as-you-go pricing model. There are three pricing tiers for both the Compute Routes and Compute Route Matrix endpoints – Basic ($5 CPM), Advanced ($10 CPM) and Preferred ($15 CPM). Which pricing tier your API call falls under depends on which fields you included in the X-Goog-FieldMask header.

Work with Google Maps Experts

At Master Concept, we specialize in helping businesses seamlessly integrate Google Maps Platform into their operations. As an official Google Maps Platform partner in the Asia-Pacific region, we have extensive experience working with companies of all scales across various industries to improve efficiency, enhance customer experiences, and optimize business performance. Whether you need guidance on migrating to the Routes API or want expert advice on Google Maps API implementation, we’re here to help.

Stay ahead of the latest Google Maps API updates. If you need help with the Google Routes API migration, or have questions about Google Maps Platform pricing 2025contact us today for expert support!

Leave Us Your Message
We are ready to talk!

Leave Us Your Message
We are ready to talk!

思想科技 Master Concept
微信公众号:Master_Concept

Can't Find What You Need? Join Our Latest Event!

Be the first to learn about
New Trends