How to Add Multiple Stops to a Route
- API or service
- Routing API + Route Planner API
- Task
- Stops → ordered or optimized multi-leg route
- Examples
- Difficulty
- Beginner
- Time
- 7 min
Add multiple stops to a route
You have an origin, a destination, and one or more intermediate stops that must be visited in a known order. The Routing API calculates the road route through those waypoints and returns one route leg between each pair of stops.
By default, the request preserves the waypoint order. Set optimize_stops=true when one route has flexible intermediate stops and the Routing API should find a better visit order while keeping the origin and destination fixed. Use the Route Planner API for operational planning across jobs, shipments, or multiple agents.
Task flow: ordered stops → Routing API → route geometry, total distance and time, and one leg per stop pair.
Route through ordered stops
Put the origin first, the destination last, and intermediate stops between them. Separate waypoints with |; each default coordinate pair uses latitude,longitude order.
https://api.geoapify.com/v1/routing?waypoints=50.679023,4.569876|50.671000,4.575000|50.661705,4.578667&mode=drive&format=json&apiKey=YOUR_API_KEY
This request visits the three Belgian waypoints in exactly the supplied order and produces two legs.
Reduced response:
{
"results": [
{
"distance": 3166,
"time": 407.367,
"legs": [
{
"distance": 1912,
"time": 175.662
},
{
"distance": 1254,
"time": 231.704
}
]
}
]
}
Distances are meters and times are seconds with the default metric units. The route total equals the sum of its legs: 1912 + 1254 = 3166 meters.
Choose route-path, stop-order, or operational optimization
“Optimize a route” can refer to three different tasks: selecting the road path, reordering stops in one route, or planning work across jobs and agents. Choose the mechanism that matches the decision your application needs to make.
| Requirement | Use | What is optimized |
|---|---|---|
| Visit stops in the supplied order | Routing API with optimize_stops=false |
The path between each consecutive pair; waypoint order stays unchanged |
| Prefer a balanced, shorter, or lower-maneuver path | Routing API with type |
The road path between consecutive waypoints, not their order |
| Find a better order for intermediate stops in one route | Routing API with optimize_stops=true |
Intermediate waypoint order; the first and last waypoints remain fixed |
| Assign jobs or shipments across several vehicles or workers | Route Planner API | Assignment, stop order, schedules, capacities, skills, and breaks |
You can combine optimize_stops=true with type. The former changes the order of intermediate waypoints; the latter controls the preferred road path between consecutive waypoints in the resulting order.
Use How to Optimize the Order of Stops in a Route for a single origin-to-destination route with flexible intermediate stops. Use the Route Planner API when the input represents jobs, shipments, constraints, or multiple agents. After planning, pass each agent’s ordered waypoints to the Routing API when you need detailed route geometry or turn-by-turn navigation.