Skip to main content

Circuit API (v0.2b)

This is the documentation of the Circuit Public API HTTP endpoints. The Circuit Public API is a way for you to interact with Circuit products programmatically.

Introduction

The API has a set of HTTP methods to operate on Circuit resources for a specific team.

Currently, Circuit offers no programming SDKs for interacting with the Public API, but you can implement your own interface by calling the methods documented on this page.

Using the API

This section describes how the Circuit API should be used, if you whish to see example implementations take a look at the API Usage Examples page.

Address

The base API address for this version of the API to be used before every endpoint listed here is: https://api.getcircuit.com/public/v0.2b

Notice the https:// prefix, Circuit API will not accept plain HTTP requests.

Authentication

To use Circuit Public API endpoints you will first need to generate an API key for authenticating with our servers.

To do this you need to go to your Circuit For Teams settings page > Integrations > API, and generate a new key there.

After you have the API key you can use it in the Authorization header with the Basic Authentication Schema, where the API key you just created is the user, and the password should be empty.

An example request using curl follows:

curl "https://api.getcircuit.com/public/v0.2b/plans" -u yourApiKey:

If you did everything right you should see a list of your team's plans as the response

On resource types

Every response from the Circuit Public API will be as JSON Objects, and every request that has a body also needs to be in that type, and the header Content-type: application/json needs to present, so the server knows that the body you are sending is valid JSON. Circuit will reject requests without that header, so be sure to use it.

On resource IDs

Every resource in the Circuit Public API has a unique ID. This ID is generated by Circuit and is unique for every resource per collection.

Every resource representation returned by the API will show the ID in the following format:

{
  "id": "collectionName/resourceId"
}

And if the resource is on a sub-collection, it will be in the following format:

{
  "id": "collectionName/resourceId/subcollectionName/subResourceId"
}

For example, a stop with ID stop1 under a plan with ID plan1 will have the following representation on its serialized ID field:

{
  "id": "plans/plan1/stops/stop1"
}

This means that if you wish to directly retrieve this stop by using a GET endpoint you can simply use this ID as follows:

curl "https://api.getcircuit.com/public/v0.2b/`serializedId`" -u yourApiKey:

For the example above this would be:

curl "https://api.getcircuit.com/public/v0.2b/plans/plan1/stops/stop1" -u yourApiKey:

On List endpoints

When using list endpoints, you have the ability to combine various query options to locate the desired results. Some endpoints even offer specific filter options to aid in this search.

All the list endpoints employ pagination. This means that a single request might only return a part of the entire set of resources you're aiming to retrieve. To move through the subsequent pages, the Circuit API provides a nextPageToken field in the response of every list endpoint query.

It's crucial to understand that when a nextPageToken is returned, it indicates that more data is available. For every subsequent request, this token should be added as the pageToken query parameter. And, importantly, all the original query parameters used in the first request must also be included.

Here's a step-by-step example to elucidate this:

  1. Suppose you initiate a request to list your plans:
curl "https://api.getcircuit.com/public/v0.2b/plans?filter.startsGte=2023-05-01" -u yourApiKey:
  1. The Circuit API might return a response like:
{
  // other attributes
  "nextPageToken": "I53Jr5Eu2qK9omh0iA8q"
}
  1. To retrieve the next page of data, use the returned nextPageToken as the pageToken query parameter, and ensure all initial query parameters remain the same:
curl "https://api.getcircuit.com/public/v0.2b/plans?filter.startsGte=2023-05-01&pageToken=I53Jr5Eu2qK9omh0iA8q" -u yourApiKey:
  1. Repeat step 3 for all subsequent pages, updating the pageToken parameter with the latest nextPageToken value returned until nextPageToken is null in the response.

Circuit also accepts limiting the maximum number of results per page by using the maxPageSize query parameter, but notice that each individual endpoint has a maximum value you can set this to.

On Update endpoints (HTTP PATCH verb)

Update methods differ from the other methods in the API in the sense that missing values in the JSON representation will not act upon the representation of the resource.

