API Reference
API Reference

The routes field is used to describe all of your drivers to whom you'd like the orders to be scheduled onto. You could also list all of your available routes and request us to minimize the number of routes required to service all of the orders.

A routes field is an array of route objects that looks like below:

{
  "routeScenario": {
    "routes": [
      {route 1},
      {route 2},
      ...
      {route n}
    ],
    ...
  }
}

Here's the anatomy of a route object:

{
  "name": "Route 1",
  "constraints": {
    "capacity": 300,
    "startTime": "16:00",
    "endTime": "22:00",
    "startLocations": [
      {
        "address": "310 Alden Rd Markham, ON L3R 4C1",
        "latitude": 43.83323380866067,
        "longitude": -79.33590708604284
      }
    ],
    "endLocations": [
      {
        "address": "310 Alden Rd Markham, ON L3R 4C1",
        "latitude": 43.83323380866067,
        "longitude": -79.33590708604284
      }
    ],
  }
}
FieldsTypeRequired
nameStringOptional
capacityNumberOptional
startTimeStringOptional
endTimeStringOptional
startLocationsLocation objectOptional
endLocationsLocation objectOptional

📘

Route Locations

Lat/Lng information for each route is mandatory, as we currently do not geocode the addresses within the startLocations and endLocations object.

shift_start and shift_end specify when a route can start and end. If you have an end_location, then the shift_end means the latest time that the driver has to arrive there; otherwise it is the latest time that the driver can do their last job. Both parameters are optional. Without a shift_start, Routific will automatically infer the best time to depart, depending on your orders' time-windows.

capacity is an optional parameter used to define the total capacity that can fit in a vehicle (using the same unit as the load for your orders). Routific will ensure that this capacity will not be exceeded.

📘

Capacity + Load

In order to use the capacity constraint, make sure that you also define the load parameter within the order object. If loads are not set, it is assumed that the orders does not take up any room in the capacity of the routes.

If you'd like to use capacity to limit number of orders per route, then set load: 1 for each order.

Route Templates

If you happen to have a bunch of routes that have exact same profile in terms of their location, capacity, or shift times, you could simply use the new routeTemplate array instead of a routes array. Check out our guide on When to use routeTemplates to understand whether it is a good fit for your business needs.