GuidesAPI Reference
Guides

Implement custom time-distance matrices

Ensure more accurate and efficient tour planning by implementing a custom time-distance matrix to account for specific conditions and requirements of your business. For example, as a delivery service focused on a specific area, your matrix can better reflect the real-world conditions in that area in terms of traffic patterns, road networks, and regional delivery priorities, ensuring timely and efficient tour plan for your entire fleet.

Available for both synchronous and asynchronous requests, the custom matrix facilitates integration across a broader range of business use cases, from those demanding simplicity and immediacy to complex scenarios involving large vehicle routing problems.

📘

Note

This is an ALPHA feature, which means it is new or experimental and under active development. Alpha features are provided for testing and feedback purposes. They may change significantly or might not become generally available.

For more information, see Explore experimental features.

Understand the custom matrix model

In a HERE Tour Planning API problem JSON, you nest a custom matrix within the fleet.profiles.matrix object, either as a matrixId value in case of asynchronous requests or as a matrix object in case of synchronous requests. For the corresponding use cases, see the following sections.

Sample matrix

The following snippet contains a sample matrix object to demonstrate the required structure containing the mandatory origins, travelTimes, and distances arrays, as well as the optional errorCodes array:

{
  "origins": [
    {"type": "id", "id": "location_1"},
    {"type": "id", "id": "location_2"},
    {"type": "id", "id": "location_3"},
    {"type": "id", "id": "location_4"},
    {"type": "id", "id": "location_5"},
    {"type": "id", "id": "location_6"}
  ],
  "travelTimes": [0, 200, 237, 475, 477, 325, 159, 0, 325, 563, 565, 382, 513, 495, 0, 238, 240, 516, 467, 449, 292, 0, 2, 455, 465, 447, 290, 2, 0, 453, 274, 256, 163, 401, 403, 0],
  "distances": [0, 1002, 1517, 3176, 3189, 1805, 881, 0, 2118, 3777, 3790, 2535, 3235, 3292, 0, 1659, 1672, 3322, 2903, 2960, 2029, 0, 13, 3062, 2890, 2947, 2016, 13, 0, 3049, 1465, 1522, 1367, 3026, 3039, 0],
  "errorCodes": [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
}

This sample matrix contains six locations, referred to by their ID strings in the origins array. In addition, the matrix contains the travelTimes, distances, and errorCodes arrays that help calculate the most efficient routes between the locations within the origins array.

Origins

Type: Array of objects

This array represents an ordered list of locations in the matrix. Each object within the array contains the following properties:

  • type: The value is always id.
  • id: The ID of the location, as a string.

The following snippet shows a sample location encoded as part of a matrix object:

{
  "type": "id",
  "id": "location_1"
}
📘

Note

When using custom matrices, location coordinates are no longer required by the HERE Tour Planning API, ensuring easier compliance with privacy laws or requirements. Once you receive the solution, you can programmatically associate location IDs with their coordinates in your application to overlay the tour on a map.

Travel times

Type: Flat array of integers

The travelTimes array represents the travel time (in seconds) between every pair of locations captured as part of the origins array.

To better visualize the matrix structure and the relationship between different locations, the following table converts the travelTimes array from one-dimensional (flat) structure to two dimensions. In the following two-dimensional array, rows represent origins and columns represent destinations.

Origin/Destinationlocation_1location_2location_3location_4location_5location_6
location_10200237475477325
location_21590325563565382
location_35134950238240516
location_446744929202455
location_546544729020453
location_62742561634014030

As shown in the table, for example, the travel time from location_3 to location_2 is 495 seconds, while the travel time from location_2 to location_4 is 563 seconds, and so forth. Additionally, travel times between locations with the same IDs are always 0 seconds.

Distances

Type: Flat array of integers

The distances array represents the distance (in meters) between every pair of origins locations.

The following table demonstrates the distances array from the previous example, converted from one-dimensional (flat) structure to two dimensions:

Origin/Destinationlocation_1location_2location_3location_4location_5location_6
location_1010021517317631891805
location_288102118377737902535
location_3323532920165916723322
location_42903296020290133062
location_52890294720161303049
location_6146515221367302630390

As shown in the table, for example, the distance from location_1 to location_2 is 1002 meters, while the distance from location_5 to location_3 is 2016 meters, and so forth. Additionally, distances between locations with the same IDs are always 0 meters.

Optional: Error codes

Type: Flat array of integers

This optional array contains error codes for problems encountered on the route between the origin and destination, for example, a lack of available routes, violations, and so on. The following error code values are available:

  • 0: No error, a route is available.
  • 1: No route between the origin and destination exists.
  • 2: No valid starting or ending point for the route between the origin and destination locations.
  • 3: The route between the origin and destination exists but includes violations that could make it potentially unusable.
  • 4: The origin and destination locations are either just inside the acceptable range or completely outside the allowed area. Because of this, there are no valid route start or end points for origin and destination locations.
  • 99: Unknown error (for debugging and handling unexpected situations).

For more information, see the HERE Matrix Routing API Reference.

The following table demonstrates the errorCodes array from the previous example, converted from one-dimensional (flat) structure to two dimensions:

Origin/Destinationlocation_1location_2location_3location_4location_5location_6
location_1001000
location_2000000
location_3100000
location_4000000
location_5000000
location_6000000

In this 2D representation of the errorCodes array, the routes from location_3 to location_1 and from location_1 to location_3 are unavailable, resulting in error code 1 for each.

Index computation for flat matrices

The distances, travelTimes, and errorCode arrays are flat, meaning that they have one dimension only. The simplicity and performance benefits make flat arrays easier to work with and faster to access.

In a custom matrix, you can quickly retrieve distance, travel time, or error code for any origin-destination pair from the corresponding flat array by calculating its index position. Use the following formula to calculate the index (k) for a specific distance, travel time, or error code value:

k = num_destinations × i + j

Where:

  • num_destinations is the number of origins locations,
  • i is the row index (the origin, or starting, location),
  • j is the column index (the destination, or target, location),
  • k is the 1D index in the flattened array.

This formula helps you find the correct position in the flat array, based on the row and column of the origin-destination pair. For example, to retrieve the travel time between location_4 and location_2 from the sample travelTimes array provided previously:

  • num_destinations = 6 (there are six locations in total in the origins array)
  • i = 3 (the 0-based row index of location_4, which is the origin location)
  • j = 1 (the 0-based column index of location_2, which is the destination location)

Therefore: k = 6 × 3 + 1 = 18 + 1 = 19

The value assigned at index 19 of the travelTimes array is 449 seconds, which corresponds to the travel time between location_4 and location_2.

Implement custom matrices in synchronous requests

To use a custom matrix in a synchronous request, nest the matrix object within the target vehicle profile. By applying a custom matrix to a specific vehicle profile, you can tailor the distance and travel times based on the unique characteristics of that vehicle type.

📘

Note

The following custom matrix restrictions apply for synchronous requests:

  • You must post a full matrix object as part of a problem JSON because synchronous requests do not use matrixId.
  • You can post only a single custom matrix per request.

The following snippet shows a sample problem JSON. Because the problem is using a custom matrix, providing location coordinates along the corresponding location id value is optional. You can omit location coordinates for jobs, for example, to comply with your local or company privacy policy.

Click to expand/collapse the sample JSON
{
  "fleet": {
    "types": [
      {
        "id": "car_1",
        "profile": "delivery_car",
        "costs": {
          "fixed": 10,
          "distance": 0.004,
          "time": 0.009
        },
        "shifts": [
          {
            "start": {
              "time": "2024-09-20T08:30:00Z",
              "location": {
                "id": "location_6"
              }
            },
            "end": {
              "time": "2024-09-20T16:30:00Z",
              "location": {
                "id": "location_6"
              }
            }
          }
        ],
        "capacity": [
          175
        ],
        "amount": 1
      }
    ],
    "profiles": [
      {
        "type": "car",
        "name": "delivery_car",
        "matrix": {
          "origins": [
            {
              "type": "id",
              "id": "location_1"
            },
            {
              "type": "id",
              "id": "location_2"
            },
            {
              "type": "id",
              "id": "location_3"
            },
            {
              "type": "id",
              "id": "location_4"
            },
            {
              "type": "id",
              "id": "location_5"
            },
            {
              "type": "id",
              "id": "location_6"
            }
          ],
          "travelTimes": [
            0,
            200,
            237,
            475,
            477,
            325,
            159,
            0,
            325,
            563,
            565,
            382,
            513,
            495,
            0,
            238,
            240,
            516,
            467,
            449,
            292,
            0,
            2,
            455,
            465,
            447,
            290,
            2,
            0,
            453,
            274,
            256,
            163,
            401,
            403,
            0
          ],
          "distances": [
            0,
            1002,
            1517,
            3176,
            3189,
            1805,
            881,
            0,
            2118,
            3777,
            3790,
            2535,
            3235,
            3292,
            0,
            1659,
            1672,
            3322,
            2903,
            2960,
            2029,
            0,
            13,
            3062,
            2890,
            2947,
            2016,
            13,
            0,
            3049,
            1465,
            1522,
            1367,
            3026,
            3039,
            0
          ]
        }
      }
    ]
  },
  "plan": {
    "jobs": [
      {
        "id": "job_1",
        "tasks": {
          "deliveries": [
            {
              "places": [
                {
                  "location": {
                    "id": "location_1"
                  },
                  "duration": 180
                }
              ],
              "demand": [
                16
              ]
            }
          ]
        }
      },
      {
        "id": "job_2",
        "tasks": {
          "deliveries": [
            {
              "places": [
                {
                  "location": {
                    "id": "location_2"
                  },
                  "duration": 600
                }
              ],
              "demand": [
                12
              ]
            }
          ]
        }
      },
      {
        "id": "job_3",
        "tasks": {
          "deliveries": [
            {
              "places": [
                {
                  "location": {
                    "id": "location_3"
                  },
                  "duration": 300
                }
              ],
              "demand": [
                6
              ]
            }
          ]
        }
      },
      {
        "id": "job_4",
        "tasks": {
          "deliveries": [
            {
              "places": [
                {
                  "location": {
                    "id": "location_4"
                  },
                  "duration": 720
                }
              ],
              "demand": [
                18
              ]
            }
          ]
        }
      },
      {
        "id": "job_5",
        "tasks": {
          "deliveries": [
            {
              "places": [
                {
                  "location": {
                    "id": "location_5"
                  },
                  "duration": 600
                }
              ],
              "demand": [
                12
              ]
            }
          ]
        }
      }
    ]
  }
}

In response to the request, the API returns a solution, as shown in the following example:

Click to expand/collapse the sample JSON
{
  "statistic": {
    "cost": 78.269,
    "distance": 8641,
    "duration": 3745,
    "times": {
      "driving": 1345,
      "serving": 2400,
      "waiting": 0,
      "stopping": 0,
      "break": 0
    }
  },
  "tours": [
    {
      "vehicleId": "car_1_1",
      "typeId": "car_1",
      "stops": [
        {
          "time": {
            "arrival": "2024-09-20T08:30:00Z",
            "departure": "2024-09-20T08:30:00Z"
          },
          "load": [
            64
          ],
          "activities": [
            {
              "jobId": "departure",
              "type": "departure",
              "location": {
                "id": "location_6"
              },
              "time": {
                "start": "2024-09-20T08:30:00Z",
                "end": "2024-09-20T08:30:00Z"
              }
            }
          ],
          "location": {
            "id": "location_6"
          },
          "distance": 0
        },
        {
          "time": {
            "arrival": "2024-09-20T08:34:16Z",
            "departure": "2024-09-20T08:44:16Z"
          },
          "load": [
            52
          ],
          "activities": [
            {
              "jobId": "job_2",
              "type": "delivery",
              "location": {
                "id": "location_2"
              },
              "time": {
                "start": "2024-09-20T08:34:16Z",
                "end": "2024-09-20T08:44:16Z"
              }
            }
          ],
          "location": {
            "id": "location_2"
          },
          "distance": 1522
        },
        {
          "time": {
            "arrival": "2024-09-20T08:46:55Z",
            "departure": "2024-09-20T08:49:55Z"
          },
          "load": [
            36
          ],
          "activities": [
            {
              "jobId": "job_1",
              "type": "delivery",
              "location": {
                "id": "location_1"
              },
              "time": {
                "start": "2024-09-20T08:46:55Z",
                "end": "2024-09-20T08:49:55Z"
              }
            }
          ],
          "location": {
            "id": "location_1"
          },
          "distance": 2403
        },
        {
          "time": {
            "arrival": "2024-09-20T08:53:52Z",
            "departure": "2024-09-20T08:58:52Z"
          },
          "load": [
            30
          ],
          "activities": [
            {
              "jobId": "job_3",
              "type": "delivery",
              "location": {
                "id": "location_3"
              },
              "time": {
                "start": "2024-09-20T08:53:52Z",
                "end": "2024-09-20T08:58:52Z"
              }
            }
          ],
          "location": {
            "id": "location_3"
          },
          "distance": 3920
        },
        {
          "time": {
            "arrival": "2024-09-20T09:02:50Z",
            "departure": "2024-09-20T09:14:50Z"
          },
          "load": [
            12
          ],
          "activities": [
            {
              "jobId": "job_4",
              "type": "delivery",
              "location": {
                "id": "location_4"
              },
              "time": {
                "start": "2024-09-20T09:02:50Z",
                "end": "2024-09-20T09:14:50Z"
              }
            }
          ],
          "location": {
            "id": "location_4"
          },
          "distance": 5579
        },
        {
          "time": {
            "arrival": "2024-09-20T09:14:52Z",
            "departure": "2024-09-20T09:24:52Z"
          },
          "load": [
            0
          ],
          "activities": [
            {
              "jobId": "job_5",
              "type": "delivery",
              "location": {
                "id": "location_5"
              },
              "time": {
                "start": "2024-09-20T09:14:52Z",
                "end": "2024-09-20T09:24:52Z"
              }
            }
          ],
          "location": {
            "id": "location_5"
          },
          "distance": 5592
        },
        {
          "time": {
            "arrival": "2024-09-20T09:32:25Z",
            "departure": "2024-09-20T09:32:25Z"
          },
          "load": [
            0
          ],
          "activities": [
            {
              "jobId": "arrival",
              "type": "arrival",
              "location": {
                "id": "location_6"
              },
              "time": {
                "start": "2024-09-20T09:32:25Z",
                "end": "2024-09-20T09:32:25Z"
              }
            }
          ],
          "location": {
            "id": "location_6"
          },
          "distance": 8641
        }
      ],
      "statistic": {
        "cost": 78.269,
        "distance": 8641,
        "duration": 3745,
        "times": {
          "driving": 1345,
          "serving": 2400,
          "waiting": 0,
          "stopping": 0,
          "break": 0
        }
      },
      "shiftIndex": 0
    }
  ]
}

If location coordinates are not provided in the problem (as in the previous example), you must match location IDs to the corresponding coordinates in your system to superimpose the tour on a map.

Implement custom matrices in asynchronous requests

Implementing a custom matrix as part of an asynchronous request requires a different approach as compared with synchronous requests. First, you need to post the matrix object to the dedicated /matrices endpoint. Then, after obtaining a matrixId, you embed that ID within the target vehicle profile in the problem. The following steps demonstrate how to implement custom matrix as part of the asynchronous request process.

📘

Note

The following custom matrix restrictions apply for asynchronous requests:

  • You can reference up to two matrixId values within a single problem. This allows for up to two vehicle profiles to use dedicated custom matrices.
  • After posting, you can use a matrix ID for up to 24 hours. After that period, you must re-post the matrix to the /matrices endpoint and obtain a new matrixId.

1. Post the matrix and obtain matrixId

Upload your custom matrix to the /matrices endpoint of the HERE Tour Planning API by using the POST method.

The following snippet provides a sample request using the curl command to post the sample matrix demonstrated in previous sections:

curl --location 'https://tourplanning.hereapi.com/v3/matrices?apikey=<YOUR_HERE_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
    "origins": [
        {
            "type": "id",
            "id": "location_1"
        },
        {
            "type": "id",
            "id": "location_2"
        },
        {
            "type": "id",
            "id": "location_3"
        },
        {
            "type": "id",
            "id": "location_4"
        },
        {
            "type": "id",
            "id": "location_5"
        },
        {
            "type": "id",
            "id": "location_6"
        }
    ],
    "travelTimes": [
        0,
        200,
        237,
        475,
        477,
        325,
        159,
        0,
        325,
        563,
        565,
        382,
        513,
        495,
        0,
        238,
        240,
        516,
        467,
        449,
        292,
        0,
        2,
        455,
        465,
        447,
        290,
        2,
        0,
        453,
        274,
        256,
        163,
        401,
        403,
        0
    ],
    "distances": [
        0,
        1002,
        1517,
        3176,
        3189,
        1805,
        881,
        0,
        2118,
        3777,
        3790,
        2535,
        3235,
        3292,
        0,
        1659,
        1672,
        3322,
        2903,
        2960,
        2029,
        0,
        13,
        3062,
        2890,
        2947,
        2016,
        13,
        0,
        3049,
        1465,
        1522,
        1367,
        3026,
        3039,
        0
    ]
}'

