Driver Time Estimate

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.
Request must have at least 1 of: dropoffLocation or pickupLocation

pickupLocation

string

Optional. Must be in the format: longitude,latitude.
Request must have at least 1 of: dropoffLocation or pickupLocation

pickupTime

number

Optional. If the request includes pickupLocation
: pickupTime must be present if the time is fewer than 3 hours in the future. Format: unix epoch time.

restrictedVehicleTypes

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=DAD' -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"
  }
}