
Route Matrix API
Get travel times and distances for up to 1000 source or target locations at once
Solve logistics and route optimization issues for your team or your customers with our Route Matrix API:
- Use Geoapify Route Matrix API works as input for route optimization or analytics.
- Our Routing Matrix API returns the distance and travel times between each pair of provided sources and targets.
- Get results optimized for different travel modes including driving, trucking, cycling and walking.
Need to build a solution for your customers? Our API is an ideal starting point. Use it to create an optimal travel planning experience for your customers.
On this page
Try Route Matrix API
Try out the Route Matrix API right here. Click the map to add origin and destination locations.
Go to the API Playground to try out more distance matrix features. See how easy it is to avoid tolls, ferries, or highways. You can also change the route type (choose from balanced, short, or less maneuvers), or allow for rush hour traffic.
Route Matrix API Use Cases
Use our Routing Matrix API to solve routing and logistics problems for your staff, or your customers:
Solve routing problems and display travel time and distance information
- Optimize routes for cleaning crews, maintenance, salesman, delivery drivers, food drivers and more. Solve the vehicle routing problem.
- Analyze reachability and travel times using isochrones and isodistances. Ideal for routing, and also when checking out potential business locations. Setting up a corner store? See how many homes are in easy driving or walking reach. Starting a guest house or hotel? See how close the location is to attractions and transport hubs.
- Use a distance matrix to let your customers choose a location on a map and see what amenities are reachable and how long it will take. Customers can look for “stores near me” for example and get real travel times and distances.
- Estimate travel costs for locations.
- Use travel and time values to estimate road conditions for a route.
- Find nearest places and get estimated travel times. For example, you can use it for a store locator. Tourist businesses can show customers what kind of amenities are nearby. Real estate agents can let customers check out schools or shops near their new home.
Use Route Matrix API as input for route optimization libraries
Our Route Matrix API works as required input for route optimization libraries such as Vroom or OR-tools.
Create new solutions or use the ones we've created for you
We used our Routing Matrix API to build our optimization and analytics APIs. Check them out and see if one of them solves your problem!

Route Planner API
Our Route Planner API solves route optimization and route planning problems including VRP and its variants.
Use it to build optimal delivery and pickup routes, generate schedules for your agents, and plan the best use of shared resources such as tools.

Isolines API
Our Isolines API calculates isochrones and isodistances.
Use it to optimize travel times, analyze reachability, and discover promising potential business locations.
Features and Capabilities
Get time in seconds and distance in meters or miles
Route Matrix API returns highly accurate information with time in seconds and distance in meters or miles from the provided origins and destinations. Here's an example of a result object:
- [] 3 items▶
- [] 3 items▶
- [] 3 items▶
- "metric"
- "meters"
- "drive"
Set travel modes and restrictions
Our API supports the travel modes and travel inputs from Routing API, which makes it easy to calculate distances and travel times for cars, trucks, bicycles, hiking and walking. And you can tell the API to avoid specific parts of the road such as tolls, highways or ferries.
Allow for traffic flow
Route Matrix API uses approximated traffic data to simulate traffic flow at rush hour, so you can allow for that in your distance matrix.
Specify the type of route
Our API can return balanced routes, shorter routes, or those with less maneuvers. Balanced is the default, with a compromise between time, cost, and distance. Short routes optimize by distance. And routes with less maneuvers add additional penalties to the route for maneuvers.
Calculate exact routes
Because Route Matrix and Routing API have the same parameters, you can calculate the exact route with the Routing API.
Getting started
Our API works via HTTP and has simple data formats. Getting started is easy:
Step 1. Register and get an API Key.
You'll need an API Key to start. Register on MyProject Geoapify and get your key.
Step 2. Generate and call HTTP Post request.
Generate an HTTP Post request with input data and make the call. Use our Playground to try it out, and check out our documentation to learn more about the Route Matrix API request/response structure.
Here's an example of generating and sending an API request:
- JavaScript
- Python
- PHP
- Java
const body = {"mode":"drive","sources":[{"location":[0.29088658483271956,41.428888210134915]},{"location":[0.6067435184261285,41.515322262551194]},{"location":[1.0242239871765833,41.57493564781842]}],"targets":[{"location":[-4.52604990731777,39.59765683264655]},{"location":[-2.972263097038308,39.59765683264655]},{"location":[-1.3243073891652557,39.615794666459436]}]};
fetch('https://api.geoapify.com/v1/routematrix?apiKey=YOUR_API_KEY', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(body)
})
.then(res => res.json())
.then(res => console.log(res));
How Much Does It Cost?
We've kept our pricing straightforward. The number of credits you need per request depends on the number of source and target elements or matrix elements.
We offer a discount for larger matrices. If the smallest dimension of your matrix is more than 10 elements, we will reduce it to 10. The formula is as follows:
Max(NUMBER_OF_SOURCES, NUMBER_OF_TARGETS) * Min(NUMBER_OF_SOURCES, NUMBER_OF_TARGETS, 10)
- Example: for 5 sources and 7 targets the API call will cost Max(5, 7) * Min(5, 7, 10) = 7 * 5 = 35 credits.
- Another example: for 300 sources and 500 targets the API call will cost Max(300, 500) * Min(300, 500, 10) = 500 * 10 = 5000 credits.
Use our Credits Calculator to figure out which Pricing Plan is best for you.
Need help figuring it out? Get in touch and we'll be happy to help you find the ideal solution for your business.
FAQ
How many locations can I send to the Route Matrix API in one request?
By default, the Route Matrix API can handle 1000 matrix elements at once. You can specify the dimensions, such as 1000x1, 20x50 or 31x32 dimensions. If you need more, please contact us. We will find a solution for you!
Can I calculate a distance matrix with bigger dimensions?
Yes. The elements of the matrix are independent, so you can split a bigger matrix into as many smaller ones as you need to do the calculation.
Can we use the Geoapify Route Matrix to build a Route Optimizer solution and sell to our customers?
Sure! We don't have restrictions for competitive APIs.
Can you provide custom conditions for high volumes?
Yes! Contact us and we'll find the best solution for you.

Get Time and Distance Data For Multiple Locations
Solve route optimization problems for your business, your fleet, or your customers, with our Routing Matrix API.
Got questions? Get in touch and we'll help you get started.