Explaining this by example: Suppose you have a Plan with the ID plan1 in your plans' collection, and you wanted to merely update its title to My API Plan without changing other information, such as assigned drivers or the start date. To do this you would issue the following request:

curl -X PATCH http://localhost:5005/public/v0.2b/plans/plan1 -H 'Content-type: application/json' -d '{"title": "My API Plan"}' -u yourApiKey:

Notice how we don't pass any other information in the JSON, only the title. This ensures that the PATCH request will only operate on the provided parameters and keep the other parameters as-is.

It is important to also notice that when updating an array the whole array will be replaced, Circuit API does not support partial updates on arrays.

On Rate-Limiting

All the endpoints in the Circuit Public API are rate-limited. This means that we will reject requests if they are coming in too fast.

To know if your request was rate-limited, just check if the response has the HTTP status code 429.

Each endpoint has a different rate-limit, and this rate-limit can be changed by Circuit at any moment.

Most write endpoints currently have a rate-limit of 5 requests per second. Exceptions are:

  • The batch-import endpoint has a rate-limit of 4 requests per minute, but can be used to import up to 100 stops at a time;
  • The Plan optimization and re-optimization endpoints have a rate-limit of 3 requests per minute, due to the long-running nature of these tasks.

All read endpoints have a rate-limit of 10 requests per second, including the list endpoints.

Circuit API will occasionally support bursts of requests, but this cannot be sustained and will be rejected if it goes on for too long.

When Circuit rejects your request due to exceeding the rate-limiting you will need to wait before retrying the request, we suggest you use an exponential backoff approach for this.

We also recommend, besides the exponential backoff algorithm, that you add a random delay to each attempt, to prevent a thundering herd problem.

If the client keeps on retrying rate-limited requests while being rejected with a 429 at a high rate, Circuit will keep on rejecting the requests until the rate at which requests are made is turned down.

Circuit will also limit requests if it keeps receiving requests at a high frequency at or close to the requests limit for an extended period of time, so we do support occasional burst of requests, but if this is sustained for a long period, we will rate-limit the client making these requests.

On the models

After this section you will find all the Circuit Public API endpoints available.

Every representation of resources that these endpoints create and return are documented in the Models page of the docs.

Plans

Endpoints to operate on Plans resources.

Create a new plan

Authorizations:
HTTP: BasicAuth
Request Body schema: application/json

The request body for creating a plan.

title
required
string [ 1 .. 255 ] characters

The title of the plan.

required
object

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

drivers
Array of any <= 50 items
Default: []

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

depot
any or null

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

Responses

Request samples

Content type
application/json
{
  • "title": "string",
  • "starts": {
    },
  • "drivers": [ ],
  • "depot": null
}

Response samples

Content type
application/json
{
  • "id": null,
  • "title": "string",
  • "starts": {
    },
  • "depot": { },
  • "distributed": true,
  • "writable": true,
  • "optimization": "creating",
  • "drivers": [
    ],
  • "routes": [
    ]
}

List plans

Authorizations:
HTTP: BasicAuth
query Parameters
pageToken
string [ 1 .. 255 ] characters

The page token, if any.

maxPageSize
number [ 1 .. 10 ]
Default: 10

The max page size.

object

The filter to apply to the list of plans. The filter params are passed like this: ?filter[title]=foo or like this: ?filter.title=foo

Responses

Response samples

Content type
application/json
{
  • "plans": [
    ],
  • "nextPageToken": null
}

Update an existing plan

Authorizations:
HTTP: BasicAuth
path Parameters
planId
required
string^[a-zA-Z0-9---_]{1,50}$

The plan id

Request Body schema: application/json

The request body for updating a plan. All the values present in the request will update the plan value, if you wish to update only certain fields, only set them and do not set the others. Any fields not set will not be updated.

title
string [ 1 .. 255 ] characters

The title of the plan.

object

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

drivers
Array of any <= 50 items

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

depot
any or null

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

Responses

Request samples

Content type
application/json
{
  • "title": "string",
  • "starts": {
    },
  • "drivers": [
    ],
  • "depot": null
}

