
Travel Time API (also known as Distance Matrix API or Drive Time API) is a service that calculates travel time between different points on a map.
The idea behind it is quite simple: instead of manually estimating the time it takes to travel from one address to another, the API does it automatically. And it doesn't just take a straight line, but takes into account actual roads, traffic jams, and other factors.
Such calculations are needed wherever it is important to plan travel, in logistics, delivery services, and service organizations. The API can process hundreds or thousands of routes at a time and provide accurate travel time data for each one.
What is a Travel Time API?
Travel Time API is a software interface that calculates travel time between geographical points, taking into account real road conditions. Unlike simply measuring the distance in a straight line, the API analyzes many factors: current traffic jams, speed limits, road types, and modes of transportation.
A delivery service dispatcher plans routes for 15 couriers. Each courier must visit 8-12 addresses per shift. Manually calculating the optimal time for each route, taking into account traffic jams, is a task that takes several hours. The estimated Travel Time API solves this in seconds.
Key features of the modern API to get travel time
Traffic conditions:
- Current traffic jams and accidents;
- Road works and restrictions;
- Weather conditions.
Different modes of transport:
- Car (passenger, freight);
- Walking;
- Bicycle;
- Public transport.
Time factors:
- Departure and arrival times;
- Working hours of destinations;
- Seasonal traffic changes.
Travel Time API provides data for business decisions. A courier service promises the customer an accurate delivery time. A service company optimally distributes requests among technicians.
Travel Time API Many-to-One — What Does It Mean?
The Travel Time API many-to-one is a way to calculate travel time from multiple points to a single destination with a single request. It differs from regular requests and solves quite specific tasks.
The Travel Time API has three main types of queries:
- One-to-one: time from one point to another. Suitable for simple navigation tasks.
- Many-to-many: time between all pairs of points. Used for complex route optimization.
- Many-to-one: time from multiple points to one. Solves tasks of gathering, centralizing, and planning meetings.
Let's say a logistics company collects goods from 100 retail outlets to one distribution center. Instead of 100 separate requests, the system makes one many-to-one request and gets the full picture: which points are within two hours' reach, the optimal time windows for collection, and the prioritization of routes by time.
Many-to-one is often needed for planning corporate events (employees traveling to the office), optimizing emergency response services, reverse logistics, and public transportation planning.
Travel Time API's many-to-one turns a complex coordination task into a simple technical query, saving time on planning and increasing operational efficiency.
Estimate Travel Time with Python
Travel Time API Python integration provides good opportunities for automating logistics processes. Python, with its libraries, is well-suited for working with REST APIs and processing geographic data.
Travel Time API works according to standard REST architecture. In practice, this means simple integration via HTTP requests — no special libraries need to be installed. The standard requests module is sufficient.
The main parameters for requests are fairly standard. Coordinates and addresses are specified via origins (starting points) and destinations (end points). Up to 100 elements can be processed in a single request.
Travel modes include car (default), walking, bicycling, and transit (public transport).
There are several options for taking traffic into account: traffic_model can be optimistic, pessimistic, or realistic. You can specify departure_time to take traffic jams into account or arrival_time to estimate the arrival time.
The units of measurement can be selected between metric (meters and seconds) and imperial (miles and seconds).
Practical workflow in Python:
- Data preparation: A list of addresses or coordinates is loaded from a database or CSV file.
- Request formation: Addresses are grouped into batches of 100 elements to optimize requests.
- Sending the request: Via requests.get() with the necessary parameters.
- Processing the response: The JSON response is parsed, and the data is saved in a convenient format.
- Error handling: API limit monitoring and retries in case of temporary failures.
Optimization for large volumes
When working with thousands of addresses, the Estimate Travel Time API allows you to process up to 100 elements per request. This is 100 times faster than one-to-one requests. Python easily automates this logic: batching, parallel requests, and caching results.
The result is a system that processes tasks in minutes that would take days to complete manually.
How Travel Time API from Distancematrix.ai works
The Distance Matrix API returns two main parameters: travel time in seconds and distance in meters. The API finds the fastest route between the specified coordinates or addresses.
The mechanics are quite straightforward — you send a request with the starting and ending points, and the API processes the data and returns the result. You can use either exact coordinates or regular addresses.
This approach allows you to quickly obtain data on the distance and travel time between any two points on the map, which is the basis for most route planning tasks.
Request Example
The API request uses a simple structure that specifies the origin and destination coordinates, along with your access token:
https://api.distancematrix.ai/maps/api/distancematrix/json?origins=Westminster Abbey, 20 Deans Yd, Westminster, London SW1P 3PA, United Kingdom&destinations=St John's Church, North End Rd, Fulham, London SW6 1PB, United Kingdom&key=<your_access_token>
- origins
: The starting point. - destinations
: The endpoint. - key
: Your unique access token to authenticate the request.
Response Example
When you send the request, the API responds with a detailed JSON object containing information about the distance and travel time.
{
"destination_addresses": [
"Westminster Abbey, Westminster, London SW1P 3PA, UK"
],
"origin_addresses": [
"Chapel, Fulham, London SW6 1BA, UK"
],
"rows": [
{
"elements": [
{
"distance": {
"text": "4.7 miles",
"value": 7563.898
},
"duration": {
"text": "31 min",
"value": 1860.0
},
"duration_in_traffic": {
"text": "31 min",
"value": 1860.0
},
"status": "OK"
}
]
}
],
"status": "OK"
}
Key Data Points in the Response
- destination_addresses
: The address of the destination. - origin_addresses
: The address of the origin. - distance
: The distance between the origin and destination in both text (e.g., "4.7 miles") and numeric (e.g., 7563.898 meters) formats. - duration
: The estimated travel time under normal traffic conditions (e.g., 31 minutes). - duration_in_traffic
: Travel time considering current traffic conditions (if available). - status
: Indicates the success of the request (e.g., "OK").
How Travel Time APIs Are Priced — Charge per Read Explained
Logistics companies face the same problem: they need to quickly calculate the optimal routes for dozens of drivers and hundreds of delivery points. It seems like a simple task. But when it comes to paying for APIs, many find an unpleasant surprise in their bills.
Let's take a typical situation: 50 drivers need to visit 200 addresses. That means 10,000 travel time calculations. With standard pricing, such an operation can cost hundreds of dollars per day.
How the standard “pay per request” model works
Most services use the travel time API charge per read model — a fairly simple scheme: each request for “how long does it take to travel from A to B” costs a certain amount. This is the standard approach in the industry.
Let's say a food delivery service has 10 restaurants and 20 couriers. With each new order, the system must determine which courier is closest to the desired restaurant. That's 200 calculations per decision. If there are 100 such decisions per day, that's 20,000 API calls.
Google Routes API charges $0.005 per item for basic requests. Total: $100 per day, or $3,000 per month. For many companies, this is a significant expense.
Problems that arise as the business grows
The main difficulty with the traditional model is the unpredictability of costs. Have you doubled the number of deliveries? API costs can quadruple due to more complex distribution logic.
This creates a strange situation: developers start to skimp on calculation accuracy in order not to exceed the budget. As a result, routing quality suffers.
There is another side to the problem. When testing new algorithms, each request costs money. This discourages experimentation and improvement.
An alternative approach: the element model
Distancematrix.ai offers a different payment scheme for matrix elements rather than individual requests.
The idea is this: if you need to calculate the distances between 100 departure points and 100 destinations, this counts as 10,000 elements in a single request. Not 10,000 separate API calls, but one massive request.
The practical difference is quite noticeable. With Google's standard model, 50 drivers covering 200 points means 10,000 separate requests at $0.005 each — that's $50 per session. With Distancematrix.ai, those same 50 drivers and 200 points count as 10,000 elements in a single request at $0.002 per element — works out to $20 per session. The savings come to around 60%.

