Skip to content
GuidesBlogPlaygroundDashboard

Optimize

Optimize route through waypoints
OptimizeResult Optimize.Create(OptimizeCreateParamsparameters, CancellationTokencancellationToken = default)
POST/api/v1/optimize
Get async optimization result
OptimizeJobStatus Optimize.Retrieve(OptimizeRetrieveParamsparameters, CancellationTokencancellationToken = default)
GET/api/v1/optimize/{job_id}
ModelsExpand Collapse
class OptimizeCompletedResult:

Completed optimization result as a GeoJSON FeatureCollection. Each Feature is a waypoint in optimized visit order. Top-level fields provide summary statistics.

required IReadOnlyList<Feature> Features

Waypoints in optimized visit order

required GeoJsonGeometry Geometry

GeoJSON Geometry object per RFC 7946. Coordinates use [longitude, latitude] order. 3D coordinates [lng, lat, elevation] are used for elevation endpoints.

required Coordinates Coordinates

Coordinates array. Nesting depth varies by geometry type: Point = [lng, lat], LineString = [[lng, lat], ...], Polygon = [[[lng, lat], ...], ...], etc.

One of the following:
IReadOnlyList<Double>
IReadOnlyList<IReadOnlyList<Double>>
IReadOnlyList<IReadOnlyList<IReadOnlyList<Double>>>
IReadOnlyList<IReadOnlyList<IReadOnlyList<IReadOnlyList<Double>>>>
required Type Type

Geometry type

One of the following:
"Point"Point
"LineString"LineString
"Polygon"Polygon
"MultiPoint"MultiPoint
"MultiLineString"MultiLineString
"MultiPolygon"MultiPolygon
required Properties Properties
required Double CostS

Travel time in seconds from the previous waypoint to this one (0 for the first waypoint)

required Double CumulativeCostS

Cumulative travel time in seconds from the start to this waypoint

required Long WaypointIndex

Position of this waypoint in the optimized visit order (0-based)

required Type Type
required string Optimization

Optimization method used (e.g. nearest_neighbor, 2opt)

required Boolean Roundtrip

Whether the route returns to the starting waypoint

required Double TotalCostS

Total travel time for the optimized route in seconds

required Type Type
class OptimizeJobStatus:

Status of an async optimization job. When completed, the result field contains the full OptimizeCompletedResult. When processing, the job is still running — poll again. Failed jobs return a standard Error response (HTTP 422), not this schema.

required Status Status

Current job state

One of the following:
"completed"Completed
"processing"Processing

Completed optimization result as a GeoJSON FeatureCollection. Each Feature is a waypoint in optimized visit order. Top-level fields provide summary statistics.

required IReadOnlyList<Feature> Features

Waypoints in optimized visit order

required GeoJsonGeometry Geometry

GeoJSON Geometry object per RFC 7946. Coordinates use [longitude, latitude] order. 3D coordinates [lng, lat, elevation] are used for elevation endpoints.

required Coordinates Coordinates

Coordinates array. Nesting depth varies by geometry type: Point = [lng, lat], LineString = [[lng, lat], ...], Polygon = [[[lng, lat], ...], ...], etc.

One of the following:
IReadOnlyList<Double>
IReadOnlyList<IReadOnlyList<Double>>
IReadOnlyList<IReadOnlyList<IReadOnlyList<Double>>>
IReadOnlyList<IReadOnlyList<IReadOnlyList<IReadOnlyList<Double>>>>
required Type Type

Geometry type

One of the following:
"Point"Point
"LineString"LineString
"Polygon"Polygon
"MultiPoint"MultiPoint
"MultiLineString"MultiLineString
"MultiPolygon"MultiPolygon
required Properties Properties
required Double CostS

Travel time in seconds from the previous waypoint to this one (0 for the first waypoint)

required Double CumulativeCostS

Cumulative travel time in seconds from the start to this waypoint

required Long WaypointIndex

Position of this waypoint in the optimized visit order (0-based)

required Type Type
required string Optimization

Optimization method used (e.g. nearest_neighbor, 2opt)

required Boolean Roundtrip

Whether the route returns to the starting waypoint

required Double TotalCostS

Total travel time for the optimized route in seconds

required Type Type
class OptimizeProcessingResult:

Async optimization in progress. Poll GET /api/v1/optimize/{job_id} until the status changes to completed or failed.

required string JobID

Job ID for polling the result

required Status Status

Always processing

class OptimizeRequest:

Route optimization (Travelling Salesman) request. Finds the most efficient order to visit a set of waypoints. Minimum 2 waypoints, maximum 50. For large inputs, the request may be processed asynchronously.

required IReadOnlyList<Waypoint> Waypoints

Waypoints to visit in optimized order (2-50 points)

required Double Lat

Latitude in decimal degrees (-90 to 90)

maximum90
minimum-90
required Double Lng

Longitude in decimal degrees (-180 to 180)

maximum180
minimum-180
Mode Mode

Travel mode (default: auto)

One of the following:
"auto"Auto
"foot"Foot
"bicycle"Bicycle
Boolean Roundtrip

Whether the route should return to the starting waypoint (default: true)

class OptimizeResult: A class that can be one of several variants.union

Optimization response — either a completed FeatureCollection with the optimized route, or an async job reference to poll.

class OptimizeCompletedResult:

Completed optimization result as a GeoJSON FeatureCollection. Each Feature is a waypoint in optimized visit order. Top-level fields provide summary statistics.

required IReadOnlyList<Feature> Features

Waypoints in optimized visit order

required GeoJsonGeometry Geometry

GeoJSON Geometry object per RFC 7946. Coordinates use [longitude, latitude] order. 3D coordinates [lng, lat, elevation] are used for elevation endpoints.

required Coordinates Coordinates

Coordinates array. Nesting depth varies by geometry type: Point = [lng, lat], LineString = [[lng, lat], ...], Polygon = [[[lng, lat], ...], ...], etc.

One of the following:
IReadOnlyList<Double>
IReadOnlyList<IReadOnlyList<Double>>
IReadOnlyList<IReadOnlyList<IReadOnlyList<Double>>>
IReadOnlyList<IReadOnlyList<IReadOnlyList<IReadOnlyList<Double>>>>
required Type Type

Geometry type

One of the following:
"Point"Point
"LineString"LineString
"Polygon"Polygon
"MultiPoint"MultiPoint
"MultiLineString"MultiLineString
"MultiPolygon"MultiPolygon
required Properties Properties
required Double CostS

Travel time in seconds from the previous waypoint to this one (0 for the first waypoint)

required Double CumulativeCostS

Cumulative travel time in seconds from the start to this waypoint

required Long WaypointIndex

Position of this waypoint in the optimized visit order (0-based)

required Type Type
required string Optimization

Optimization method used (e.g. nearest_neighbor, 2opt)

required Boolean Roundtrip

Whether the route returns to the starting waypoint

required Double TotalCostS

Total travel time for the optimized route in seconds

required Type Type
class OptimizeProcessingResult:

Async optimization in progress. Poll GET /api/v1/optimize/{job_id} until the status changes to completed or failed.

required string JobID

Job ID for polling the result

required Status Status

Always processing