Response samples

Content type
application/json
{
  • "id": null,
  • "title": "string",
  • "starts": {
    },
  • "depot": { },
  • "distributed": true,
  • "writable": true,
  • "optimization": "creating",
  • "drivers": [
    ],
  • "routes": [
    ]
}

Retrieve a plan

Retrieve a plan

Authorizations:
HTTP: BasicAuth
path Parameters
planId
required
string^[a-zA-Z0-9---_]{1,50}$

The plan id

Responses

Response samples

Content type
application/json
{
  • "id": null,
  • "title": "string",
  • "starts": {
    },
  • "depot": { },
  • "distributed": true,
  • "writable": true,
  • "optimization": "creating",
  • "drivers": [
    ],
  • "routes": [
    ]
}

Delete a plan

Delete a plan and related routes. This action cannot be undone and will delete all the releated routes as well, even if the plan is not in a writable state. As this action is not atomic, it is possible that only partial deletion occurs if the endpoint errors out with a 500. In that case it is recommended to retry the request.

Authorizations:
HTTP: BasicAuth
path Parameters
planId
required
string^[a-zA-Z0-9---_]{1,50}$

The plan id

Responses

Response samples

Content type
application/json
null

Optimize a plan

Optimize a plan. Returns the created operation, which can be polled for the result. Use the returned id with the operations endpoints to poll for the result.

Authorizations:
HTTP: BasicAuth
path Parameters
planId
required
string^[a-zA-Z0-9---_]{1,50}$

The plan id

Responses

Response samples

Content type
application/json
{
  • "id": null,
  • "type": "plan_optimization",
  • "done": true,
  • "metadata": {
    },
  • "result": {
    }
}

Distribute a plan

Distribute a plan to its drivers. This will send then their routes.

Authorizations:
HTTP: BasicAuth
path Parameters
planId
required
string^[a-zA-Z0-9---_]{1,50}$

The plan id

Responses

Response samples

Content type
application/json
{
  • "id": null,
  • "title": "string",
  • "starts": {
    },
  • "depot": { },
  • "distributed": true,
  • "writable": true,
  • "optimization": "creating",
  • "drivers": [
    ],
  • "routes": [
    ]
}

Stops

Endpoints to operate on Stop resources.

For any Plans created before 2023-04-01 the stop collections and all related operations will not be available.

For any operations here you will need a Plan ID beforehand. You can retrieve an existing Plan by listing your Plans or you can create a new one.

Create a new stop

Create a new stop with the given data. Prefer using the batch import endpoint if you want to create multiple stops at once as it is more efficient and will produce better geocoding results.

Authorizations:
HTTP: BasicAuth
path Parameters
planId
required
string^[a-zA-Z0-9---_]{1,50}$

The plan id

Request Body schema: application/json

The request body for creating a stop. The only required field is address, you need to provide at least one of the fields in it. The latitude and longitude fields will override any of the other fields if they are set(and they need to be both set if any of them are). The more fields you provide the more accurate the geocoding will be.

required
object

Address of the stop, at least one of the fields is required. If the latitude and longitude fields are set they will override any of the others. The addressName field is not used for geocoding and is only for display purposes.

object or null

Timing information for this stop

object or null

Recipient information for this stop

object or null

Order information for this stop

driver
any or null

Deprecated. Prefer using the allowedDrivers field instead. Driver ID that should be assigned to this stop. If not provided, the stop will be assigned to any available driver during optimization. This field is mutually exclusive with the allowedDrivers field.

allowedDrivers
Array of any or null <= 100 items

Driver IDs that are allowed to be assigned to this stop. If not provided, the stop will be assigned to any available driver during optimization. This field is mutually exclusive with the driver field. When the stop is first created, all the drivers in this list will be added to the plan as well. If the stop is updated, no changes will be made to the plan, so if you want to add a driver to the plan, you must also add them to the plan separately, if they are not already.

activity
string or null
Default: "delivery"
Enum: "delivery" "pickup"

Activity type

optimizationOrder
string or null
Enum: "first" "last" "default"

