The Optimized Route endpoint solves the Traveling Salesman Problem (TSP) to find the most efficient order for visiting multiple locations. This is ideal for delivery routes, service calls, and multi-stop trips where the stop order can be flexible.
This endpoint automatically reorders intermediate waypoints to minimize total travel time or distance. The first and last locations remain fixed.
Array of locations to visit (minimum 4, maximum 50). The first location is the start point, the last is the end point, and all intermediate locations will be reordered for optimization.
Road network topology (actual driving routes, not straight-line distances)
Traffic patterns (if time-based routing is enabled)
The algorithm uses a heuristic approach optimized for speed. For 10-20 stops, results are typically within 5% of the mathematically optimal solution and compute in under 2 seconds.
Minimum 4 locations required: The optimization requires at least 4 locations (start + 2 intermediate stops + end). For 2-3 locations, use the standard /route endpoint.
Maximum 50 locations: The endpoint supports up to 50 locations. For larger problems, consider breaking into multiple sub-routes or using batch optimization.