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.
A Task will return a routePlan
field if it is a part of a Route Plan. The field will be absent if the task is not in a Route Plan.
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",
"orderShortId": null,
"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"
}
}
{
"id": "M~NgEWdvKl4naQcNz29zDN8v",
"timeCreated": 1721148688000,
"timeLastModified": 1721148691872,
"organization": "IkslFemIdKalRKmVYY3pWCW~",
"shortId": "02cf3365",
"orderShortId": null,
"trackingURL": "https://onf.lt/02cf3365",
"worker": null,
"merchant": "IkslFemIdKalRKmVYY3pWCW~",
"executor": "IkslFemIdKalRKmVYY3pWCW~",
"creator": "lyEgBv9h12D6KjO~Wd~3K~qp",
"dependencies": [],
"state": 0,
"completeAfter": null,
"completeBefore": null,
"pickupTask": false,
"notes": "",
"completionDetails": {
"failureNotes": "",
"successNotes": "",
"failureReason": "NONE",
"events": [],
"actions": [],
"time": null,
"signatureUploadId": null,
"photoUploadId": null,
"photoUploadIds": null,
"firstLocation": [],
"lastLocation": [],
"unavailableAttachments": []
},
"feedback": [],
"metadata": [],
"overrides": {},
"quantity": 0,
"additionalQuantities": {
"quantityA": 0,
"quantityB": 0,
"quantityC": 0
},
"serviceTime": 0,
"identity": {
"failedScanCount": 0,
"checksum": null
},
"appearance": {
"triangleColor": null
},
"scanOnlyRequiredBarcodes": false,
"customFields": [
{
"description": "",
"asArray": false,
"visibility": [
"admin",
"api",
"worker"
],
"editability": [
"admin",
"api"
],
"key": "boolTest2",
"name": "deleted no req bool test",
"type": "boolean",
"contexts": [
{
"isRequired": false,
"conditions": [],
"name": "save"
}
],
"value": false
},
{
"description": "",
"asArray": false,
"visibility": [
"admin",
"api",
"worker"
],
"editability": [
"admin",
"api"
],
"key": "boolTest2",
"name": "no req bool test",
"type": "boolean",
"contexts": [
{
"isRequired": false,
"conditions": [],
"name": "save"
}
],
"value": false
},
{
"description": "testing field order",
"asArray": false,
"visibility": [
"admin",
"api",
"worker"
],
"editability": [
"admin",
"api"
],
"key": "newfield",
"name": "new field!",
"type": "boolean",
"contexts": [
{
"isRequired": false,
"conditions": [],
"name": "save"
}
],
"value": false
}
],
"routePlan": "d4q6sSH1WBbZsP0z4tsAh9Ir",
"container": {
"type": "ORGANIZATION",
"organization": "IkslFemIdKalRKmVYY3pWCW~"
},
"trackingViewed": false,
"recipients": [],
"estimatedCompletionTime": null,
"estimatedArrivalTime": null,
"delayTime": null,
"eta": null,
"destination": {
"id": "2jHSBD7~SktinmoEdS2FqwZK",
"timeCreated": 1721148688000,
"timeLastModified": 1721148688629,
"location": [
-117.8862833,
33.9156138
],
"address": {
"apartment": "",
"state": "California",
"postalCode": "92821",
"number": "1065",
"street": "Brea Mall",
"city": "Brea",
"country": "United States",
"name": "Brea Mall"
},
"notes": "",
"metadata": [],
"googlePlaceId": "ChIJwS0hgwbV3IARL4oucH0V6P8",
"warnings": [],
"useGPS": false
}
}
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.