Get single task

Get single task

If a task has been completed (state is 3) and details were provided by the worker at completion, these will be available in completionDetails. They include start, arrival, departure and completion times, first location, last location, and whether the task was successfully completed or if it was considered to have failed by the worker.

Tasks also include a delayTime , which you should leverage if you want to build custom logic around actions to be taken when a task is delayed.

Any recipient feedback (rating and comments) provided will appear in feedback.

If you would like to load the live tracking page for a task within your app, use the trackingURL value returned in the body of this request.

curl -X GET "https://onfleet.com/api/v2/tasks/qNMz6CKwQ*26FOslywsiQxhY" \
       -u "cd3b3de84cc1ee040bf06512d233719c:"
onfleet.tasks.get(id="qNMz6CKwQ*26FOslywsiQxhY")
onfleet.tasks.get("qNMz6CKwQ*26FOslywsiQxhY");
$onfleet->tasks->get("qNMz6CKwQ*26FOslywsiQxhY")
{
  "id": "qNMz6CKwQ*26FOslywsiQxhY",
  "timeCreated": 1455072004000,
  "timeLastModified": 1455152824153,
  "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
  "shortId": "5f8b5c65",
  "trackingURL": "https://onf.lt/5f8b5c65f9",
  "worker": "h*wSb*apKlDkUFnuLTtjPke7",
  "merchant": "yAM*fDkztrT3gUcz9mNDgNOL",
  "executor": "yAM*fDkztrT3gUcz9mNDgNOL",
  "creator": "EJmsbJgHiRLPjNVE7GEIPs7*",
  "dependencies": [],
  "state": 3,
  "completeAfter": null,
  "completeBefore": null,
  "pickupTask": false,
  "notes": "",
  "completionDetails": {
    "events": [
      {
        "name": "start",
        "time": 1455072035445
      },
      {
        "name": "arrival",
        "time": 1455152532564,
        "location": [
          -122.401521416785,
          37.7762999215933
        ]
      },
      {
        "name": "departure",
        "time": 1455072096121,
        "location": [
          -122.401357311869,
          37.776509919239
        ]
      }
    ],
    "failureReason": "NONE",
    "time": 1455152532732,
    "photoUploadId": "1cf9c8d5d00a763865729825",
    "notes": "All went great, customer loves us.",
    "success": true,
    "signatureUploadId": "a49846b937eeab3cea248301",
    "photoUploadIds": [],
    "firstLocation": [
      -122.401520936125,
      37.7762955408506
    ],
    "lastLocation": [
      -122.401521416785,
      37.7762999215933
    ],
    "distance": 7847.92014273528
  },
  "feedback": [],
  "metadata": [],
  "overrides": {},
  "quantity": 0,
  "serviceTime": 0,
  "trackingViewed": false,
  "estimatedCompletionTime": null,
  "delayTime": null,
  "destination": {
    "id": "Nml*Tdh1EMIk1RE46maqOLEQ",
    "timeCreated": 1455072004000,
    "timeLastModified": 1455072004352,
    "location": [
      -122.40522369999996,
      37.7718827
    ],
    "address": {
      "apartment": "",
      "state": "California",
      "postalCode": "94103",
      "country": "United States",
      "city": "San Francisco",
      "street": "Brannan Street",
      "number": "888"
    },
    "notes": "",
    "metadata": []
  },
  "eta": null,
  "recipients": [
    {
      "id": "xX87G1gSkeLvGXlHn2tn0~iB",
      "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
      "timeCreated": 1455072004000,
      "timeLastModified": 1455072025272,
      "name": "Mikel",
      "phone": "+16502837547",
      "notes": "",
      "skipSMSNotifications": false,
      "metadata": []
    }
  ]
}
{
  "code": "InvalidCredentials",
  "message": {
    "error": 1103,
    "message": "The resource requested is outside of the authenticated user's permissions scope.",
    "request": "f25e5ee9-cd6d-498a-8616-26c3bd205eba"
  }
}

When attempting to access a task endpoint that does not belong to your organization, an error message will be thrown stating that the request is outside of your permission scope.

📘

Estimated Completion Time and ETA

Tasks that have been assigned and are not yet started include an estimatedCompletionTime.

The ECT includes transit (travel time from the departure point to the destination) and service time as provided during task creation. If a serviceTime has been provided, this will be a constant value added to the transit estimate. If the task has been route optimized, we will use the service time from the route optimization solution. Finally, if a service time is not provided, we will always use the value based on your organization's past performance.

An eta property is also available for active tasks which you can use to access the number of seconds from worker’s position to reach the destination. This field is calculated by considering the worker's current GPS location plus the transit time to reach the destination coordinates which may vary by vehicle type and location.

📘

Data Types and Response Formats

For more information on datatype and formats, please see Data Types and Response Formats or free conversion tool online here.