Result: The API responds with a matrix ID object, as shown in the following sample:

{
  "matrixId": "3d6be06e-2609-4229-bc7f-509ba646aa29"
}

2. Send an asynchronous request

Embed the matrixId value that you obtained in the previous step within the problem JSON body, and then send the request to the /problems/async endpoint.

The following snippet shows a sample problem JSON, adjusted for asynchronous requests, using a single custom matrix in the form of a matrixId property:

Click to expand/collapse the sample JSON
{
  "fleet": {
    "types": [
      {
        "id": "car_1",
        "profile": "delivery_car",
        "costs": {
          "fixed": 10,
          "distance": 0.004,
          "time": 0.009
        },
        "shifts": [
          {
            "start": {
              "time": "2024-09-20T08:30:00Z",
              "location": {
                "id": "location_6"
              }
            },
            "end": {
              "time": "2024-09-20T16:30:00Z",
              "location": {
                "id": "location_6"
              }
            }
          }
        ],
        "capacity": [
          175
        ],
        "amount": 1
      }
    ],
    "profiles": [
      {
        "type": "car",
        "name": "delivery_car",
        "matrixId": "3d6be06e-2609-4229-bc7f-509ba646aa29"
      }
    ]
  },
  "plan": {
    "jobs": [
      {
        "id": "job_1",
        "tasks": {
          "deliveries": [
            {
              "places": [
                {
                  "location": {
                    "id": "location_1"
                  },
                  "duration": 180
                }
              ],
              "demand": [
                16
              ]
            }
          ]
        }
      },
      {
        "id": "job_2",
        "tasks": {
          "deliveries": [
            {
              "places": [
                {
                  "location": {
                    "id": "location_2"
                  },
                  "duration": 600
                }
              ],
              "demand": [
                12
              ]
            }
          ]
        }
      },
      {
        "id": "job_3",
        "tasks": {
          "deliveries": [
            {
              "places": [
                {
                  "location": {
                    "id": "location_3"
                  },
                  "duration": 300
                }
              ],
              "demand": [
                6
              ]
            }
          ]
        }
      },
      {
        "id": "job_4",
        "tasks": {
          "deliveries": [
            {
              "places": [
                {
                  "location": {
                    "id": "location_4"
                  },
                  "duration": 720
                }
              ],
              "demand": [
                18
              ]
            }
          ]
        }
      },
      {
        "id": "job_5",
        "tasks": {
          "deliveries": [
            {
              "places": [
                {
                  "location": {
                    "id": "location_5"
                  },
                  "duration": 600
                }
              ],
              "demand": [
                12
              ]
            }
          ]
        }
      }
    ]
  }
}

