Overview
Multi-vehicle route optimization (VRP) powered by VROOM: you send JSON describing vehicles and tasks, you get back the optimal assignment and visit order. Distances come from the real OSRM road network — not straight lines.Conventions. Coordinates are
[lng, lat]. All timings are in seconds, all distances in meters. A time_window is a [start, end] pair with both ends inclusive. A “task” is either a job, a pickup or a delivery.Endpoint
Quickstart
Input structure
The request body is a JSON object. Onlyvehicles is required.
request-body.json
A problem with
shipments only (no jobs) is valid.Vehicles
Vehicle fields
Vehicle costs
Breaks
Start and end
startandendare both optional, as long as at least one of them is present.- If
endis omitted, the route stops at the last visited task, chosen by the optimization process. - If
startis omitted, the route starts at the first visited task, chosen by the optimization process. - Same coordinates for
startandend= round trip.
Jobs
An error is returned if two jobs share the same
id.
Shipments
A shipment is a pickup and a delivery performed by the same vehicle, pickup first.Shipment fields
Shipment steps
Same fields as a job, minus the shared keys above:shipment-example.json
Custom matrices
Provide your own travel-time, distance or cost matrices per profile. Providingdurations for all used profiles skips the OSRM table calls entirely:
matrices.json
- With custom matrices,
location_index(tasks) andstart_index/end_index(vehicles) become mandatory.location,startandendbecome optional but are echoed in the response when provided. durationsare used for all checks against timing constraints;distancesrequiredurations;costsare used in all route cost evaluations.- With
durationsbut nodistances, distances are fetched from the routing engine when needed (options.gor a non-zeroper_kmcost).
Getting route geometry back
Set"options": { "g": true } — a top-level field, next to vehicles and jobs:
request-body.json
response-example.json
options.g is the JSON equivalent of upstream VROOM’s -g CLI flag.
Response
The response is a JSON object withcode, optionally error, and — on success — summary, routes and unassigned.
Status codes
The
error field is present if and only if code is different from 0. See Errors for details.
Summary
Routes
Steps
Each step is one element of the visit order:start → job/pickup/delivery/break → end.
Unassigned
Violations
A violation object has acause and, for lead_time/delay, a duration in seconds.
In regular solving — the only mode the hosted API exposes —
violations arrays are always empty. Upstream VROOM reports violations when choosing ETAs for custom routes (plan mode, -c).Time Windows
time_windows constrain when its service starts; early arrivals wait. Two ways to express them:
- Relative:
[0, 14400]= within 4 hours of the planning horizon start - Absolute: real UNIX timestamps — then
arrivalvalues in the output are timestamps too
Semantics notes
Task locations and custom matrices
Task locations and custom matrices
With custom matrices,
location_index is mandatory and location is optional (but echoed in the response when provided). Without custom matrices, a table call goes to OSRM: location is mandatory and location_index is irrelevant.Capacity restrictions
Capacity restrictions
Amounts are multidimensional — vehicles carry
capacity, jobs delivery/pickup, shipments amount. A vehicle may serve a set of tasks only if the resulting load at each route step stays below capacity for each metric. All job deliveries are assumed loaded at vehicle start; all job pickups are assumed brought back at vehicle end. When using multiple components, put the most limiting metric first.Skills
Skills
A task is eligible for a vehicle if and only if the task’s
skills set is included in the vehicle’s skills. A task without skills can be served by any vehicle; a vehicle without skills can only serve tasks without skills. Omitting skills defaults to an empty array.Task priorities
Task priorities
priority is an integer in [0, 100] (default 0). Useful when not all tasks can be performed: higher-priority tasks are included in the solution over lower-priority ones.Setup times
Setup times
Setup models the time it takes to get started at a location, and is not re-applied for consecutive tasks at the same place: the total action time is
setup + service on arriving at a new location, but only service for another task at the previous vehicle location.Task times per vehicle type
Task times per vehicle type
For a vehicle with
type t, the actual service time for a task is service_per_type[t] if provided, otherwise the task’s service. The same applies to setup_per_type and setup.Vehicle steps (warm start)
Vehicle steps (warm start)
Providing
steps for a vehicle in solving mode forces the search to start from your route as a single search path, instead of several concurrent searches. Only steps with type job, pickup or delivery are used; service_* keys are ignored; an error is returned if the provided route violates any constraint. Plan-mode ETA selection (-c in upstream VROOM) is not exposed by the hosted API.Size limits
“Tasks” counts jobs plus shipment steps.
JustRouting extensions and compatibility
profileis restricted tocarandmotorcycle— upstream profiles likebikeare not available.optionsis the JSON equivalent of VROOM’s CLI flags; onlyg(route geometry) is currently supported.- Deprecated upstream keys are not supported:
job.amount(usedelivery/pickup), the top-levelmatrix(usematrices),step.job(usestep.id),summary.amount(usesummary.delivery/summary.pickup). - The OpenAPI → optimize pages hold the complete, machine-readable schema.
Related
- Distance Matrix — compute matrices for your own solvers
- Errors — error codes and formats
- VROOM API docs — the upstream full input/output schema (our hosted version is compatible)
