About Route Planner API

The Route Planner API is designed to solve route planner tasks of different types including Traveling Salesman Problem(TSP), Vehicle Optimization Problem (VRP), Route Planner with capacity / capability constraints, Route Planner with Time Windows.

Request example

Route Planner API works via POST request that allows sending a massive amount of input data in the request body.

HTTP Post request


POST https://api.geoapify.com/v1/routeplanner?apiKey=YOUR_API_KEY
HEADERS 'Content-Type: application/json'

Request body

{
  "mode": "drive",
  "agents": [
    {
      "start_location": [10.985736727197894, 48.2649593],
      "end_location": [10.896261152517647, 48.33227795],
      "pickup_capacity": 4
    },
    {
      "start_location": [10.984995162319564, 48.264409],
      "end_location": [10.896261152517647, 48.33227795],
      "pickup_capacity": 7
    },
    ...
  ],
  "shipments": [
    {
      "id":"order_1",
      "pickup":{
        "location_index": 0,
        "duration": 120
      },
      "delivery":{
        "location":[ 10.9845547, 48.26311145],
        "duration": 120
      }
      },
      {
       "id":"order_2",
       "pickup":{
          "location_index": 0,
          "duration": 120
        },
        "delivery": {
          "location": [ 10.984630924828402, 48.263248250000004 ],
          "duration": 120
        }
      },
    ...
  ],
  "jobs": [
    {
      "location": [10.98698105, 48.25615875],
      "duration": 300,
      "pickup_amount": 1
    },
    {
      "location": [10.9845547, 48.26311145],
      "duration": 300,
      "pickup_amount": 1
    },
    ...
  ],
   "locations":[
      {
         "id":"warehouse-0",
         "location":[
            10.98455206795921,
            48.262214099999994
         ]
      }
   ]
}

Required parameters:

  • apiKey - your Geoapify key

Request body parameters:

  • mode - routing / transportation mode - 'drive', 'truck', 'walk', 'bicycle';
  • agents - any resources which route or time should be planned and optimized. Depending on a business task this could be vehicles, workers, experts, robots, and so other. The agents input contains input parameters for each agent including start and end position, capacities, capabilities, time windows;
  • shipments - shipments that should be picked up from one location and delivered to another location. The shipments input can contain requirements, time windows, and priority information.
  • jobs - jobs or tasks to be solved or visited by agents. The jobs input contains information about job location, job requirements, job priority, and time windows.
  • locations - the optional parameter locations contain informations about locations that are references several times in the task description. For example, Warehouse location may belong to each shipment object. When the warehouse is added to locations, it can be referenced as location_index in the shipments and jobs.

The response returned contains a GeoJSON FeatureCollection object that contains the Route Planner Features where each feature corresponds to an agent plan.