The following snippet contains the previous problem’s JSON embedded as the body of a sample request using the curl command:

Click to expand/collapse the sample JSON
curl --location 'https://tourplanning.hereapi.com/v3/problems/async?apikey=<YOUR_HERE_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
  "fleet": {
    "types": [
      {
        "id": "car_1",
        "profile": "delivery_car",
        "costs": {
          "fixed": 10,
          "distance": 0.004,
          "time": 0.009
        },
        "shifts": [
          {
            "start": {
              "time": "2024-09-20T08:30:00Z",
              "location": {
                "id": "location_6"
              }
            },
            "end": {
              "time": "2024-09-20T16:30:00Z",
              "location": {
                "id": "location_6"
              }
            }
          }
        ],
        "capacity": [
          175
        ],
        "amount": 1
      }
    ],
    "profiles": [
      {
        "type": "car",
        "name": "delivery_car",
        "matrixId": "3d6be06e-2609-4229-bc7f-509ba646aa29"
      }
    ]
  },
  "plan": {
    "jobs": [
      {
        "id": "job_1",
        "tasks": {
          "deliveries": [
            {
              "places": [
                {
                  "location": {
                    "id": "location_1"
                  },
                  "duration": 180
                }
              ],
              "demand": [
                16
              ]
            }
          ]
        }
      },
      {
        "id": "job_2",
        "tasks": {
          "deliveries": [
            {
              "places": [
                {
                  "location": {
                    "id": "location_2"
                  },
                  "duration": 600
                }
              ],
              "demand": [
                12
              ]
            }
          ]
        }
      },
      {
        "id": "job_3",
        "tasks": {
          "deliveries": [
            {
              "places": [
                {
                  "location": {
                    "id": "location_3"
                  },
                  "duration": 300
                }
              ],
              "demand": [
                6
              ]
            }
          ]
        }
      },
      {
        "id": "job_4",
        "tasks": {
          "deliveries": [
            {
              "places": [
                {
                  "location": {
                    "id": "location_4"
                  },
                  "duration": 720
                }
              ],
              "demand": [
                18
              ]
            }
          ]
        }
      },
      {
        "id": "job_5",
        "tasks": {
          "deliveries": [
            {
              "places": [
                {
                  "location": {
                    "id": "location_5"
                  },
                  "duration": 600
                }
              ],
              "demand": [
                12
              ]
            }
          ]
        }
      }
    ]
  }
}'

