Live map example
Loading the Mapsource map…
Request / Response
Optimize a set of stops
Keep the first and last stops fixed while solving the visit order in between.
API call
curl --fail-with-body "https://api.mapsource.io/optimize" \
-H "Authorization: Bearer $MAPSOURCE_API_KEY" -H "Content-Type: application/json" \
--data '{"locations":[{"lat":47.6062,"lon":-122.3321},{"lat":47.6205,"lon":-122.3493},{"lat":47.5988,"lon":-122.3317},{"lat":47.6097,"lon":-122.3425}],"costing":"auto"}'Example response
{"schema":"mapsource-optimized-route.v1","profile":"auto","order":[0,2,1,3],"summary":{"distanceKm":8.7,"durationSeconds":1280},"geometry":{"type":"LineString","coordinates":[[-122.3321,47.6062],[-122.3317,47.5988],[-122.3493,47.6205],[-122.3425,47.6097]]}}Reorder visits, not your business
Mapsource solves the geographic visit sequence for supported travel profiles. Scheduling, capacity, time windows and proprietary operating constraints remain in your application.
Return a route you can use
The result includes indices into the submitted stops, normalized locations, a summary and renderable geometry so the optimized order stays connected to the original records.
Service details
Built around a published contract
Inputs, outputs and limits remain inspectable in the generated API reference.
- Endpoint
- POST /api/optimize
- Stops
- 3–20 coordinates
- Fixed
- First and last stops
- Output
- Visit order and route geometry