POST /solve_routesOptimizes delivery routes for a list of stops. You send the stops and, optionally, solver settings. The server builds routes from the depot on real road distances, saves the plan, and returns a summary along with a link to the plan in the route editor.
POST https://routing.lu.app/solve_routes
Content-Type: application/json
runtime seconds (default 30)
plus the time to load the road network. Set your client timeout above runtime.job_id with the solve, and DELETE /solve_routes?job_id=<id> cancels it, whether it's
still waiting or already solving. A cancelled solve saves nothing and returns no routes. See
Cancelling a solve.Content-Length header, so chunked uploads aren't supported. curl
and every common HTTP client set this header for you.curl -X POST https://routing.lu.app/solve_routes \
-H 'Content-Type: application/json' \
-d '{
"runtime": 60,
"objective": "cost",
"round_trip": true,
"stops": [
{
"stop_id": "fde871df-0201-4e35-bdc1-4ce355fd2a2f",
"store_reference": "2794",
"customer_name": "Sally Beauty WA",
"store_lat": 44.969938,
"store_lng": -123.030083,
"schedule_window_start": "20:00",
"schedule_window_end": "09:00",
"weight": 691.0,
"pallet_count": 2,
"type": "delivery",
"avg_unload_time": 30,
"allowed_vehicles": null,
"receivable_item_amount": 302.08
}
]
}'
{
"edit_url": "/edit/output-runtime60-20261117-142210.json",
"feasible": true,
"num_routes": 1,
"cost": 461.83,
"miles": 396,
"runtime": 1.84,
"num_iterations": 100000,
"warnings": [],
"linehaul": null,
"linehaul_forced_direct": [],
"routes": [
{
"vehicle_type": "Sprinter van",
"visits": ["[fde871df-0201-4e35-bdc1-4ce355fd2a2f] Sally Beauty WA, 2794"],
"color": null,
"summary": {
"duration": 512, "miles": 396, "cost": 461.83, "cost_gas": 165.0, "cost_maint": 23.76,
"cost_wage": 273.07, "flat_added": 0, "weight": 691, "pallets": 2, "pickup_weight": 0, "pickup_pallets": 0
}
}
],
"totals": {
"num_routes": 1, "duration": 512, "miles": 396, "cost": 461.83, "linehaul_cost": 0,
"cost_gas": 165.0, "cost_maint": 23.76, "cost_wage": 273.07, "flat_added": 0,
"weight": 691, "pallets": 2, "pickup_weight": 0, "pickup_pallets": 0
},
"output_json": {
"version": 1,
"input": {
"runtime": 60,
"no_improvement": 10000,
"seed": 0,
"objective": "cost",
"round_trip": true,
"cost_is_round_trip": false,
"max_reload_van": 0,
"max_reload_16": 0,
"max_reload_26": 0,
"work_duration_van": 900,
"work_duration_16": 600,
"work_duration_26": 600,
"max_overtime_van": 120,
"max_overtime_16": 120,
"max_overtime_26": 120,
"enable_vehicle_work_duration": true,
"num_available_van": 40,
"num_available_16": 40,
"num_available_26": 40,
"capacity_van": [4500, 5],
"capacity_16": [6000, 8],
"capacity_26": [10000, 12],
"allow_linehaul": false,
"linehaul_depots": []
},
"solved_at": "2026-11-17T14:22:10",
"edited_at": null,
"warnings": [],
"solve": { "runtime": 1.84, "num_iterations": 100000 },
"stops": [
{
"stop_id": "fde871df-0201-4e35-bdc1-4ce355fd2a2f",
"store_reference": "2794",
"customer_name": "Sally Beauty WA",
"store_lat": "44.969938",
"store_lng": "-123.030083",
"schedule_window_start": "20:00",
"schedule_window_end": "09:00",
"weight": "691.0",
"avg_unload_time": "30",
"allowed_vehicles": "null",
"receivable_item_amount": "302.08",
"pallet_count": "2",
"type": "delivery"
}
],
"solver_routes": [
{
"vehicle_type": "Sprinter van",
"visits": ["[fde871df-0201-4e35-bdc1-4ce355fd2a2f] Sally Beauty WA, 2794"],
"color": null,
"summary": {
"duration": 512, "miles": 396, "cost": 461.83, "cost_gas": 165.0, "cost_maint": 23.76,
"cost_wage": 273.07, "flat_added": 0, "weight": 691, "pallets": 2, "pickup_weight": 0, "pickup_pallets": 0
}
}
],
"solver_totals": {
"num_routes": 1, "duration": 512, "miles": 396, "cost": 461.83, "linehaul_cost": 0,
"cost_gas": 165.0, "cost_maint": 23.76, "cost_wage": 273.07, "flat_added": 0,
"weight": 691, "pallets": 2, "pickup_weight": 0, "pickup_pallets": 0
},
"routes": [
{
"vehicle_type": "Sprinter van",
"visits": ["[fde871df-0201-4e35-bdc1-4ce355fd2a2f] Sally Beauty WA, 2794"],
"color": null,
"summary": {
"duration": 512, "miles": 396, "cost": 461.83, "cost_gas": 165.0, "cost_maint": 23.76,
"cost_wage": 273.07, "flat_added": 0, "weight": 691, "pallets": 2, "pickup_weight": 0, "pickup_pallets": 0
}
}
],
"totals": {
"num_routes": 1, "duration": 512, "miles": 396, "cost": 461.83, "linehaul_cost": 0,
"cost_gas": 165.0, "cost_maint": 23.76, "cost_wage": 273.07, "flat_added": 0,
"weight": 691, "pallets": 2, "pickup_weight": 0, "pickup_pallets": 0
}
}
}
The response values above are illustrative.
All types at a glance, in TypeScript notation. The sections after this one explain each field.
type VehicleCode = "26" | "16" | "van"; // 26' box truck, 16' box truck, Sprinter van
type ClockTime = string; // "HH:MM", 24-hour, e.g. "09:00", "20:30"
type StopType = "delivery" | "pickup";
interface Stop {
stop_id: string; // should be unique per stop
store_reference: string;
customer_name: string;
store_lat: number; // latitude, decimal degrees
store_lng: number; // longitude, decimal degrees
schedule_window_start: ClockTime | null;
schedule_window_end: ClockTime | null;
weight: number; // lbs; rounded down to a whole pound
pallet_count: number | null; // pallets; must be a whole number (2, not 2.0); null = 0
avg_unload_time: number; // minutes; must be a whole number (30, not 30.0)
allowed_vehicles: VehicleCode[] | string | null; // ["16", "van"], "16|van", or null for any
receivable_item_amount: number; // dollars
type: StopType | null; // null = "delivery"
}
interface SolveRoutesRequest {
stops: Stop[]; // required, at least one
job_id?: string; // names the solve so DELETE /solve_routes?job_id=<id> can cancel it; e.g. a UUID
// Every field below is optional. Leave one out to use its default.
runtime?: number; // default 30 (seconds)
no_improvement?: number | null; // default 10000 (iterations); null = always run the full runtime
seed?: number; // default 0
objective?: "cost" | "distance"; // default "cost"
round_trip?: boolean; // default false
cost_is_round_trip?: boolean; // default false; round_trip: false only
// A max_reload_* above 0 needs round_trip: true.
max_reload_26?: number; // default 0
max_reload_16?: number; // default 0
max_reload_van?: number; // default 0
work_duration_26?: number | null; // default 600 (minutes); null = no shift limit
work_duration_16?: number | null; // default 600
work_duration_van?: number | null; // default 900
max_overtime_26?: number; // default 120 (minutes)
max_overtime_16?: number; // default 120
max_overtime_van?: number; // default 120
enable_vehicle_work_duration?: boolean; // default true
num_available_26?: number; // default 40
num_available_16?: number; // default 40
num_available_van?: number; // default 40
capacity_26?: Capacity; // default [10000, 12]
capacity_16?: Capacity; // default [6000, 8]
capacity_van?: Capacity; // default [4500, 5]
allow_linehaul?: boolean; // default false; true needs linehaul_depots
linehaul_depots?: LinehaulDepot[]; // default []; needs allow_linehaul: true
}
interface LinehaulDepot {
name: string; // unique, no parentheses, not "Depot"; prefixes its fleet's vehicle type names
lat: number;
lng: number;
cost_per_pallet: number; // dollars, >= 0
service_radius: number; // straight-line miles from the depot, > 0
pallet_limit: number; // whole number >= 1: the most pallets its linehaul carries
}
type Capacity = [weight: number, pallets: number]; // [lbs, pallets] per trip, whole numbers
interface SolveRoutesResponse {
// 200 OK
edit_url: string; // path of the plan in the route editor, "/edit/<file name>"
feasible: boolean;
num_routes: number;
cost: number; // dollars, 2 decimals
miles: number; // whole miles
runtime: number; // seconds the solver ran
num_iterations: number;
warnings: string[];
linehaul: Linehaul[] | null; // one per linehaul depot, in linehaul_depots order; null unless allow_linehaul
linehaul_forced_direct: string[]; // stop names; empty unless allow_linehaul (see Linehaul)
routes: SavedRoute[]; // the plan's routes, each with its RouteSummary; the same as output_json.routes
totals: PlanTotals; // the totals of all routes; the same as output_json.totals
output_json: RoutesFile; // the saved plan file, exactly as written to the server
}
interface Linehaul {
depot: string; // the linehaul depot's name
stops: string[]; // names of the stops that ride this linehaul, in route order
pallets: number;
weight: number; // lbs
cost_per_pallet: number; // dollars, the depot's cost_per_pallet
cost: number; // dollars, pallets x cost_per_pallet
max_pallets: number; // the depot's pallet_limit
over_cap: boolean; // always false for a solve; the editor can push a plan over
}
// The vehicle types' names in a RoutesFile. With allow_linehaul, each linehaul depot's fleet adds the same three,
// prefixed with "<depot name> ", e.g. "Spokane 26' box".
type VehicleTypeName = "26' box" | "16' box" | "Sprinter van" | string;
interface RoutesFile {
version: 1; // file format version
input: SolutionInput; // every solver setting the solve used, defaults filled in
solved_at: string; // when the solve finished, server local time, "YYYY-MM-DDTHH:MM:SS"
edited_at: string | null; // when the plan was last saved in the editor; always null in this response
warnings: string[]; // the same as SolveRoutesResponse.warnings
solve: {
runtime: number; // seconds the solver ran
num_iterations: number;
};
stops: SavedStop[]; // the request's stops, in request order
solver_routes: SavedRoute[]; // the solver's plan; never changed
solver_totals: PlanTotals; // the totals of solver_routes; never changed
routes: SavedRoute[]; // the current plan; equal to solver_routes until edited in the route editor
totals: PlanTotals; // the totals of routes; recomputed when the editor saves
}
// SolveRoutesRequest's settings with every field present
type SolutionInput = Required<Omit<SolveRoutesRequest, "stops">>;
// A Stop as saved: every value is a string, null is "null", allowed_vehicles is "16|van"
type SavedStop = { [field in keyof Stop]: string };
interface SavedRoute {
vehicle_type: VehicleTypeName;
visits: string[]; // in visiting order: a stop's name, "[<stop_id>] <customer_name>, <store_reference>"
// (+ " (via <depot name>)" on a linehaul depot's route), or "reload" for a trip back
// to the route's depot;
// the start and end at the depot are not listed
color: string | null; // the route's color on the map, e.g. "#e6194b", once set in the editor; null until then
summary: RouteSummary;
}
interface RouteSummary {
duration: number; // whole minutes, depot departure to return (to the last stop with round_trip: false)
miles: number; // whole miles
cost: number; // dollars, 2 decimals; cost_gas + cost_maint + cost_wage + flat_added, as in Objectives
cost_gas: number; // dollars, 2 decimals; fuel
cost_maint: number; // dollars, 2 decimals; per-mile vehicle (maintenance) cost
cost_wage: number; // dollars, 2 decimals; labor
flat_added: number; // dollars; 100 for a 26' box route, else 0
weight: number; // lbs delivered
pallets: number; // pallets delivered
pickup_weight: number; // lbs picked up
pickup_pallets: number; // pallets picked up
}
interface PlanTotals {
num_routes: number; // routes with at least one stop
duration: number; // sum of the routes' durations, minutes
miles: number;
cost: number; // dollars, 2 decimals: the routes' costs plus linehaul_cost
linehaul_cost: number; // dollars, every linehaul together; 0 unless allow_linehaul
cost_gas: number; // dollars, 2 decimals; the routes' sum, as are the next three
cost_maint: number;
cost_wage: number;
flat_added: number;
weight: number; // lbs delivered
pallets: number; // pallets delivered
pickup_weight: number; // lbs picked up
pickup_pallets: number; // pallets picked up
}
interface ErrorResponse {
// 400, 404, 405, 409 or 500
error: string;
}
A JSON object containing stops, an optional job_id, and any of the solver settings. Any other field is
rejected with a 400.
job_id is a string the client picks, such as a UUID from crypto.randomUUID(), to name the solve so that it can
be cancelled. It must be unique among the solves waiting or running: a job_id already in use is rejected with a
400. Leave it out if the solve never needs cancelling.
StopEach stop needs all 13 fields below; a stop missing one is rejected with a 400. Other
fields are ignored. Use null for a value you don't have. Null is accepted only where the type above allows it.
Field values may also be sent as strings, such as "44.969938", "16|van" or "null", the form they're saved
in (see SavedStop). That way, a plan's saved stops can be posted again unchanged.
| Field | Type | Required value | Meaning |
|---|---|---|---|
stop_id |
string | yes | Identifies the stop. Should be unique: two stops with the same stop_id, customer_name and store_reference will clash. |
store_reference |
string | yes | The customer's store number or name. |
customer_name |
string | yes | The customer. The stop is shown as [<stop_id>] <customer_name>, <store_reference> in the editor, map and warnings. |
store_lat |
number | yes | Latitude of the store. |
store_lng |
number | yes | Longitude of the store. |
schedule_window_start |
"HH:MM" | null |
no | Earliest delivery time. null or "" means no earliest time. |
schedule_window_end |
"HH:MM" | null |
no | Latest arrival time. null or "" means no latest time. |
weight |
number | yes | Weight delivered (or, for a pickup, picked up) in lbs, rounded down to a whole pound. It counts against the weight in the vehicle's capacity_*. |
pallet_count |
integer | null | no | Pallets delivered (or picked up). Must be a whole number. It counts against the pallets in the vehicle's capacity_*. null or "" means 0. |
type |
"delivery" | "pickup" | null |
no | "delivery" drops the stop's weight and pallet_count off. "pickup" loads them onto the vehicle, which carries them back to the depot. null or "" means "delivery". Case doesn't matter. See Pickups. |
avg_unload_time |
integer | yes | Minutes spent at the stop. Must be a whole number. |
allowed_vehicles |
VehicleCode[] | string | null |
no | Vehicle types that may serve this stop, as a list (["16", "van"]) or a pipe-separated string ("16|van"). null, "" or [] means any type. |
receivable_item_amount |
number | yes | Amount to collect at the stop, in dollars. It's shown in the editor and doesn't affect routing. |
| Code | Vehicle | Default capacity | Default shift |
|---|---|---|---|
"26" |
26' box truck | 10,000 lbs, 12 pallets | 600 min (10 h) |
"16" |
16' box truck | 6,000 lbs, 8 pallets | 600 min (10 h) |
"van" |
Sprinter van | 4,500 lbs, 5 pallets | 900 min (15 h) |
A route can mix deliveries and pickups. The vehicle leaves the depot carrying every delivery on the trip, its load
drops at each delivery and grows at each pickup, and it must fit capacity_* (in both lbs and pallets) at every
point along the way. So a pickup only needs room once earlier deliveries have freed it. With reloads, each trip
from the depot is checked on its own, and pickups are unloaded at the reload.
Every route leaves the depot at 00:00, so window times are clock times on the delivery day. A window that wraps
past midnight is allowed: a start later than the end, such as "20:00" to "09:00", means the stop is open from
departure until the end time.
Each setting is optional, and leaving one out uses its default. Durations are in minutes and weights in lbs.
A capacity_* value must be a two-number array, such as [6000, 8]. A single number is rejected with a 400.
Setting values aren't type-checked up front, so sending the wrong type, such as "runtime": "60", fails during
the solve with a 400 or 500.
| Field | Type | Default | Meaning |
|---|---|---|---|
runtime |
integer | 30 |
Maximum seconds of search. |
no_improvement |
integer | null | 10000 |
The search also stops after this many iterations in a row with no better solution. null means it always runs the full runtime. |
seed |
integer | 0 |
Random seed. Different seeds search differently and can find different solutions, so trying a few seeds and keeping the best result can help. |
objective |
"cost" | "distance" |
"cost" |
What the solver minimizes. See Objectives. |
round_trip |
boolean | false |
true: routes drive back to the depot, and that drive counts toward miles, time and cost. false: routes end at the last stop. Can't be combined with reloads. |
cost_is_round_trip |
boolean | false |
With round_trip: false only: true adds the drive from each route's last stop back to its depot to the route's cost (and cost_gas, cost_maint, cost_wage). Routing, miles and duration stay one-way, as the solver used them. No effect with round_trip: true. |
max_reload_26, max_reload_16, max_reload_van |
integer | 0 |
How many times a vehicle of that type may return to the depot mid-route to reload. Above 0 needs round_trip: true. |
work_duration_26, work_duration_16 |
integer | null | 600 |
Shift length per vehicle type, from depot departure to return. null means no limit for that type. |
work_duration_van |
integer | null | 900 |
The same, for vans. |
max_overtime_26, max_overtime_16, max_overtime_van |
integer | 120 |
Minutes allowed past the shift. A route can't be longer than shift plus overtime. Ignored for a type with no shift limit. |
enable_vehicle_work_duration |
boolean | true |
false removes the shift limit for every vehicle type. |
num_available_26, num_available_16, num_available_van |
integer | 40 |
Vehicles of that type available, which is the most routes that type can run. |
capacity_26 |
[integer, integer] |
[10000, 12] |
Load limit per trip, as [lbs, pallets]. A route is over capacity if its load, in lbs or in pallets, is over the limit at any point (see Pickups). With reloads, each trip from the depot gets the full capacity. |
capacity_16 |
[integer, integer] |
[6000, 8] |
The same, for 16' boxes. |
capacity_van |
[integer, integer] |
[4500, 5] |
The same, for vans. |
allow_linehaul |
boolean | false |
true lets stops near a linehaul depot ride a linehaul there and be delivered from it. See Linehaul. false delivers every stop from Auburn. true needs linehaul_depots. |
linehaul_depots |
LinehaulDepot[] |
[] |
The linehaul depots: name, lat, lng, cost_per_pallet (dollars), service_radius (straight-line miles) and pallet_limit. Needs allow_linehaul: true. Each depot gets a copy of the Auburn fleet: the same num_available_*, capacity, shift, overtime and reloads. |
"cost" minimizes the total dollar cost of all routes:
miles × per-mile cost + hours × $32 + flat route cost. The per-mile cost is a vehicle (maintenance) cost plus
fuel at $7.50/gal, and both depend on the vehicle type. The flat cost is charged once per route with a stop:
| Vehicle | mpg | Fuel per mile | Vehicle cost per mile | Per-mile cost | Flat route cost |
|---|---|---|---|---|---|
| 26' box truck | 8 | $0.9375 | $0.15 | $1.0875 | $100 |
| 16' box truck | 10 | $0.75 | $0.10 | $0.85 | $0 |
| Sprinter van | 18 | $0.4167 | $0.06 | $0.4767 | $0 |
A route's cost is split into cost_gas (fuel), cost_maint (vehicle cost per mile), cost_wage (labor) and
flat_added (flat route cost). With round_trip: false and cost_is_round_trip: true, these also price the
drive back to the depot, which the solver itself never sees.
While solving,
overtime also carries a $100/h penalty to discourage long routes. The penalty isn't included in the returned
cost.
"distance" minimizes total miles, with drive time used only to break ties. There's no overtime
penalty, but routes must still fit within shift plus overtime.
Shift, overtime, capacity, time-window and vehicle-type limits apply under either objective.
The linehaul needs both allow_linehaul: true and at least one entry in linehaul_depots. Either one without the
other is rejected with a 400. Each linehaul depot gets one linehaul a day, carrying pallets from the Auburn depot to
it. That depot's fleet, a copy of the Auburn fleet, delivers them from there.
"allow_linehaul": true,
"linehaul_depots": [
{"name": "Spokane", "lat": 47.664, "lng": -117.360, "cost_per_pallet": 50, "service_radius": 75, "pallet_limit": 12}
]
The linehaul truck: it never visits a stop and has no weight limit. It carries at most its depot's pallet_limit pallets and costs a flat cost_per_pallet per pallet, with no mileage or time cost. It runs the day before, so a depot's routes leave at 00:00 like Auburn routes.
Which stops can ride it: a stop qualifies for a depot's linehaul if all of these hold:
service_radius miles (straight line);pallet_limit pallets;Pickups, stops with 0 pallets and stops outside every radius are always delivered from Auburn. A stop within the radius of several depots may ride any one of their linehauls.
How the solver decides: each qualifying stop goes either direct from Auburn or on one of the linehauls it qualifies for, whichever makes the plan cheapest. A stop is never split. Once a truck is driving to the area anyway, pallets on it cost less than the linehaul's price, so the solver fills that truck and puts only the rest on the linehaul. If driving direct is cheaper, the linehaul isn't used at all.
The pallet limits: PyVRP can't limit a total across several routes, so the solve runs in two phases within runtime.
pallet_limit, the stops that fit best are kept. These are the most pallets possible, with ties going to the stops farthest from Auburn. The rest go into linehaul_forced_direct and are delivered from Auburn, never by another linehaul. The second phase solves with only the kept stops allowed on that linehaul.Under "objective": "distance": a pallet on a depot's linehaul counts as 1/pallet_limit of the Auburn → depot drive's miles, so a full linehaul weighs as much as one truck driving out.
200 OK: SolveRoutesResponse| Field | Type | Meaning |
|---|---|---|
edit_url |
string | Path of the plan in the route editor on the same server, e.g. /edit/output-runtime60-20261117-142210.json. Open it in a browser to view and edit the routes on a map. Its last part is the saved file's name, output-runtime<runtime>-<YYYYMMDD-HHMMSS>.json. |
feasible |
boolean | true if the plan meets every limit. If it's false, the plan is still saved, but at least one limit is broken. warnings often explains why. |
num_routes |
integer | Number of routes, one per vehicle used. |
cost |
number | Total dollar cost of the plan, rounded to cents and computed as in Objectives, plus every linehaul's cost. It's reported in dollars even when objective is "distance". |
miles |
integer | Total road miles. Each leg is rounded to a whole mile. With round_trip: false, the drive back to the depot isn't counted. |
runtime |
number | Seconds the solver ran. |
num_iterations |
integer | Solver iterations run. |
warnings |
string[] | Problems found before solving: stops that no allowed vehicle can serve (including a stop heavier or with more pallets than any allowed vehicle holds), and fleets too small to carry the total weight or total pallets of the deliveries, or of the pickups. Empty when none were found. |
linehaul |
Linehaul[] | null |
With allow_linehaul: one entry per linehaul depot, in linehaul_depots order, with the stops on its linehaul and their pallets, lbs and dollar cost. null otherwise. See Linehaul. |
linehaul_forced_direct |
string[] | With allow_linehaul: stops the first solve phase put on a linehaul that didn't fit in its pallet_limit, which the final plan delivers from Auburn. Empty otherwise. |
routes |
SavedRoute[] |
The plan's routes, each with its vehicle type, stops and summary: duration, miles, cost, weight and pallets. The same as output_json.routes. |
totals |
PlanTotals |
The totals of all routes: duration, miles, cost, weight and pallets. See PlanTotals. The same as output_json.totals. |
output_json |
RoutesFile |
The saved plan file, exactly as written on the server. See output_json. |
The warnings are lines of a report. Lines that start with two spaces give the reasons for the stop above them:
[
"1 stop(s) cannot be served by any allowed vehicle:",
"[5cbc3742-...] Five Below, 4412 (allowed: 26)",
" 26: round trip 742 min > 720 min limit (600 shift + 120 overtime)"
]
A non-empty warnings list means the plan can't be feasible. The fleet-size check is the exception: it can only
show that the fleet is too small, not prove that it's big enough.
output_json: RoutesFileThe plan file the server saved, read back from disk, so it's identical to what GET /files/<file name> downloads
and what the editor at edit_url opens.
| Field | Type | Meaning |
|---|---|---|
version |
1 |
File format version. |
input |
SolutionInput |
Every solver setting the solve used, including the defaults for settings the request left out. |
solved_at |
string | When the solve finished, in the server's local time, as YYYY-MM-DDTHH:MM:SS. |
edited_at |
string | null | When the plan was last saved in the route editor. Always null here, since the plan is brand new. |
warnings |
string[] | The same list as the top-level warnings. |
solve |
object | runtime (seconds) and num_iterations, the same as the top-level fields. |
stops |
SavedStop[] |
The request's stops in request order, with every value a string. See below. |
solver_routes |
SavedRoute[] |
The solver's plan. It never changes, even after the plan is edited. |
solver_totals |
PlanTotals |
The totals of solver_routes. It never changes. |
routes |
SavedRoute[] |
The current plan. Equal to solver_routes in this response; saving in the editor overwrites it. |
totals |
PlanTotals |
The totals of routes. Equal to solver_totals in this response; saving in the editor recomputes it. |
SavedStopThe same 13 fields as a request Stop, but every value is a string: numbers are
written out (44.969938 becomes "44.969938"), null becomes "null", and an allowed_vehicles list becomes a
pipe-separated string (["16", "van"] becomes "16|van"). Fields the request sent that aren't among the 13 aren't saved.
SavedRoute| Field | Type | Meaning |
|---|---|---|
vehicle_type |
VehicleTypeName |
"26' box", "16' box" or "Sprinter van", the names of vehicle codes "26", "16" and "van". With allow_linehaul, each linehaul depot's types are the same names prefixed with the depot's name and a space, e.g. "Spokane 26' box". |
visits |
string[] | The route's visits in order. A stop appears by its name, [<stop_id>] <customer_name>, <store_reference>. On a linehaul depot's route, the name ends in " (via <depot name>)", which marks a stop that rode that depot's linehaul. "reload" marks a trip back to the route's depot to reload. The start and end at the depot aren't listed. |
color |
string | null | The route's color on the map, such as "#e6194b", once set in the editor. null until then. |
summary |
RouteSummary |
The route's duration, miles, cost, weight and pallets. See below. Saving in the editor recomputes it. |
RouteSummary| Field | Type | Meaning |
|---|---|---|
duration |
integer | Minutes from leaving the depot to returning, including driving, unloading and waiting for delivery windows. With round_trip: false, it ends at the last stop. |
miles |
integer | Road miles, each leg rounded to a whole mile. |
cost |
number | Dollar cost of the route (as in Objectives), rounded to cents: cost_gas + cost_maint + cost_wage + flat_added. Excludes the linehauls. With cost_is_round_trip, includes the drive back to the depot. |
cost_gas |
number | Fuel cost of the route, rounded to cents. |
cost_maint |
number | Vehicle (maintenance) cost per mile of the route, rounded to cents. |
cost_wage |
number | Labor cost of the route, rounded to cents. |
flat_added |
number | Flat route cost: $100 for a 26' box route, $0 for a 16' box or van. |
weight |
integer | Lbs delivered on the route. |
pallets |
integer | Pallets delivered on the route. |
pickup_weight |
integer | Lbs picked up on the route (Pickups). |
pickup_pallets |
integer | Pallets picked up on the route. |
PlanTotalsThe sums over all routes of the RouteSummary fields, plus:
| Field | Type | Meaning |
|---|---|---|
num_routes |
integer | Routes with at least one stop. |
cost |
number | The routes' costs plus linehaul_cost, rounded to cents. Equal to the top-level cost. |
linehaul_cost |
number | Every linehaul's dollar cost together; 0 unless allow_linehaul. |
ErrorResponseEvery error has a JSON body of the form {"error": "<message>"}.
| Status | When |
|---|---|
400 |
The body isn't valid JSON, or isn't a JSON object. |
400 |
stops is missing, isn't a list, or is empty. |
400 |
A stop isn't an object, or is missing fields. The message names the stop by position, e.g. stop #3 is missing weight, avg_unload_time. |
400 |
The body has a field that isn't listed above. |
400 |
job_id isn't a non-empty string, or another solve that's waiting or running already uses it. |
400 |
A stop value can't be read, e.g. null for weight, a decimal avg_unload_time or pallet_count, a type other than "delivery" or "pickup", a time not in HH:MM form, or an unknown vehicle code in allowed_vehicles. |
400 |
A capacity_* setting isn't an array of two non-negative whole numbers [lbs, pallets]. |
400 |
A stop is inside an avoided area, which has no roads in the road network (e.g. Mt. Rainier National Park). The message lists every such stop. |
400 |
Settings that conflict: round_trip: false with any max_reload_* above 0, or an unknown objective. |
400 |
allow_linehaul: true without linehaul_depots (missing or empty), or linehaul_depots with allow_linehaul false or left out. |
400 |
A linehaul depot isn't an object, is missing or has unknown fields, or has a bad value: a blank, duplicate or parenthesized name or the name "Depot", lat/lng out of range, a negative cost_per_pallet, a service_radius of 0 or less, or a pallet_limit that isn't a whole number of at least 1. The message names the depot. |
400 |
No road route (ferries excluded) exists to or from a stop or depot, e.g. one on an island. The message names each such stop or depot, with its coordinates and the road it snaps to. |
405 |
The method isn't POST or DELETE. |
409 |
The solve was cancelled with DELETE /solve_routes?job_id=<id>. Nothing was saved. |
500 |
Any other failure during the solve, such as a setting of the wrong type. |
GET /files/<file> downloads the saved plan, where <file> is the last part of edit_url. The response's
output_json already holds the same content, so this is only needed to fetch a plan again later. The file is
sent exactly as saved, as application/json with Content-Disposition: attachment, so a browser saves it rather
than displaying it. Only .json files in the server's output/ folder can be downloaded. Any other name returns
404 with an ErrorResponse.
curl -OJ https://routing.lu.app/files/output-runtime60-20261117-142210.json
-OJ saves the download under the file name the server sends.
DELETE https://routing.lu.app/solve_routes?job_id=<id>
Cancels the solve sent with that job_id, for example from a "Cancel solve" button. It works both while the solve
waits for another one to finish and while it's solving:
Either way, nothing is saved, and the original POST returns 409 with {"error": "cancelled"} and no routes.
The next waiting solve then starts.
curl -X DELETE 'https://routing.lu.app/solve_routes?job_id=5f0c2a9e-8d1b-4c3e-9a7f-2b6d4e8c1a03'
| Status | Body | When |
|---|---|---|
200 |
{"cancelled": "<job_id>"} |
The solve was waiting or solving, and is now being cancelled. |
400 |
ErrorResponse |
job_id is missing from the query string. |
404 |
ErrorResponse |
No solve with that job_id is waiting or solving: it already finished (and was saved), was already cancelled, or was never sent. |
A solve whose search has just ended can no longer be cancelled, even while it's still being saved. The DELETE
then returns 404, and the POST returns its routes as usual.
SavedStop).warnings.runtime seconds have passed or no_improvement iterations have gone by without a
better solution, whichever comes first. With allow_linehaul, this runs in two phases, as described in
Linehaul.output/<file> on the server. The file holds the settings, the stops (as SavedStops), and
the routes, so the editor at edit_url can reopen the plan later.routes, the totals of all routes in totals, and the saved
file in output_json.Every route starts from the Auburn depot at latitude 47.324291, longitude -122.25348. The exception is a linehaul
depot's routes (allow_linehaul only), which start and end at that depot's lat and lng.