Calculate Route Timing
curl --request POST \
--url https://api.sandbox.usenash.com/v1/routes/{id}/calculate-timing \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.sandbox.usenash.com/v1/routes/{id}/calculate-timing"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.sandbox.usenash.com/v1/routes/{id}/calculate-timing', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.usenash.com/v1/routes/{id}/calculate-timing",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.usenash.com/v1/routes/{id}/calculate-timing"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.usenash.com/v1/routes/{id}/calculate-timing")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.usenash.com/v1/routes/{id}/calculate-timing")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"route": {
"id": "rte_JphRWDiEosGpXuxwgaYfY3",
"portalUrl": "https://portal.usenash.com/routes/rte_JphRWDiEosGpXuxwgaYfY3",
"type": "SINGLE_PICKUP_MULTIPLE_DROPOFFS",
"stops": [
{
"stopType": "PICKUP",
"objectIds": [
"ord_Qr5bVt8WiByGh66z2g7xEu",
"ord_WJFuooSiRvFCaceGZjpbqs"
],
"location": {
"lat": 45.558214,
"lng": -122.587074
},
"arrivalTime": "2025-04-25T03:27:00",
"departTime": "2025-04-25T03:30:00",
"plannedArrivalTime": "2025-04-25T03:27:00",
"serviceTime": 360,
"distanceFromPrevious": 3376,
"durationFromPrevious": 420,
"status": "PENDING",
"statusDescription": "leave_unattended",
"statusHistory": [
{
"created_at": "2025-04-25T03:00:00Z",
"status": "PENDING"
},
{
"created_at": "2025-04-25T03:15:00Z",
"status": "ENROUTE"
},
{
"created_at": "2025-04-25T03:20:00Z",
"status": "COMPLETED",
"status_description": "leave_unattended"
}
],
"metadata": {},
"startedAt": "2025-04-25T03:27:00Z",
"breakDuration": 123,
"orders": [
{
"id": "ord_Qr5bVt8WiByGh66z2g7xEu",
"externalId": "<string>",
"publicTrackingUrl": "<string>",
"pod": [
{
"type": "<string>",
"url": "<string>",
"uploadedAt": "<string>"
}
],
"orderItems": [
{
"id": "item-001",
"description": "<string>",
"count": 123,
"valueCents": 123,
"barcode": "<string>",
"sku": "<string>",
"category": "<string>",
"status": "delivered",
"availableQuantity": 123,
"statusMetadata": {
"pickedAt": "<string>",
"deliveredAt": "<string>",
"failedAt": "<string>",
"returnedAt": "<string>",
"failureReason": "<string>",
"failureLocation": "dropoff"
},
"statusHistory": [
{
"status": "picked",
"createdAt": "2025-04-25T03:20:00"
}
],
"subItems": [
"<unknown>"
]
}
]
}
]
}
],
"externalId": "rte_JphRWDiEosGpXuxwgaYfY3",
"name": "Route 1",
"courierId": "cor_9dK2mNp7xVt3RfWzY8sLbQ",
"vehicleId": "veh_4hL8pXq2sVn6RtY3wCbD9M",
"courier": {
"id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"phoneNumber": "<string>"
},
"driverGroup": {
"id": "<string>",
"externalId": "<string>"
},
"courierPosition": {
"lat": 123,
"lng": 123,
"updatedAt": "<string>",
"capturedAt": "<string>",
"accuracy": 123,
"heading": 123,
"speed": 123,
"altitude": 123,
"altitudeAccuracy": 123,
"batteryLevel": 123,
"batteryIsCharging": true,
"isMoving": true
},
"vehicle": {
"licensePlate": "<string>",
"make": "<string>",
"model": "<string>",
"color": "<string>",
"year": 123,
"type": "<string>"
},
"providerName": "<string>",
"shiftId": "shf_1234567890abcdef12345678",
"isDispatched": false,
"jobId": "job_1234567890abcdef12345678",
"routeMetadata": {
"priority": "high",
"source": "optimization_engine"
},
"validationErrors": {
"order_123": "Order 123 has pickup but no dropoff"
},
"encodedPolyline": "<string>",
"status": "CREATED",
"statusHistory": [
{
"created_at": "2025-04-25T03:00:00Z",
"status": "CREATED"
},
{
"created_at": "2025-04-25T03:10:00Z",
"status": "ASSIGNED"
},
{
"created_at": "2025-04-25T03:15:00Z",
"status": "STARTED"
}
]
},
"mappedRoutesPolyline": [
{}
]
}[
{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"response_status": "<string>",
"RequestID": "<string>"
}
]Calculate Route Timing
Calculate per-stop ETAs and polyline for a route using HERE truck routing. Updates arrival/departure times for each stop and returns the route polyline.
POST
/
v1
/
routes
/
{id}
/
calculate-timing
Calculate Route Timing
curl --request POST \
--url https://api.sandbox.usenash.com/v1/routes/{id}/calculate-timing \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.sandbox.usenash.com/v1/routes/{id}/calculate-timing"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.sandbox.usenash.com/v1/routes/{id}/calculate-timing', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.usenash.com/v1/routes/{id}/calculate-timing",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.usenash.com/v1/routes/{id}/calculate-timing"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.usenash.com/v1/routes/{id}/calculate-timing")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.usenash.com/v1/routes/{id}/calculate-timing")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"route": {
"id": "rte_JphRWDiEosGpXuxwgaYfY3",
"portalUrl": "https://portal.usenash.com/routes/rte_JphRWDiEosGpXuxwgaYfY3",
"type": "SINGLE_PICKUP_MULTIPLE_DROPOFFS",
"stops": [
{
"stopType": "PICKUP",
"objectIds": [
"ord_Qr5bVt8WiByGh66z2g7xEu",
"ord_WJFuooSiRvFCaceGZjpbqs"
],
"location": {
"lat": 45.558214,
"lng": -122.587074
},
"arrivalTime": "2025-04-25T03:27:00",
"departTime": "2025-04-25T03:30:00",
"plannedArrivalTime": "2025-04-25T03:27:00",
"serviceTime": 360,
"distanceFromPrevious": 3376,
"durationFromPrevious": 420,
"status": "PENDING",
"statusDescription": "leave_unattended",
"statusHistory": [
{
"created_at": "2025-04-25T03:00:00Z",
"status": "PENDING"
},
{
"created_at": "2025-04-25T03:15:00Z",
"status": "ENROUTE"
},
{
"created_at": "2025-04-25T03:20:00Z",
"status": "COMPLETED",
"status_description": "leave_unattended"
}
],
"metadata": {},
"startedAt": "2025-04-25T03:27:00Z",
"breakDuration": 123,
"orders": [
{
"id": "ord_Qr5bVt8WiByGh66z2g7xEu",
"externalId": "<string>",
"publicTrackingUrl": "<string>",
"pod": [
{
"type": "<string>",
"url": "<string>",
"uploadedAt": "<string>"
}
],
"orderItems": [
{
"id": "item-001",
"description": "<string>",
"count": 123,
"valueCents": 123,
"barcode": "<string>",
"sku": "<string>",
"category": "<string>",
"status": "delivered",
"availableQuantity": 123,
"statusMetadata": {
"pickedAt": "<string>",
"deliveredAt": "<string>",
"failedAt": "<string>",
"returnedAt": "<string>",
"failureReason": "<string>",
"failureLocation": "dropoff"
},
"statusHistory": [
{
"status": "picked",
"createdAt": "2025-04-25T03:20:00"
}
],
"subItems": [
"<unknown>"
]
}
]
}
]
}
],
"externalId": "rte_JphRWDiEosGpXuxwgaYfY3",
"name": "Route 1",
"courierId": "cor_9dK2mNp7xVt3RfWzY8sLbQ",
"vehicleId": "veh_4hL8pXq2sVn6RtY3wCbD9M",
"courier": {
"id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"phoneNumber": "<string>"
},
"driverGroup": {
"id": "<string>",
"externalId": "<string>"
},
"courierPosition": {
"lat": 123,
"lng": 123,
"updatedAt": "<string>",
"capturedAt": "<string>",
"accuracy": 123,
"heading": 123,
"speed": 123,
"altitude": 123,
"altitudeAccuracy": 123,
"batteryLevel": 123,
"batteryIsCharging": true,
"isMoving": true
},
"vehicle": {
"licensePlate": "<string>",
"make": "<string>",
"model": "<string>",
"color": "<string>",
"year": 123,
"type": "<string>"
},
"providerName": "<string>",
"shiftId": "shf_1234567890abcdef12345678",
"isDispatched": false,
"jobId": "job_1234567890abcdef12345678",
"routeMetadata": {
"priority": "high",
"source": "optimization_engine"
},
"validationErrors": {
"order_123": "Order 123 has pickup but no dropoff"
},
"encodedPolyline": "<string>",
"status": "CREATED",
"statusHistory": [
{
"created_at": "2025-04-25T03:00:00Z",
"status": "CREATED"
},
{
"created_at": "2025-04-25T03:10:00Z",
"status": "ASSIGNED"
},
{
"created_at": "2025-04-25T03:15:00Z",
"status": "STARTED"
}
]
},
"mappedRoutesPolyline": [
{}
]
}[
{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"response_status": "<string>",
"RequestID": "<string>"
}
]Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Route ID
Was this page helpful?