Skip to main content
Version: v0.2b

Plan Schema

Model

Plan

Plan = object

The plan data. All plans in the API will have this format.

A plan is a collection of stops and drivers that when optimized will produce routes. A plan can be optimized multiple times and each optimization will produce a set of routes. A plan can also be distributed to drivers, which will produce a set of routes that are associated with drivers.

For your convenience you can check if a plan is editable using the normal plan APIs by checking the writable property. If it is false, you will need to use the Live Plan APIs to edit this plan.

Example

{
"id": "plans/zeOCJaJCzZhpKVCVAC9o",
"title": "Tue, Nov 22 Route 1",
"starts": {
"day": 22,
"month": 11,
"year": 2022,
},
"drivers": [
{
"id": "drivers/w8ZaNn3e5ZA8EQSABtca",
"name": null,
"email": "verygooddriver@spoke.com",
"phoneNumber": null,
"depots": [
"depots/zeOCJaJCzZhpKVCVAC9o"
],
"routeOverrides": {
"startTime": {
"hour": 8,
"minute": 0
},
"endTime": {
"hour": 8,
"minute": 0
},
"startAddress": {
"address": "Very nice St., 150 - Nice Neighbourhood, Campinas - SP, 130876, Brazil",
"placeId": "1cda3f263368264eefbb",
"latitude": -22.12345,
"longitude": -47.12345,
"placeTypes": [
"street_address"
],
"addressLineOne": "Very nice St., 150",
"addressLineTwo": "Nice Neighbourhood, Campinas - SP, 130876, Brazil"
},
"endAddress": {
"address": "Very nice St., 150 - Nice Neighbourhood, Campinas - SP, 130876, Brazil",
"placeId": "1cda3f263368264eefbb",
"latitude": -22.12345,
"longitude": -47.12345,
"placeTypes": [
"street_address"
],
"addressLineOne": "Very nice St., 150",
"addressLineTwo": "Nice Neighbourhood, Campinas - SP, 130876, Brazil"
},
"maxStops": 30,
"drivingSpeed": "average",
"deliverySpeed": "faster"
}
}
],
"routes": [
"routes/gjaqksJIa26qGPzsgBXT",
],
"depot": "depots/zeOCJaJCzZhpKVCVAC9o",
"optimization": 'optimized',
"distributed": true,
"writable": false,
}

Properties

PropertyTypeDescription

id

PlanId

This plan's unique identifier in the API. this can be used directly in the URL to operate on this plan.

title

string

The name of the plan. This is a human-readable name that is displayed in the UI.

starts

Date

The day this plan starts at.

drivers

Driver[]

The drivers that are part of this plan. See Driver.

depot

DepotId | null

The depot that this plan is for. See Depot.

routes

RouteId[]

The routes this plan has. Note that you cannot operate on routes directly via the API in this version.

optimization

"creating" | "editing" | "preview" | "optimized" | "optimizing" | null

The current optimization state of the plan.

  • creating: The plan is in draft mode and not yet optimized.
  • editing: The plan has been optimized and is currently being edited again.
  • preview: The plan has been edited and reoptimized, but it's changes have not been saved yet.
  • optimizing: The plan is currently being optimized.
  • optimized: The plan has been optimized and is not being edited.

distributed

boolean

Whether the plan was distributed to drivers.

writable

boolean

Whether this plan can be edited via the normal plan API or not. If this is false, you will need to use the Live Plan APIs to edit this plan.

Identifier

PlanId

PlanId = `plans/${string}`

A plan id is a string that is unique for a plan. It is used to identify the plan in the API.

Example

"plans/0xBYy4MYt4piMCSQEsts"

Fields

Date

Date = object

A Date is an object representing a day in the year.

Example

{
"year": 2023,
"month": 2,
"day": 1
}

Properties

PropertyType

year

number

month

number

day

number