Skip to main content
Skip to Content
Dispatch API
This is the documentation for Dispatch API v0.2b, which is no longer actively maintained. For up-to-date documentation, see the latest version (v1.0).

Create a new plan

POST
/plans

The playground uses your live account

Requests are sent with your real API key, so creating, updating or deleting here changes your production data.

Authorization

BasicAuth
headerAuthorizationBasic <token>

Use the API key as the username and leave the password empty.

Request Body

The request body for creating a plan.

application/json
  1. body

The request body for creating a plan.

title*string

The title of the plan.

Length1 <= length <= 255
starts*

The date the plan starts. Does not accept dates that are too far in the future or past.

drivers?array<>

The drivers IDs of the plan, in the format drivers/<id>, duplicates will be ignored

Itemsitems <= 50
Default[]
depot?|

The depot id, in the format depots/<id>. If not provided, the team's Main Depot will be used.

Response Body

The created plan

application/json
  1. response

The created plan

id*string

The unique identifier of the plan.

Match^plans\/[a-zA-Z0-9---_]{1,50}$
title*string

The title of the plan.

starts*

A date.

depot*|

The depot ID of the plan, in the format depots/<id>

distributed*boolean

Whether the plan has been distributed.

writable*boolean

Whether the plan is writable using the normal Plan APIs. If this is false, you will need to use the Live Plan APIs to edit the plan. Any plan created before 2023-04-01 is not writable.

optimization*|

The optimization state of the plan.

drivers*array<>

The driver IDs of the plan, in the format drivers/<id>.

routes*array<>

The route IDs of the plan, in the format routes/<id>.

Example Request
curl -X POST 'https://api.spoke.com/public/v0.2b/plans' \  -H 'Content-Type: application/json' \  -d '{  "title": "string",  "starts": {    "day": 1,    "month": 1,    "year": -9007199254740991  }}'
Example Response
{  "id": "string",  "title": "string",  "starts": {    "day": 1,    "month": 1,    "year": -9007199254740991  },  "depot": "string",  "distributed": true,  "writable": true,  "optimization": "creating",  "drivers": [    {      "id": "string",      "name": null,      "email": null,      "phone": null,      "displayName": null,      "active": true,      "depots": [        "string"      ],      "routeOverrides": {        "startTime": {          "hour": 0,          "minute": 0        },        "endTime": {          "hour": 0,          "minute": 0        },        "startAddress": {          "address": "string",          "addressLineOne": "string",          "addressLineTwo": "string",          "latitude": -90,          "longitude": -180,          "placeId": "string",          "placeTypes": [            "string"          ]        },        "endAddress": {          "address": "string",          "addressLineOne": "string",          "addressLineTwo": "string",          "latitude": -90,          "longitude": -180,          "placeId": "string",          "placeTypes": [            "string"          ]        },        "maxStops": -9007199254740991,        "drivingSpeed": "slower",        "deliverySpeed": "slower",        "vehicleType": "bike"      }    }  ],  "routes": [    "string"  ]}