Skip to content
GuidesBlogPlaygroundDashboard

Get async optimization result

OptimizeJobStatus Optimize.Retrieve(OptimizeRetrieveParamsparameters, CancellationTokencancellationToken = default)
GET/api/v1/optimize/{job_id}

Get async optimization result

ParametersExpand Collapse
OptimizeRetrieveParams parameters
required string jobID
ReturnsExpand Collapse
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

Get async optimization result

OptimizeRetrieveParams parameters = new() { JobID = "job_id" };

var optimizeJobStatus = await client.Optimize.Retrieve(parameters);

Console.WriteLine(optimizeJobStatus);
{
  "status": "completed",
  "result": {
    "features": [
      {
        "geometry": {
          "coordinates": [
            2.3522,
            48.8566
          ],
          "type": "Point"
        },
        "properties": {
          "cost_s": 0,
          "cumulative_cost_s": 0,
          "waypoint_index": 0
        },
        "type": "Feature"
      }
    ],
    "optimization": "optimization",
    "roundtrip": true,
    "total_cost_s": 0,
    "type": "FeatureCollection"
  }
}
Returns Examples
{
  "status": "completed",
  "result": {
    "features": [
      {
        "geometry": {
          "coordinates": [
            2.3522,
            48.8566
          ],
          "type": "Point"
        },
        "properties": {
          "cost_s": 0,
          "cumulative_cost_s": 0,
          "waypoint_index": 0
        },
        "type": "Feature"
      }
    ],
    "optimization": "optimization",
    "roundtrip": true,
    "total_cost_s": 0,
    "type": "FeatureCollection"
  }
}