Get single task by shortId

Get single task by shortId

Retrieve a task's details by its shortId. In general, usage is the same as the get single task endpoint.

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.

Adding ?assignmentHistory=true will include an assignmentHistory object detailing the various containers that the task was included in.

curl -X GET "https://onfleet.com/api/v2/tasks/shortId/e5f0cc28" \
       -u "<your_api_key>:"
onfleet.tasks.get(shortId="e5f0cc28")
onfleet.tasks.get("e5f0cc28", "shortId");
$onfleet->tasks->get("e5f0cc28", "shortId");
curl -X GET "https://onfleet.com/api/v2/tasks/shortId/e5f0cc28?assignmentHistory=true" \
       -u "<your_api_key>:"
{
  "id": "Eyi36gfoJMdAMyK3QiC3iFLq",
  "timeCreated": 1455152029000,
  "timeLastModified": 1455153428203,
  "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
  "shortId": "e5f0cc28",
  "trackingURL": "https://onf.lt/e5f0cc28",
  "worker": null,
  "merchant": "yAM*fDkztrT3gUcz9mNDgNOL",
  "executor": "cBrUjKvQQgdRp~s1qvQNLpK*",
  "creator": "EJmsbJgHiRLPjNVE7GEIPs7*",
  "dependencies": [],
  "state": 0,
  "completeAfter": 1455151071727,
  "completeBefore": null,
  "pickupTask": true,
  "notes": "Order 332: 24oz Stumptown Finca El Puente, 10 x Aji de Gallina Empanadas, 13-inch Lelenitas Tres Leches",
  "completionDetails": {
    "events": [],
    "time": null
  },
  "feedback": [],
  "metadata": [],
  "overrides": {
    "recipientSkipSMSNotifications": null,
    "recipientNotes": null,
    "recipientName": null
  },
  "container": {
    "type": "ORGANIZATION",
    "organization": "cBrUjKvQQgdRp~s1qvQNLpK*"
  },
  "recipients": [],
  "destination": {
    "id": "d~jvinosyxbjVo5yt3wY8lJl",
    "timeCreated": 1455152029000,
    "timeLastModified": 1455153428197,
    "location": [
      -122.4438337,
      37.7940329
    ],
    "address": {
      "apartment": "",
      "state": "California",
      "postalCode": "94123",
      "country": "United States",
      "city": "San Francisco",
      "street": "Vallejo Street",
      "number": "2829"
    },
    "notes": "Small green door by garage door has pin pad, enter *4821*",
    "metadata": []
  }
}
{
  "code": "InvalidCredentials",
  "message": {
    "error": 1103,
    "message": "The resource requested is outside of the authenticated user's permissions scope.",
    "request": "d823bad3-2296-4d8f-91f4-518b96f54139"
  }
}
{
    "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
    }
}
{
  "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": "",
  "assignmentHistory": [
    {
        "actionContext": {
            "type": "WORKER",
            "id": "COwfwH~Zogm1LXIZYbPlLAyw"
        },
        "containerDescription": {
            "type": "WORKER",
            "organization": "nYrkNP6jZMSKgBwG9qG7ci3J",
            "worker": "COwfwH~Zogm1LXIZYbPlLAyw"
        },
        "time": 1606933294810
    }
  ],
  "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": []
    }
  ]
}

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

📘

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.

📘

Geofence

Geofence is a Scale and Enterprise level feature, please contact support or your CSM for more information on how to obtain this feature.

This will show if the Driver is trying to complete outside of the geofence area set by the organization setting. Two new fields will be attached to any tasks with geofence enabled:

  • geofenceAttempts - Type 1 is an warning, and Type 2 is a block
  • completedWithGeofenceWarning - True if warned, False if not
        "geofenceAttempts": [
            {
                "type": 1,
                "location": [
                    -122.288615,
                    37.8986409
                ],
                "timestamp": 1786564299913
            },
            {
                "type": 2,
                "location": [
                    -122.288615,
                    37.8986409
                ],
                "timestamp": 1786564303545
            }
        ],
        "completedWithGeofenceWarning": true,
        "location": [
            -122.288615,
            37.8986409