The preferred order of this stop in the optimized route. If not provided or "default", the stop will be placed in the optimal order, decided by the optimization algorithm. Otherwise it will be placed either "first" or "last".

packageCount
number or null [ 1 .. 100 ]

Number of packages in the stop

notes
string or null [ 1 .. 2000 ] characters

Notes for the stop

Responses

Request samples

Content type
application/json
{
  • "address": {
    },
  • "timing": {
    },
  • "recipient": {
    },
  • "orderInfo": {
    },
  • "driver": null,
  • "allowedDrivers": [
    ],
  • "activity": "delivery",
  • "optimizationOrder": "first",
  • "packageCount": 1,
  • "notes": "string"
}

Response samples

Content type
application/json
{
  • "id": null,
  • "address": {
    },
  • "driverIdentifier": null,
  • "allowedDriversIdentifiers": [
    ],
  • "estimatedTravelDuration": null,
  • "estimatedTravelDistance": null,
  • "notes": null,
  • "packageCount": null,
  • "type": "start",
  • "packageLabel": null,
  • "stopPosition": null,
  • "trackingLink": null,
  • "webAppLink": "string",
  • "orderInfo": {
    },
  • "placeInVehicle": {
    },
  • "recipient": {
    },
  • "activity": "delivery",
  • "deliveryInfo": {
    },
  • "plan": null,
  • "route": {
    },
  • "eta": {
    },
  • "etaNullReason": {
    },
  • "timing": {
    },
  • "optimizationOrder": "first"
}

List stops

Authorizations:
HTTP: BasicAuth
path Parameters
planId
required
string^[a-zA-Z0-9---_]{1,50}$

The plan id

query Parameters
pageToken
string [ 1 .. 255 ] characters

The page token, if any.

maxPageSize
number [ 1 .. 10 ]
Default: 10

The max page size.

object

The filter to apply to the list of stops. The filter params are passed like this: ?filter[externalId]=foo or like this: ?filter.externalId=foo

Responses

Response samples

Content type
application/json
{
  • "stops": [
    ],
  • "nextPageToken": null
}

Batch import stops

Authorizations:
HTTP: BasicAuth
path Parameters
planId
required
string^[a-zA-Z0-9---_]{1,50}$

The plan id

Request Body schema: application/json

An array of stops to import in batch. Supports a maximum of 100 stops per request.

Array ([ 1 .. 100 ] items)
required
object

Address of the stop, at least one of the fields is required. If the latitude and longitude fields are set they will override any of the others. The addressName field is not used for geocoding and is only for display purposes.

object or null

Timing information for this stop

object or null

Recipient information for this stop

object or null

Order information for this stop

driver
any or null

Deprecated. Prefer using the allowedDrivers field instead. Driver ID that should be assigned to this stop. If not provided, the stop will be assigned to any available driver during optimization. This field is mutually exclusive with the allowedDrivers field.

allowedDrivers
Array of any or null <= 100 items

Driver IDs that are allowed to be assigned to this stop. If not provided, the stop will be assigned to any available driver during optimization. This field is mutually exclusive with the driver field. When the stop is first created, all the drivers in this list will be added to the plan as well. If the stop is updated, no changes will be made to the plan, so if you want to add a driver to the plan, you must also add them to the plan separately, if they are not already.

activity
string or null
Default: "delivery"
Enum: "delivery" "pickup"

Activity type

optimizationOrder
string or null
Enum: "first" "last" "default"

The preferred order of this stop in the optimized route. If not provided or "default", the stop will be placed in the optimal order, decided by the optimization algorithm. Otherwise it will be placed either "first" or "last".

packageCount
number or null [ 1 .. 100 ]

Number of packages in the stop

notes
string or null [ 1 .. 2000 ] characters

Notes for the stop

Responses

Request samples

Content type
application/json
[
  • {
    }
]

Response samples

Content type
application/json
{
  • "success": [
    ],
  • "failed": [
    ]
}

Update an existing stop

Does not support updating a stop's location. To do so, delete the stop and create a new one.

