Route optimization API

00 Prerequisites

The Route Optimization API can be used to solve traveling salesman or vehicle routing problems. It implements several open source projects and libraries like jSprit, som-tsp, TSPVIS, GH, Optimizer-API and wraps this into a beautiful unified API, inspired by the data logic behind jSprit.

The API is complex and requires that the results are further processed and transformed by the received program.

Because this API is actually designed exclusively for internal systems of Stadt.Land.Netz, we do not offer free implementation support. Of course we help where we can, but we would charge for this separately.

We do not accept feature requests for the API.

01 Restrictions, Terms of use & Fair-Use-Rules

Usage is limited to the common contract period, but is additionally subject to the restrictions that an individual VIA instance also has (number of vehicles, number of students with concurrent scheduling). The soft-limit is 150 persons and 50 vehicles.

In addition, we limit usage for all customers (including "normal" VIA customers) to average 10,000, maximum 50.000 credits per day, which is a kind of internal "currency". Each call costs us server and computation time as well as partial license fees from various other API vendors that are used.

If you exceed this limit many times or heavily during the day, we might charge you more or revoke the API-access , either until the end of the day or completely.

We can't influence how often and how much route optimizations are done. In principle, it would be possible to re-optimize every hour, which would cause very high costs on our side. We prevent an excessive use of the system via the number of credits.

You can dampen it by implementing an appropriate caching and optimization strategy:

It is up to you to lower the amount of needed requests.

If we see an extensive and/or abusive usage then we’re also allowed to restrict the API access. By using the API you agree, that you have no right for a compensation once the API access is withdrawn due to violation of the terms of use or these fair-use-rule.

However, as long as the calculations stay within the bounds of what we have seen with regular VIA users, you will not reach those limits.

If we see a misuse of the API or if the implementation causes a disproportionate amount of work on our side, then we reserve the right to close the access with timely notice even earlier.

You’re only allowed to use and serve the API for common customers. Each API-Key is only allowed to serve one single end-customer.

02 Calling the endpoints

The base-URL is https://routing.server.stadtlandnetz.de

We share the traffic and computational load over several servers and across multiple sub-systems. The unified API capsules these sub parts into one single, fast and reliable API structure.

curl -X POST -H "Content-Type: application/json"   "https://routing.server.stadtlandnetz.de/api/1/vrp?key=YOUR_CREATED_API_KEY" --data "@tsp.json"

1 POST route optimization problem | synchronous

To solve a new vehicle routing problem, make a HTTP POST to this URL

https://routing.server.stadtlandnetz.de/api/1/vrp?key=<your_key>

It returns the solution to this problem in the JSON response.

Please note that this URL is very well suited to solve minor problems. Larger vehicle routing problems, which take longer than 10 seconds to solve, cannot be solved. To solve them, please use the batch mode URL instead.

11 Request

REQUEST BODY SCHEMA: application/json

The request that contains the vehicle routing problem to be solved.

12 Supported Routing Profiles

The Routing, Matrix and Route Optimization APIs support the following profiles:

NameDescriptionRestrictions
carCar modecar access, weight=2500kg, width=2m, height=2m
car_deliveryCar modecar access including delivery and private roads. Use only in case your drivers are allowed to access these roads.
car_avoid_ferryCar modecar that heavily penalizes ferries
car_avoid_motorwayCar modecar that heavily penalizes motorways
car_avoid_tollCar modecar that heavily penalizes tolls
small_truckSmall truck like a Mercedes Sprinter, Ford Transit or Iveco Dailyheight=2.7m, width=2+0.34m, length=5.5m, weight=2080+1400 kg
small_truck_deliverySmall truckLike small_truck but including delivery and private roads. Use only in case your drivers are allowed to access these roads.
truckTruck like a MAN or Mercedes-Benz Actrosheight=3.7m, width=2.6+0.34m, length=12m, weight=13000+13000 kg, hgv=yes, 3 Axes
scooterMoped modeFast inner city, often used for food delivery, is able to ignore certain bollards, maximum speed of roughly 50km/h. weight=300kg, width=1m, height=2m
scooter_deliveryMoped modeLike scooter but including delivery and private roads. Use only in case your drivers are allowed to access these roads.
footPedestrian or walking without dangerous SAC-scalesfoot access
hikePedestrian or walking with priority for more beautiful hiking tours and potentially a bit longer than foot. Walking duration is influenced by elevation differences.foot access
bikeTrekking bike avoiding hillsbike access
mtbMountainbikebike access
racingbikeBike preferring roadsbike access

13 Request

14 Result

2 POST route optimization problem (batch mode)

21 General

Use the same Request-Structure as described under point 11.

To solve a vehicle routing problem, perform the following steps:

1.) Make a HTTP POST to this URL

https://routing.server.stadtlandnetz.de/api/1/vrp/optimize?key=<your_key>

It returns a job id (job_id).

2.) Take the job id and fetch the solution for the vehicle routing problem from this URL:

https://routing.server.stadtlandnetz.de/api/1/vrp/solution/<job_id>?key=<your_key>

We recommend to query the solution every 500ms until it returns 'status=finished'.

Note: Since the workflow is a bit more cumbersome and since you lose some time in fetching the solution, you should always prefer the synchronous endpoint. You should use the batch mode only for long running problems.

22 Request

23 Result

3 GET the solution (batch mode)

31 General

Take the job id and fetch the solution for the vehicle routing problem from this URL:

https://routing.server.stadtlandnetz.de/api/1/vrp/solution/<job_id>?key=<your_key>

You get the job id by sending a vehicle routing problem to the batch mode URL.

32 Request

33 Result