Fields
name(string, required) — A label for the route, for example “Morning Route”.date(date, required) — Route date inYYYY-MM-DD.vehicles(array of strings, required) — Driver names to include in the route.job_ids(array of strings, required) — Detrack job IDs to plan.depot_location(object) — Starting depot. Required whenmanual_depotistrue. Either{ "id": "..." }for a saved depot, or{ "name": "...", "address": "..." }, which saves or updates a depot with that name.end_depot_location(object) — Optional ending depot in the same format.mode(string) — Transport mode:drive,light_truck,medium_truck,truck, orheavy_truck. Defaultdrive.manual_time_windows(boolean) — Set totrueto usetime_window_fromandtime_window_tofor the whole plan. Defaultfalse, which uses each vehicle’s own working hours.time_window_from,time_window_to(string) — Plan time window in 24-hourHH:MM. Only used, and then required, whenmanual_time_windowsistrue.traffic(string) — Traffic model for the routing engine:free_flow(default) orapproximated.max_speed(number) — Maximum vehicle speed in your account’s distance unit: km/h if the account uses kilometres, mph if it uses miles.service_time(integer) — Average service time per stop in minutes.manual_service_time(boolean) — Apply a fixed service time to every stop.avoid_toll(boolean) — Skip toll roads. Defaultfalse.
Result
A route response has two levels:- The plan (top level):
status,depot_location,total_distance(meters),total_time(seconds),total_planned,total_unplanned, andunplanned_jobs(jobs that couldn’t be placed on any vehicle). planned_routes: one entry per vehicle, each with its ownstatus,vehicle,start_time,completion_time, time window, totals, andplanned_jobsin delivery order withjob_sequenceandeta_time.
jobs array instead of planned_routes.
Route status
Route status describes the route plan, not the jobs in it. It’s separate from a job’sstatus and tracking_status. A route response has two levels of status:
- The top-level
statusis for the plan as a whole. - Each entry in
planned_routes(one per vehicle) has its ownstatus.
Plan status
Vehicle route status
How planning affects jobs
Planning a route only changes jobs when you setassign_route to true:
assign_routeisfalse(default): the jobs aren’t changed. Theirstatus, driver, andtracking_statusstay the same.assign_routeistrue: each planned job that isn’t alreadycompleted,completed_partial, orfailedgets the route’s driver, its sequence (job_order),eta_time, and run number. Itsstatusis set todispatched(orout_for_deliveryfor accounts in courier mode), so itstracking_statuschanges to “Scheduled” or “Out for delivery” depending on the job date. See Status fields.assign_routeandvrp_exclude_send_driverare bothtrue: jobs get their sequence, ETA, and run number, but no driver, and theirstatusdoesn’t change.
Vehicle working hours (
start_time / end_time) are configured per driver in the Detrack app, not in the route payload.Where to go next
- Create or update a route with an optimized plan.
- List routes by date or retrieve a specific route by name.