Authorizations:
HTTP: BasicAuth
path Parameters
planId
required
string^[a-zA-Z0-9---_]{1,50}$

The plan id

stopId
required
string^[a-zA-Z0-9---_]{1,50}$

The stop id

Request Body schema: application/json

The request body for updating a stop. All the values present in the request will update the stop value, if you wish to update only certain fields, only set them and do not set the others. Any fields not set will not be updated.

object or null

Recipient information for this stop

object or null

Order information for this stop

driver
any or null
allowedDrivers
Array of any or null <= 100 items

Driver IDs that are allowed to be assigned to this stop. If not provided, the stop will be assigned to any available driver during optimization. This field is mutually exclusive with the driver field. When the stop is first created, all the drivers in this list will be added to the plan as well. If the stop is updated, no changes will be made to the plan, so if you want to add a driver to the plan, you must also add them to the plan separately, if they are not already.

activity
string or null
Default: "delivery"
Enum: "delivery" "pickup"

Activity type

optimizationOrder
string or null
Enum: "first" "last" "default"
packageCount
number or null [ 1 .. 100 ]
notes
string or null [ 1 .. 2000 ] characters
object or null

Responses

Request samples

Content type
application/json
{
  • "recipient": {
    },
  • "orderInfo": {
    },
  • "driver": null,
  • "allowedDrivers": [
    ],
  • "activity": "delivery",
  • "optimizationOrder": "first",
  • "packageCount": 1,
  • "notes": "string",
  • "timing": {
    }
}

Response samples

Content type
application/json
{
  • "id": null,
  • "address": {
    },
  • "driverIdentifier": null,
  • "allowedDriversIdentifiers": [
    ],
  • "estimatedTravelDuration": null,
  • "estimatedTravelDistance": null,
  • "notes": null,
  • "packageCount": null,
  • "type": "start",
  • "packageLabel": null,
  • "stopPosition": null,
  • "trackingLink": null,
  • "webAppLink": "string",
  • "orderInfo": {
    },
  • "placeInVehicle": {
    },
  • "recipient": {
    },
  • "activity": "delivery",
  • "deliveryInfo": {
    },
  • "plan": null,
  • "route": {
    },
  • "eta": {
    },
  • "etaNullReason": {
    },
  • "timing": {
    },
  • "optimizationOrder": "first"
}

Retrieve a stop

Retrieve a stop

Authorizations:
HTTP: BasicAuth
path Parameters
planId
required
string^[a-zA-Z0-9---_]{1,50}$

The plan id

stopId
required
string^[a-zA-Z0-9---_]{1,50}$

The stop id

Responses

Response samples

Content type
application/json
{
  • "id": null,
  • "address": {
    },
  • "driverIdentifier": null,
  • "allowedDriversIdentifiers": [
    ],
  • "estimatedTravelDuration": null,
  • "estimatedTravelDistance": null,
  • "notes": null,
  • "packageCount": null,
  • "type": "start",
  • "packageLabel": null,
  • "stopPosition": null,
  • "trackingLink": null,
  • "webAppLink": "string",
  • "orderInfo": {
    },
  • "placeInVehicle": {
    },
  • "recipient": {
    },
  • "activity": "delivery",
  • "deliveryInfo": {
    },
  • "plan": null,
  • "route": {
    },
  • "eta": {
    },
  • "etaNullReason": {
    },
  • "timing": {
    },
  • "optimizationOrder": "first"
}

Delete a stop

Delete a stop. This action cannot be undone and will delete all the data associated with the stop. If the plan is not writable, this will fail.

Authorizations:
HTTP: BasicAuth
path Parameters
planId
required
string^[a-zA-Z0-9---_]{1,50}$

The plan id

stopId
required
string^[a-zA-Z0-9---_]{1,50}$

The stop id

Responses

Response samples

Content type
application/json
null

Live Plans

Endpoints to operate on Plans resources when it's pending re-optimization and re-distribution.

You must use these endpoints to apply the changes when any Live Stops request returns pending = true.

Re-optimize a plan

