Web server docs

webserver.py serves a JSON web API for building delivery routes, plus a browser editor for the plans it saves. Every route below is served at https://routing.lu.app, through nginx.

Start here: POST /solve_routes

The main route. Send it a list of stops and solver settings, and it builds the routes, saves the plan and answers with a summary and a link to the plan in the route editor.

Read the full /solve_routes reference for the request body, every solver setting, the response, the errors, and how to cancel a solve.

Routes

Route What it does
POST /solve_routes Solves the stops in the JSON body, saves the plan to output/ and returns its routes, cost and edit_url. The request blocks until the solve finishes, and only one solve runs at a time.
DELETE /solve_routes?job_id=<id> Cancels the solve that was sent with that job_id, whether it's waiting or solving. A cancelled solve saves nothing.
POST /cost Prices one route: the stops in the JSON body, served in the order given, on the vehicle you name, with the same settings as /solve_routes. Returns its cost, miles, minutes, feasibility and arrival times, priced exactly as the solver and editor price it. Saves nothing.
GET /edit/ Lists the saved plans, newest first, each linked to its editor.
GET /edit/<file name> The route editor for one saved plan: its routes on the map, which you can rearrange. Every edit is re-scored and saved into the file. A solve's edit_url points here.
POST /edit/<file name>/api/<action> The editor page's own API (evaluate, insert, reset, save). You don't call it directly.
GET /files/<file name> Downloads a saved plan's .json exactly as saved, as an attachment.
GET /data/<file name> The same file as JSON, under output_json, as in the /solve_routes response.
GET /tiles/<path> The map tiles for the editor and maps, passed through from the local tile server.
GET /docs/ These docs. GET /docs/<name> shows routes/<name>.md.
GET /health A health check. Returns {"status": "ok"}.
GET / A page of links to the routes.

<file name> is the name of a plan in output/, e.g. output-runtime60-20261117-142210.json, as it appears in a solve's edit_url.

Errors

An error from any JSON route is a JSON object with an error message, e.g. {"error": "not found"}, sent with the status code: 400 for a bad request, 404 for an unknown path or file, 405 for a method the path doesn't accept, and 500 for a server error. The /solve_routes errors are listed in its reference.