Skip to content
GuidesPlaygroundDashboard

Optimize route through waypoints

POST/api/v1/optimize

Optimize route through waypoints

Body ParametersJSONExpand Collapse
waypoints: GeoJsonGeometry { coordinates, type }

Waypoints to visit (GeoJSON MultiPoint geometry, minimum 2 points)

coordinates: array of number or array of array of number or array of array of array of number or array of array of array of array of number

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
array of number
array of array of number
array of array of array of number
array of array of array of array of number
type: "Point" or "LineString" or "Polygon" or 3 more
One of the following:
"Point"
"LineString"
"Polygon"
"MultiPoint"
"MultiLineString"
"MultiPolygon"
mode: optional "auto" or "foot" or "bicycle"

Travel mode (default: auto)

One of the following:
"auto"
"foot"
"bicycle"
roundtrip: optional boolean

Whether route returns to start (default: true)

ReturnsExpand Collapse
OptimizeResult = OptimizeCompletedResult { geometry, properties, status, type } or OptimizeProcessingResult { job_id, status }

Optimization response — either a completed GeoJSON Feature route or an async job reference

One of the following:
OptimizeCompletedResult = object { geometry, properties, status, type }

Completed optimization — GeoJSON Feature with optimized route

geometry: GeoJsonGeometry { coordinates, type }
coordinates: array of number or array of array of number or array of array of array of number or array of array of array of array of number

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
array of number
array of array of number
array of array of array of number
array of array of array of array of number
type: "Point" or "LineString" or "Polygon" or 3 more
One of the following:
"Point"
"LineString"
"Polygon"
"MultiPoint"
"MultiLineString"
"MultiPolygon"
properties: object { distance, duration, waypoint_order }
distance: optional number

Total distance in meters

duration: optional number

Estimated duration in seconds

waypoint_order: optional array of number

Optimized waypoint ordering

status: "completed"

Job status

type: "Feature"
OptimizeProcessingResult = object { job_id, status }

Async optimization in progress — poll with the job_id

job_id: string

Job ID for polling

status: "processing"

Job status

Optimize route through waypoints

curl https://plaza.fyi/api/v1/optimize \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $PLAZA_API_KEY" \
    -d '{
          "waypoints": {
            "coordinates": [
              0
            ],
            "type": "Point"
          }
        }'
Returns Examples