Time windows¶
~3 min · Recipe
Constrain when a task may be served by adding serviceWindows to it. The engine will sequence and time the route so each stop is reached inside one of its windows (waiting if it arrives early).
{
"id": 102,
"deliveries": [{
"id": 1002,
"location": [49.24660, -123.06340],
"duration": 300,
"serviceWindows": [
{ "start": "2026-07-31T09:00:00-07:00", "end": "2026-07-31T11:00:00-07:00" }
]
}]
}
- Provide multiple windows if several ranges are acceptable — the engine picks a feasible one.
- If a stop is reached before its window opens, the stop's
waitTime(in the solution) shows the idle seconds. - If no vehicle can reach a stop within any window, it lands in
unassignedwith reasonTIME_WINDOW.
Windows must be reachable
Very tight windows across distant stops are the most common cause of unassigned jobs. Widen the window, add a vehicle, or check the depot/shift times.
Related: Skills and matching · The Problem object · Enums, limits and rules