Re-optimize a plan. This endpoint should be used only after updating a live plan. Returns the created operation, which can be polled for the result. Use the returned id with the operations endpoints to poll for the result.

Authorizations:
HTTP: BasicAuth
path Parameters
planId
required
string^[a-zA-Z0-9---_]{1,50}$

The plan id

Request Body schema: application/json

The request body for reoptimize a plan.

optimizationType
string
Default: "reorder_changed_stops"
Enum: "reorder_changed_stops" "reorder_all_stops" "redistribute_stops_between_drivers"

The type of optimization to use

Responses

Request samples

Content type
application/json
{
  • "optimizationType": "reorder_changed_stops"
}

Response samples

Content type
application/json
{
  • "id": null,
  • "type": "plan_optimization",
  • "done": true,
  • "metadata": {
    },
  • "result": {
    }
}

Re-distribute a plan

Re-distribute a plan to its drivers. This endpoint should be used only after updating a live plan. This will apply the re-optimization changes and send the drivers their routes.

Authorizations:
HTTP: BasicAuth
path Parameters
planId
required
string^[a-zA-Z0-9---_]{1,50}$

The plan id

Responses

Response samples

Content type
application/json
{
  • "id": null,
  • "title": "string",
  • "starts": {
    },
  • "depot": { },
  • "distributed": true,
  • "writable": true,
  • "optimization": "creating",
  • "drivers": [
    ],
  • "routes": [
    ]
}

Save the plan changes

Save the plan changes after re-optimization without distributing it. This endpoint is optional since re-distribute already saves the changes.

Authorizations:
HTTP: BasicAuth
path Parameters
planId
required
string^[a-zA-Z0-9---_]{1,50}$

The plan id

Responses

Response samples

Content type
application/json
null

Live Stops

Endpoints to operate on Stop resources when the plan is already optimized and therefore not writable.

All the endpoints return the field pending. This field indicates whether the change has been applied to the plan or if it's pending a new optimization and distribution. On pending = true, you must use the re-optimize and re-distribute endpoints to apply the changes to the plan.

Create a new stop

Create a new stop with the given data on live plans. When the plan is not writable, this endpoint starts an editing session and the action can be applied through a new optimization, or be discarded. Prefer using the batch import endpoint if you want to create multiple stops at once as it is more efficient and will produce better geocoding results.

Authorizations:
HTTP: BasicAuth
path Parameters
planId
required
string^[a-zA-Z0-9---_]{1,50}$

The plan id

Request Body schema: application/json

The request body for creating a stop. The only required field is address, you need to provide at least one of the fields in it. The latitude and longitude fields will override any of the other fields if they are set(and they need to be both set if any of them are). The more fields you provide the more accurate the geocoding will be.

required
object

Address of the stop, at least one of the fields is required. If the latitude and longitude fields are set they will override any of the others. The addressName field is not used for geocoding and is only for display purposes.

object or null

Timing information for this stop

object or null

Recipient information for this stop

object or null

Order information for this stop

driver
any or null

Deprecated. Prefer using the allowedDrivers field instead. Driver ID that should be assigned to this stop. If not provided, the stop will be assigned to any available driver during optimization. This field is mutually exclusive with the allowedDrivers field.

allowedDrivers
Array of any or null <= 100 items

Driver IDs that are allowed to be assigned to this stop. If not provided, the stop will be assigned to any available driver during optimization. This field is mutually exclusive with the driver field. When the stop is first created, all the drivers in this list will be added to the plan as well. If the stop is updated, no changes will be made to the plan, so if you want to add a driver to the plan, you must also add them to the plan separately, if they are not already.

activity
string or null
Default: "delivery"
Enum: "delivery" "pickup"

Activity type

optimizationOrder
string or null
Enum: "first" "last" "default"

The preferred order of this stop in the optimized route. If not provided or "default", the stop will be placed in the optimal order, decided by the optimization algorithm. Otherwise it will be placed either "first" or "last".

packageCount
number or null [ 1 .. 100 ]

Number of packages in the stop

notes
string or null [ 1 .. 2000 ] characters

