GET Driver Time Estimates
The Driver Time Estimates endpoint allows an API user to get estimated times for tasks that haven’t been created yet. The endpoint queries a specified team and returns a selected worker with an estimate of their travel time, travel distance, estimated time of arrival (ETA) and estimated time of completion (ETC).
This endpoint can be used to provide estimates to end recipients/customers in external e-commerce systems before an order is placed.
In order to use this endpoint, the organization must have:
- a hub defined for the team
- workers on duty at the time of the query
Query parameters:
Name | Type | Description |
---|---|---|
dropoffLocation | string | Optional. Must be in the format: longitude,latitude. |
pickupLocation | string | Optional. Must be in the format: longitude,latitude. |
pickupTime | number | Optional. If the request includes pickupLocation |
restrictedVehiclesTypes | string | Vehicle types to ignore in the query. Valid vehicle types are CAR, MOTORCYCLE, BICYCLE, TRUCK |
serviceTime | number | Optional. The expected time a worker will take at the pickupLocation, dropoffLocation, or both (as applicable) Unit: seconds. Default: 120. |
curl -X GET "https://onfleet.com/api/v2/teams/aasZ3KnsrPapys5M5Ug3qXom/estimate?dropoffLocation=-122.2442512,37.8097414&serviceTime=300&pickupLocation=-122.2514556,37.7577242&pickupTime=1614895847&restrictedVehiclesTypes=CAR' -u "cd3b3de84cc1ee040bf06512d233719c:" | jq
{
"workerId": "TNTOVPKcxDjX02MOCScKl2M5",
"vehicle": "CAR",
"steps": [
{
"location": [
-122.2514556,
37.7577242
],
"travelTime": 682,
"distance": 11117,
"serviceTime": 300,
"arrivalTime": 1614896529,
"completionTime": 1614896829
},
{
"location": [
-122.2442512,
37.8097414
],
"travelTime": 1144,
"distance": 7079,
"serviceTime": 300,
"arrivalTime": 1614897972,
"completionTime": 1614898272
}
]
}
{
"code": "ResourceNotFound",
"message": {
"error": 1402,
"message": "The requested resource does not exist.",
"request": "d3ab2738-ae59-48f0-96d7-d75d2a47cfdb"
}
}
Units
Both
travelTime
andserviceTime
fields are in seconds, whilearrivalTime
andcompletionTime
are in unix time in seconds precision.Distance is in meters.