List Worker's Assigned Tasks

Returns a paginated collection of all tasks currently assigned to a Worker given the Worker Id. This does not include historical Tasks that were assigned to the Driver.

The returned tasks are always sorted by creation time. Each request will return up to 64 tasks but may return fewer and still include a lastId. lastId will be missing from the response once the last page of the results has been reached, so if the lastId is present, you should continue to paginate through the results.

Query Parameters

NameTypeDescription
isPickupTaskbooleanOptional. True or False. Determines if the results should list Pick-up tasks or Drop-off tasks
tonumberOptional. If missing, defaults to the current time. The ending time of the range. Tasks created before this time will be included.
fromnumberThe starting time of the time range in unix. Tasks created at or after this time will be included. Default is 7 days before the current time.
lastIdstringOptional. Used to walk the paginated response, if there is one. Tasks created after this ID will be returned.

🚧

502 Internal Timed out

Onfleet has an internal system timeout of 70 seconds, which can be encountered when listing tasks. If the 502 error comes up, try narrowing your search parameters so that query can be executed more quickly.

curl -X GET "https://onfleet.com/api/v2/workers/ZKb4r4B*8zWLd4Yam*I77kau/tasks" \
       -u "cd3b3de84cc1ee040bf06512d233719c:"
onfleet.workers.getTasks(id="sFtvhYK2l26zS0imptJJdC2q",queryParams={"from":1455072025000, "lastId": "tPMO~h03sOIqFbnhqaOXgUsd"})
onfleet.workers.getTasks("sFtvhYK2l26zS0imptJJdC2q")
{
    "tasks": [
        {
            "id": "3VtEMGudjwjjM60j7deSIY3j",
            "timeCreated": 1643317843000,
            "timeLastModified": 1643319602671,
            "organization": "nYrkNP6jZMSKgBwG9qG7ci3J",
            "shortId": "c77ff497",
            "trackingURL": "https://onf.lt/c77ff497",
            "worker": "ZxcnkJi~79nonYaMTQ960Mg2",
            "merchant": "nYrkNP6jZMSKgBwG9qG7ci3J",
            "executor": "nYrkNP6jZMSKgBwG9qG7ci3J",
            "creator": "vjw*RDMKDljKVDve1Vtcplgu",
            "dependencies": [],
            "state": 1,
            "completeAfter": null,
            "completeBefore": null,
            "pickupTask": false,
            "notes": "",
            "completionDetails": {
                "failureNotes": "",
                "failureReason": "NONE",
                "events": [],
                "actions": [],
                "time": 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,
            "container": {
                "type": "WORKER",
                "worker": "ZxcnkJi~79nonYaMTQ960Mg2"
            },
            "trackingViewed": false,
            "recipients": [],
            "eta": null,
            "delayTime": null,
            "estimatedCompletionTime": null,
            "estimatedArrivalTime": null,
            "destination": {
                "id": "nk5xGuf1eQguYXg1*mIVl0Ut",
                "timeCreated": 1643317843000,
                "timeLastModified": 1643317843121,
                "location": [
                    -117.8764687,
                    33.8078476
                ],
                "address": {
                    "apartment": "",
                    "state": "California",
                    "postalCode": "92806",
                    "number": "2695",
                    "street": "East Katella Avenue",
                    "city": "Anaheim",
                    "country": "United States",
                    "name": "Honda Center"
                },
                "notes": "",
                "metadata": [],
                "googlePlaceId": "ChIJXyczhHXX3IARFVUqyhMqiqg",
                "warnings": []
            }
        }
    ]
}