API Reference
API Reference

The stops field is where you describe all of the orders that need to be optimized. The stops field is an array of order objects that looks like this:

{
  "routeScenario": {
    "stops": [
      {order 1},
      {order 2},
      ...
      {order n}
    ],
    ...
  }
}

Here's what an order object looks like inside the stops array:

{
  "name": "order23412",
  "locations": [
    {
      "address": "6800 Cambie st, Vancouver, BC, Canada",
      "latitude": 49.227107,
      "longitude": -123.1163085
    }
  ],
  "duration": 120,
  "load": 1,
  "email": "[email protected]",
  "phone": "+18778888888",
  "timeWindows": [
    {
      "startTime": "9:00",
      "endTime": "10:00"
    },
    {
      "startTime": "14:00",
      "endTime": "18:00"
    }
  ],
  "instructions": "Please leave the package in the lobby of the building"
}
FieldsTypeRequired
locationsLocation objectrequired
namestringoptional
durationNumber (secs)optional
loadNumberoptional
emailStringoptional
phoneStringoptional
timeWindowsArrayoptional
instructionsArrayoptional

location object is a mandatory field which accepts either an address string or latitude/longitude information to geolocate the customer's location.

📘

Address Geocoding

If you do not have the lat/lng information for your orders, you can simple send us a fully qualified address string for each order and we will use it to geocode the lat/lng on your behalf.
We do recommend sending us any lat/lng information that you may have, as this will reduce the risk of geocoding errors and drivers ending up at wrong locations.

duration specifies how many seconds it will take to service the order. If an order takes 30 minutes and is given a time-window of 12:00-13:00, Routific will make sure that you arrive by 12:30 at the latest. Note that if the duration does not fit in the time-window, the order will not be assigned to any vehicle. It is good practice to always specify a duration. If you don't, Routific will assume the default duration configured on your workspace/account.

load should be used when you want to account for the capacity of your vehicles. This capacity must be defined within your route as well, otherwise this parameter will be ignored.

email and phone fields can be used to preserve order contact information within Routific's system.

Each order can have one or more time-window constraints, defined by an array of startTime and endTime fields. timeWindows are optional; so when they are not provided, it implies that the order can be serviced at any time. You can also say "anytime after 9am" by setting the startTime to 9:00 and omitting the endTime parameter.

🚧

24 hour format

startTime and endTime fields within the timeWindows array can only be expressed in a 24hr format. We do not currently support Unix timestamps.

If you want to send notes to a driver for a given order (e.g. the number of packages in an order or delivery instructions), you can add an instructions parameter to the order object. These instructions will be preserved in the json returned by Routific and will be displayed on your web and driver apps if you have an API integration setup with us.