Notes for the stop

Responses

Request samples

Content type
application/json
{
  • "address": {
    },
  • "timing": {
    },
  • "recipient": {
    },
  • "orderInfo": {
    },
  • "driver": null,
  • "allowedDrivers": [
    ],
  • "activity": "delivery",
  • "optimizationOrder": "first",
  • "packageCount": 1,
  • "notes": "string"
}

Response samples

Content type
application/json
{
  • "pending": true,
  • "stop": {
    }
}

Update an existing stop

Update a stop on live plans. When the plan is not writable, this endpoint starts an editing session and the action can be applied through a new optimization, or be discarded. It does not support updating a stop's location. To do so, delete the stop and create a new one.

Authorizations:
HTTP: BasicAuth
path Parameters
planId
required
string^[a-zA-Z0-9---_]{1,50}$

The plan id

stopId
required
string^[a-zA-Z0-9---_]{1,50}$

The stop id

Request Body schema: application/json

The request body for updating a stop. All the values present in the request will update the stop value, if you wish to update only certain fields, only set them and do not set the others. Any fields not set will not be updated.

object or null

Recipient information for this stop

object or null

Order information for this stop

driver
any or null
allowedDrivers
Array of any or null <= 100 items

Driver IDs that are allowed to be assigned to this stop. If not provided, the stop will be assigned to any available driver during optimization. This field is mutually exclusive with the driver field. When the stop is first created, all the drivers in this list will be added to the plan as well. If the stop is updated, no changes will be made to the plan, so if you want to add a driver to the plan, you must also add them to the plan separately, if they are not already.

activity
string or null
Default: "delivery"
Enum: "delivery" "pickup"

Activity type

optimizationOrder
string or null
Enum: "first" "last" "default"
packageCount
number or null [ 1 .. 100 ]
notes
string or null [ 1 .. 2000 ] characters
object or null

Responses

Request samples

Content type
application/json
{
  • "recipient": {
    },
  • "orderInfo": {
    },
  • "driver": null,
  • "allowedDrivers": [
    ],
  • "activity": "delivery",
  • "optimizationOrder": "first",
  • "packageCount": 1,
  • "notes": "string",
  • "timing": {
    }
}

Response samples

Content type
application/json
{
  • "pending": true,
  • "stop": {
    }
}

Batch import stops

Import stops to live plans. When the plan is not writable, this endpoint starts an editing session and the action can be applied through a new optimization, or be discarded.

Authorizations:
HTTP: BasicAuth
path Parameters
planId
required
string^[a-zA-Z0-9---_]{1,50}$

The plan id

Request Body schema: application/json

An array of stops to import in batch. Supports a maximum of 100 stops per request.

Array ([ 1 .. 100 ] items)
required
object

Address of the stop, at least one of the fields is required. If the latitude and longitude fields are set they will override any of the others. The addressName field is not used for geocoding and is only for display purposes.

object or null

Timing information for this stop

object or null

Recipient information for this stop

object or null

Order information for this stop

driver
any or null

Deprecated. Prefer using the allowedDrivers field instead. Driver ID that should be assigned to this stop. If not provided, the stop will be assigned to any available driver during optimization. This field is mutually exclusive with the allowedDrivers field.

allowedDrivers
Array of any or null <= 100 items

Driver IDs that are allowed to be assigned to this stop. If not provided, the stop will be assigned to any available driver during optimization. This field is mutually exclusive with the driver field. When the stop is first created, all the drivers in this list will be added to the plan as well. If the stop is updated, no changes will be made to the plan, so if you want to add a driver to the plan, you must also add them to the plan separately, if they are not already.

activity
string or null
Default: "delivery"
Enum: "delivery" "pickup"

Activity type

optimizationOrder
string or null
Enum: "first" "last" "default"

The preferred order of this stop in the optimized route. If not provided or "default", the stop will be placed in the optimal order, decided by the optimization algorithm. Otherwise it will be placed either "first" or "last".

packageCount
number or null [ 1 .. 100 ]

Number of packages in the stop