Where it is particularly beneficial
The advantages of the element model become more noticeable as the scale of operations increases.
A regional delivery service with 30 drivers serves 500 addresses per day. With the standard model, this costs $75 per day for API calls. With the element model, it costs $30. The annual savings amount to approximately $16,400.
For large logistics operations, the figures are even more impressive. A company with 100 service technicians and 300 calls per day saves approximately $32,850 per year.
How the benefits grow with scaling
Distancematrix.ai has a progressive pricing scale — the more elements you use, the cheaper each thousand costs:
- Up to 100,000 elements: $2 per 1,000 elements;
- From 100,000 to 300,000: $1.6 per thousand;
- From 300,000 to 500,000: $1.25 per thousand;
- Over 500,000: $1 per thousand elements.
For comparison, with large volumes, the savings relative to standard rates reach 68%.
Practical advantages for development
The element model eliminates several headaches. It is easier to plan your budget — the cost depends on the size of the task, not on how it is solved.
Developers can experiment with algorithms without worry. Additional calculations to improve accuracy do not entail direct additional costs.
You can afford to make more detailed calculations without worrying about the API call counter. This directly affects the quality of routes and customer satisfaction.
This is especially important in logistics, where every minute saved on the road translates into real money.

How the Drive Time API Saves Time and Improves Decisions
Drive Time API is revolutionizing the approach to planning in companies where travel time is critical to operations. Instead of rough estimates and manual calculations, businesses now have access to accurate data for decision-making.
Real estate example
The real estate agency helped the client find a home within 30 minutes of work. Previously, the agent spent hours studying maps and estimating travel time to each area.
With Drive Time API, the process changed. The API calculated the time from the client's office to 50 areas of the city, took traffic jams into account, and excluded unsuitable options. In 2 seconds, the system generated a list of 12 suitable locations.
The result: the agent focused on showing relevant properties, the client saved time on viewings, and the deal was closed 40% faster.
Recruitment example
An IT company was looking for a developer for one of its three offices in the city. The HR agency used Drive Time API to analyze candidate availability: it calculated the travel time from each candidate's address to all offices, determined the optimal office for each applicant, and offered a hybrid schedule for candidates with long commutes.
The result: the time to fill a vacancy was reduced from 3 months to 6 weeks, and the percentage of accepted offers increased from 60% to 85%.
Measurable time savings
In logistics, dispatchers spend 75% less time planning routes. In customer service, appointment planning time has been reduced from 15 minutes to 2 minutes. In sales, managers plan appointments 60% more efficiently.
Drive Time API turns planning from an art into a science, replacing guesswork with accurate calculations.
The Travel Time API: Conclusion
Travel Time API has become an important tool for companies where travel time affects work efficiency and profits. For startups with local deliveries and corporations with global logistics, accurate travel time calculations have long ceased to be a luxury.
The API is most often used in logistics and delivery — it is necessary to build optimal courier routes and plan time windows. Route planning is required by fleet managers, service companies, and sales representatives. In general, anyone who deals with questions of “who, where, and when” daily. Geolocation services also depend on accurate travel times — real estate search apps, recruiting platforms, and booking services.
Distancematrix.ai offers simple integration via REST API, worldwide coverage that takes local road conditions into account, and flexible pricing from free trials to corporate plans. Plus, technical support helps you get your projects up and running quickly.
Modern businesses cannot build solutions based on approximate travel time estimates. Travel Time API turns complex calculations into simple API calls, so companies can focus on developing their core business rather than solving technical problems.
Want to optimize your processes? Try the free version of Travel Time API from Distancematrix.ai — integration takes just a few minutes, and the results are measured in hours saved and additional revenue.
Start for free and get instant access to all Distancematrix.ai products and features
Read API documentation