Result: The API responds with the request status ID and the status URL, as shown in the following example:

{
  "statusId": "1298a8bc-bc91-4ff6-a664-f62a58e1d147",
  "href": "https://tourplanning.hereapi.com/v3/status/1298a8bc-bc91-4ff6-a664-f62a58e1d147"
}

3. Obtain the solution URL

Use the status URL to periodically poll the /status endpoint for the solution URL, as shown in the following example:

https://tourplanning.hereapi.com/v3/status/<statusId>?apikey=<YOUR_HERE_API_KEY>

Result: When the solution status changes from pending to success, the API provides you with the solution URL that you can use to retrieve the solution:

{
  "status": "success",
  "resource": {
    "resourceId": "1298a8bc-bc91-4ff6-a664-f62a58e1d147",
    "href": "https://tourplanning.hereapi.com/v3/problems/1298a8bc-bc91-4ff6-a664-f62a58e1d147/solution"
  }
}

4. Retrieve the solution

Use the resource ID that you obtained in the previous step to download the solution, as shown in the following example:

https://tourplanning.hereapi.com/v3/problems/<resourceId>/solution?apikey=<YOUR_HERE_API_KEY>

Result: The API responds with the full solution JSON, for example:

Click to expand/collapse the sample JSON
{
  "statistic": {
    "cost": 78.269,
    "distance": 8641,
    "duration": 3745,
    "times": {
      "driving": 1345,
      "serving": 2400,
      "waiting": 0,
      "stopping": 0,
      "break": 0
    }
  },
  "tours": [
    {
      "vehicleId": "car_1_1",
      "typeId": "car_1",
      "stops": [
        {
          "time": {
            "arrival": "2024-09-20T08:30:00Z",
            "departure": "2024-09-20T08:30:00Z"
          },
          "load": [64],
          "activities": [
            {
              "jobId": "departure",
              "type": "departure",
              "location": {
                "id": "location_6"
              },
              "time": {
                "start": "2024-09-20T08:30:00Z",
                "end": "2024-09-20T08:30:00Z"
              }
            }
          ],
          "location": {
            "id": "location_6"
          },
          "distance": 0
        },
        {
          "time": {
            "arrival": "2024-09-20T08:34:16Z",
            "departure": "2024-09-20T08:44:16Z"
          },
          "load": [52],
          "activities": [
            {
              "jobId": "job_2",
              "type": "delivery",
              "location": {
                "id": "location_2"
              },
              "time": {
                "start": "2024-09-20T08:34:16Z",
                "end": "2024-09-20T08:44:16Z"
              }
            }
          ],
          "location": {
            "id": "location_2"
          },
          "distance": 1522
        },
        {
          "time": {
            "arrival": "2024-09-20T08:46:55Z",
            "departure": "2024-09-20T08:49:55Z"
          },
          "load": [36],
          "activities": [
            {
              "jobId": "job_1",
              "type": "delivery",
              "location": {
                "id": "location_1"
              },
              "time": {
                "start": "2024-09-20T08:46:55Z",
                "end": "2024-09-20T08:49:55Z"
              }
            }
          ],
          "location": {
            "id": "location_1"
          },
          "distance": 2403
        },
        {
          "time": {
            "arrival": "2024-09-20T08:53:52Z",
            "departure": "2024-09-20T08:58:52Z"
          },
          "load": [30],
          "activities": [
            {
              "jobId": "job_3",
              "type": "delivery",
              "location": {
                "id": "location_3"
              },
              "time": {
                "start": "2024-09-20T08:53:52Z",
                "end": "2024-09-20T08:58:52Z"
              }
            }
          ],
          "location": {
            "id": "location_3"
          },
          "distance": 3920
        },
        {
          "time": {
            "arrival": "2024-09-20T09:02:50Z",
            "departure": "2024-09-20T09:14:50Z"
          },
          "load": [12],
          "activities": [
            {
              "jobId": "job_4",
              "type": "delivery",
              "location": {
                "id": "location_4"
              },
              "time": {
                "start": "2024-09-20T09:02:50Z",
                "end": "2024-09-20T09:14:50Z"
              }
            }
          ],
          "location": {
            "id": "location_4"
          },
          "distance": 5579
        },
        {
          "time": {
            "arrival": "2024-09-20T09:14:52Z",
            "departure": "2024-09-20T09:24:52Z"
          },
          "load": [0],
          "activities": [
            {
              "jobId": "job_5",
              "type": "delivery",
              "location": {
                "id": "location_5"
              },
              "time": {
                "start": "2024-09-20T09:14:52Z",
                "end": "2024-09-20T09:24:52Z"
              }
            }
          ],
          "location": {
            "id": "location_5"
          },
          "distance": 5592
        },
        {
          "time": {
            "arrival": "2024-09-20T09:32:25Z",
            "departure": "2024-09-20T09:32:25Z"
          },
          "load": [0],
          "activities": [
            {
              "jobId": "arrival",
              "type": "arrival",
              "location": {
                "id": "location_6"
              },
              "time": {
                "start": "2024-09-20T09:32:25Z",
                "end": "2024-09-20T09:32:25Z"
              }
            }
          ],
          "location": {
            "id": "location_6"
          },
          "distance": 8641
        }
      ],
      "statistic": {
        "cost": 78.269,
        "distance": 8641,
        "duration": 3745,
        "times": {
          "driving": 1345,
          "serving": 2400,
          "waiting": 0,
          "stopping": 0,
          "break": 0
        }
      },
      "shiftIndex": 0
    }
  ]
}

Next steps

  • For more information about formulating problems in the HERE Tour Planning API, see Problem.
  • For an in-depth exploration of the HERE Tour Planning API methods, endpoints, and parameters, see the API Reference.