notes
string or null [ 1 .. 2000 ] characters

Notes for the stop

Responses

Request samples

Content type
application/json
[
  • {
    }
]

Response samples

Content type
application/json
{
  • "success": [
    ],
  • "failed": [
    ],
  • "pending": true
}

Delete a stop

Delete a stop on live plans. When the plan is not writable, this endpoint starts an editing session and the action can be applied through a new optimization, or be discarded.

Authorizations:
HTTP: BasicAuth
path Parameters
planId
required
string^[a-zA-Z0-9---_]{1,50}$

The plan id

stopId
required
string^[a-zA-Z0-9---_]{1,50}$

The stop id

Responses

Response samples

Content type
application/json
{
  • "pending": true
}

Drivers

Endpoints to operate on Drivers resources.

This resource is currently read-only on the API.

List Drivers

Authorizations:
HTTP: BasicAuth
query Parameters
maxPageSize
number [ 1 .. 50 ]
Default: 50

The maximum number of drivers to return.

pageToken
string [ 1 .. 255 ] characters

The page token to continue from.

object

The filter to apply to the list of drivers. The filter param is passed like this: ?filter[active]=true or like this: ?filter.active=true

Responses

Response samples

Content type
application/json
{
  • "drivers": [
    ],
  • "nextPageToken": null
}

Retrieve a driver

Authorizations:
HTTP: BasicAuth
path Parameters
driverId
required
string^[a-zA-Z0-9---_]{1,50}$

The driver id

Responses

Response samples

Content type
application/json
{
  • "id": null,
  • "name": null,
  • "email": null,
  • "phone": null,
  • "displayName": null,
  • "active": true
}

Depots

Endpoints to operate on Depots resources.

This resource is currently read-only on the API.

List Depots

Authorizations:
HTTP: BasicAuth
query Parameters
pageToken
string [ 1 .. 255 ] characters

The page token to continue from.

maxPageSize
number [ 1 .. 20 ]
Default: 20

The maximum number of depots to return.

Responses

Response samples

Content type
application/json
{
  • "depots": [
    ],
  • "nextPageToken": null
}

Retrieve a depot

Authorizations:
HTTP: BasicAuth
path Parameters
depotId
required
string^[a-zA-Z0-9---_]{1,50}$

The depot id

Responses

Response samples

Content type
application/json
{
  • "id": null,
  • "name": "string"
}

Routes

Endpoints to operate on Routes resources.

This resource is currently read-only on the API.

Retrieve a route

Authorizations:
HTTP: BasicAuth
path Parameters
routeId
required
string^[a-zA-Z0-9---_]{1,50}$

The route id

Responses

Response samples

Content type
application/json
{
  • "id": null,
  • "title": "string",
  • "stopCount": 0,
  • "driver": { },
  • "state": {
    },
  • "plan": { }
}

Operations

Endpoints to operate on Operations resources.

Cancel an operation

Cancel an operation that is not yet done.

Authorizations:
HTTP: BasicAuth
path Parameters
operationId
required
string^[a-zA-Z0-9---_]{1,50}$

The ID of the operation to cancel.

Responses

Response samples

Content type
application/json
{
  • "id": null,
  • "type": "plan_optimization",
  • "done": true,
  • "metadata": {
    },
  • "result": {
    }
}

Retrieve an operation

Authorizations:
HTTP: BasicAuth
path Parameters
operationId
required
string^[a-zA-Z0-9---_]{1,50}$

The ID of the operation to cancel.

Responses

Response samples

Content type
application/json
{
  • "id": null,
  • "type": "plan_optimization",
  • "done": true,
  • "metadata": {
    },
  • "result": {
    }
}

List operations

Authorizations:
HTTP: BasicAuth
query Parameters
pageToken
string [ 1 .. 255 ] characters

The page token to continue from.

maxPageSize
number [ 1 .. 20 ]
Default: 20

The maximum number of operations to return per page.

object

The filter to apply to the list of operations.

Responses

Response samples

Content type
application/json
{
  • "operations": [
    ],
  • "nextPageToken": null
}