{"_id":"59516ae6fafb63003375d560","category":{"_id":"59516ae6fafb63003375d550","version":"59516ae6fafb63003375d54e","project":"5425e663ffd4411c319a65b4","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-09-29T20:18:57.785Z","from_sync":false,"order":1,"slug":"reference","title":"Reference"},"user":"5425e31affd4411c319a65b1","project":"5425e663ffd4411c319a65b4","version":{"_id":"59516ae6fafb63003375d54e","project":"5425e663ffd4411c319a65b4","__v":1,"createdAt":"2017-06-26T20:13:26.122Z","releaseDate":"2017-06-26T20:13:26.122Z","categories":["59516ae6fafb63003375d54f","59516ae6fafb63003375d550"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.4.0","version":"2.4"},"__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2014-09-30T22:09:01.589Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"never","params":[],"url":""},"isReference":false,"order":15,"body":"Tasks represent units of work, defined by one destination and one recipient, that administrators create and assign to workers for completion.\n\nTask assignment, state and dependencies are important concepts that you should understand well prior to using the task endpoints.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Manual Assignment\"\n}\n[/block]\nOnce tasks are created, you must assign them to an entity for further management or completion.\n\nYou may either set a task's `container` for basic assignment functionality (append-only, described below), or interact with the target entity's `container` directly for [advanced assignment functionality](doc:containers). If you omit the `container` property, the task will be automatically assigned to the creator organization and appear as unassigned in the dashboard. To assign a task to an executing connected organization, use `executor` instead.\n\nThe task `container` property has the following object structure:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"type\",\n    \"0-1\": \"string\",\n    \"0-2\": \"The type of the container to which the task is to be assigned. The possible values are ```TEAM``` or ```WORKER```.\",\n    \"1-0\": \"team\",\n    \"2-0\": \"worker\",\n    \"1-1\": \"string\",\n    \"2-1\": \"string\",\n    \"1-2\": \"If ```type``` is ```TEAM```, the ID of the target team.\",\n    \"2-2\": \"If ```type``` is ```WORKER```, the ID of the target worker.\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\nYou may provide a `container` property when creating or updating a task to append the task to that container. \n\nSince tasks are always in **exactly one** container until deleted or started, if `container` is missing, tasks are assigned to their creator organization. In the dashboard, tasks assigned to one's organization are shown as *Unassigned*.\n\nTo perform advanced assignment operations, such as assigning more than a single task simultaneously or inserting tasks at a certain index, check out our [Containers](doc:containers) section.\n\nFor completed tasks, the ```worker``` property denotes the worker who completed the task.\n\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Deprecation notice\",\n  \"body\": \"For non-completed tasks, the property ```worker``` references the worker that the task is assigned to. Tasks which are assigned to a container other than a `WORKER` container (for example,`TEAM` or `ORGANIZATION`) have a `worker` property of ```null```. \\n\\nThis properly will be completely removed from non-completed tasks in favor of `container` in future versions of the API.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Automatic Assignment\"\n}\n[/block]\nYou also have the option to automatically assign tasks to one of your currently active workers, that is, workers who are *idle* or *in transit* in the dashboard. Note that this is a basic assignment where the newly-created task is appended to the end of the optimal worker's container. \n\nThe `autoAssign` object property available at task creation has the following structure:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"mode\",\n    \"0-1\": \"string\",\n    \"0-2\": \"The desired automatic assignment mode. Either ```distance``` or ```load```.\",\n    \"1-0\": \"team\",\n    \"1-1\": \"string\",\n    \"1-2\": \"Optional. The ID of a team from which to pick the workers to consider for automatic assignment.\",\n    \"3-0\": \"considerDependencies\",\n    \"3-1\": \"boolean\",\n    \"3-2\": \"Optional. Whether to include the target task's dependency family (parent and child tasks) in the resulting assignment operation.\",\n    \"2-0\": \"maxAssignedTaskCount\",\n    \"2-1\": \"number\",\n    \"2-2\": \"Optional. The maximum number of tasks a worker can have assigned after the automatic assignment is made.\"\n  },\n  \"cols\": 3,\n  \"rows\": 4\n}\n[/block]\nIn both modes, we calculate the geodesic distance using [Vincenty's](https://en.wikipedia.org/wiki/Vincenty%27s_formulae) formula for ellipsoids between destination coordinates, with one meter precision.\n\nThe ```distance``` mode finds the active worker whose last-known location is closest to the task's destination.\n\nThe ```load``` mode walks the distance from the active worker's last-known location to their active task, if there is one, and through to each of the ordered destinations corresponding to the worker's assigned tasks, with the final computation being from their last-assigned task to the newly-created one. The worker who has to travel the shortest distance is considered to have the lightest load, and as such will be assigned the task being created.\n\nIf an automatic assignment is requested and successful, ```didAutoAssign``` will be set to ```true``` and the task's `container` details will indicate which worker the task was appended to. If we fail to find a suitable worker because of an error or any other unexpected condition, ```didAutoAssign``` will be ```false```.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"State\"\n}\n[/block]\nIn addition to the parameters detailed for each endpoint in this section, tasks also have a special property ```state``` to help you understand the task's most recent status. The following integer values are valid task states:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Value\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"0\",\n    \"0-1\": \"Unassigned: task has not yet been assigned to a worker.\",\n    \"1-0\": \"1\",\n    \"1-1\": \"Assigned: task has been assigned to a worker.\",\n    \"2-0\": \"2\",\n    \"2-1\": \"Active: task has been started by its assigned worker.\",\n    \"3-0\": \"3\",\n    \"3-1\": \"Completed: task has been completed by its assigned worker.\"\n  },\n  \"cols\": 2,\n  \"rows\": 4\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Dependencies\"\n}\n[/block]\nWhen creating a new task, you may provide the IDs of existing tasks on which the newly-created task will depend by including them in the ```dependencies``` array. \n\nYou will need to enable dependency management in the dashboard settings to use this functionality: for more details, read [this support center document](http://support.onfleet.com/hc/en-us/articles/204758789-Link-tasks). \n\nMaintaining dependencies for existing tasks can be done in the same fashion as any other task property via the _Update task_ endpoint.\n[block:api-header]\n{\n  \"type\": \"post\",\n  \"title\": \"Create task\"\n}\n[/block]\nNote that you may provide the IDs of an existing `recipient` or `destination` if these are available, or simply include their details as objects to have these created automatically in a single request.\n\nBody parameters\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"merchant\",\n    \"0-1\": \"string\",\n    \"0-2\": \"Optional. The ID of the organization that will be displayed to the recipient of the task. Defaults to the creating organization. If you perform deliveries on behalf of a connected organization and want to display their name, logo, and branded notifications, provide their organization ID.\",\n    \"1-0\": \"executor\",\n    \"1-1\": \"string\",\n    \"1-2\": \"Optional. The ID of the organization that will be responsible for fulfilling the task. Defaults to the creating organization. If you delegate your deliveries to a third party, provide their organization ID.\",\n    \"2-0\": \"destination\",\n    \"2-1\": \"string or object\",\n    \"2-2\": \"The ID of the task's destination or a valid [Destination](doc:destinations) object.\",\n    \"3-0\": \"recipients\",\n    \"3-1\": \"string array\\nor object array\",\n    \"3-2\": \"An array containing zero or one IDs of the task's recipients or a valid array of zero or one [Recipient](doc:recipients) objects.\",\n    \"4-0\": \"completeAfter\",\n    \"4-1\": \"number\",\n    \"4-2\": \"Optional. A timestamp for the earliest time the task should be completed.\",\n    \"5-0\": \"completeBefore\",\n    \"5-1\": \"number\",\n    \"5-2\": \"Optional. A timestamp for the latest time the task should be completed.\",\n    \"6-0\": \"pickupTask\",\n    \"6-1\": \"boolean\",\n    \"6-2\": \"Optional. Whether the task is a pickup task.\",\n    \"8-0\": \"notes\",\n    \"8-1\": \"string\",\n    \"8-2\": \"Optional. Notes for the task.\",\n    \"9-0\": \"autoAssign\",\n    \"9-1\": \"object\",\n    \"9-2\": \"Optional. The automatic assignment options for the newly created task. You may not provide a `container` if using automatic assignment.\",\n    \"7-0\": \"dependencies\",\n    \"7-1\": \"string array\",\n    \"7-2\": \"Optional. One or more IDs of tasks which must be completed prior to this task.\",\n    \"10-0\": \"container\",\n    \"10-1\": \"object\",\n    \"10-2\": \"Optional. The container to which to append this task. Defaults to the creator organization container.\",\n    \"11-0\": \"quantity\",\n    \"11-1\": \"number\",\n    \"11-2\": \"Optional. The number of units to be dropped off while completing this task, for route optimization purposes.\",\n    \"12-0\": \"serviceTime\",\n    \"12-1\": \"number\",\n    \"12-2\": \"Optional. The number of minutes to be spent by the worker on arrival at this task's destination, for route optimization purposes.\"\n  },\n  \"cols\": 3,\n  \"rows\": 13\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ curl -X POST \\\"https://onfleet.com/api/v2/tasks\\\" \\\\\\n       -u \\\"cd3b3de84cc1ee040bf06512d233719c:\\\" \\\\\\n       -d '{\\\"destination\\\":{\\\"address\\\":{\\\"unparsed\\\":\\\"2829 Vallejo St, SF, CA, USA\\\"},\\\"notes\\\":\\\"Small green door by garage door has pin pad, enter *4821*\\\"},\\\"recipients\\\":[{\\\"name\\\":\\\"Blas Silkovich\\\",\\\"phone\\\":\\\"650-555-4481\\\",\\\"notes\\\":\\\"Knows Neiman, VIP status.\\\"}],\\\"completeAfter\\\":1455151071727,\\\"notes\\\":\\\"Order 332: 24oz Stumptown Finca El Puente, 10 x Aji de Gallina Empanadas, 13-inch Lelenitas Tres Leches\\\",\\\"autoAssign\\\":{\\\"mode\\\":\\\"distance\\\"}}'\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"id\\\": \\\"kc8SS1tzuZ~jqjlebKGrUmpe\\\",\\n  \\\"timeCreated\\\": 1455156667000,\\n  \\\"timeLastModified\\\": 1455156667234,\\n  \\\"organization\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\",\\n  \\\"shortId\\\": \\\"8f983639\\\",\\n  \\\"trackingURL\\\": \\\"https://onf.lt/8f98363993\\\",\\n  \\\"worker\\\": \\\"1LjhGUWdxFbvdsTAAXs0TFos\\\",\\n  \\\"merchant\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\",\\n  \\\"executor\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\",\\n  \\\"creator\\\": \\\"EJmsbJgHiRLPjNVE7GEIPs7*\\\",\\n  \\\"dependencies\\\": [],\\n  \\\"state\\\": 0,\\n  \\\"completeAfter\\\": 1455151071727,\\n  \\\"completeBefore\\\": null,\\n  \\\"pickupTask\\\": false,\\n  \\\"notes\\\": \\\"Order 332: 24oz Stumptown Finca El Puente, 10 x Aji de Gallina Empanadas, 13-inch Lelenitas Tres Leches\\\",\\n  \\\"completionDetails\\\": {\\n    \\\"events\\\": [],\\n    \\\"time\\\": null\\n  },\\n  \\\"feedback\\\": [],\\n  \\\"metadata\\\": [],\\n  \\\"overrides\\\": {\\n    \\\"recipientSkipSMSNotifications\\\": null,\\n    \\\"recipientNotes\\\": null,\\n    \\\"recipientName\\\": null\\n  },\\n  \\\"container\\\": {\\n    \\\"type\\\": \\\"WORKER\\\",\\n    \\\"worker\\\": \\\"1LjhGUWdxFbvdsTAAXs0TFos\\\"\\n  },\\n  \\\"recipients\\\": [\\n    {\\n      \\\"id\\\": \\\"G7rcM2nqblmh8vj2do1FpaOQ\\\",\\n      \\\"organization\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\",\\n      \\\"timeCreated\\\": 1455156667000,\\n      \\\"timeLastModified\\\": 1455156667229,\\n      \\\"name\\\": \\\"Blas Silkovich\\\",\\n      \\\"phone\\\": \\\"+16505554481\\\",\\n      \\\"notes\\\": \\\"Knows Neiman, VIP status.\\\",\\n      \\\"skipSMSNotifications\\\": false,\\n      \\\"metadata\\\": []\\n    }\\n  ],\\n  \\\"destination\\\": {\\n    \\\"id\\\": \\\"zrVXZi5aDzOZlAghZaLfGAfA\\\",\\n    \\\"timeCreated\\\": 1455156667000,\\n    \\\"timeLastModified\\\": 1455156667220,\\n    \\\"location\\\": [\\n      -122.4438337,\\n      37.7940329\\n    ],\\n    \\\"address\\\": {\\n      \\\"apartment\\\": \\\"\\\",\\n      \\\"state\\\": \\\"California\\\",\\n      \\\"postalCode\\\": \\\"94123\\\",\\n      \\\"country\\\": \\\"United States\\\",\\n      \\\"city\\\": \\\"San Francisco\\\",\\n      \\\"street\\\": \\\"Vallejo Street\\\",\\n      \\\"number\\\": \\\"2829\\\"\\n    },\\n    \\\"notes\\\": \\\"Small green door by garage door has pin pad, enter *4821*\\\",\\n    \\\"metadata\\\": []\\n  },\\n  \\\"didAutoAssign\\\": true\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"get\",\n  \"title\": \"List tasks\"\n}\n[/block]\nReturns a paginated collection of all tasks in your organization.\n\nThe `from` and `to` time range query parameters are considered differently depending on task state.\n  * Completed tasks: time comparison performed on task completion time\n  * All other task states: time comparison performed on task creation time\n\nThe returned tasks are always sorted by creation time. Each request will return up to 128 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.\n\nQuery parameters\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"from\",\n    \"1-0\": \"to\",\n    \"2-0\": \"lastId\",\n    \"0-1\": \"number\",\n    \"1-1\": \"number\",\n    \"2-1\": \"string\",\n    \"1-2\": \"Optional. If missing, defaults to the current time. The ending time of the range. Tasks created or completed before this time will be included.\",\n    \"2-2\": \"Optional. Used to walk the paginated response, if there is one. Tasks created after this ID will be returned.\",\n    \"0-2\": \"The starting time of the range. Tasks created or completed at or after this time will be included.\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ curl -X GET \\\"https://onfleet.com/api/v2/tasks/all?from=1455072025000\\\" \\\\\\n       -u \\\"cd3b3de84cc1ee040bf06512d233719c:\\\"\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"lastId\\\": \\\"tPMO~h03sOIqFbnhqaOXgUsd\\\",\\n  \\\"tasks\\\": [\\n    {\\n      \\\"id\\\": \\\"11z1BbsQUZFHD1XAd~emDDeK\\\",\\n      \\\"timeCreated\\\": 1455072025000,\\n      \\\"timeLastModified\\\": 1455072025278,\\n      \\\"organization\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\",\\n      \\\"shortId\\\": \\\"31aac0a5\\\",\\n      \\\"trackingURL\\\": \\\"https://onf.lt/31aac0a5c\\\",\\n      \\\"worker\\\": \\\"h*wSb*apKlDkUFnuLTtjPke7\\\",\\n      \\\"merchant\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\",\\n      \\\"executor\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\",\\n      \\\"creator\\\": \\\"EJmsbJgHiRLPjNVE7GEIPs7*\\\",\\n      \\\"dependencies\\\": [],\\n      \\\"state\\\": 1,\\n      \\\"completeAfter\\\": null,\\n      \\\"completeBefore\\\": null,\\n      \\\"pickupTask\\\": false,\\n      \\\"notes\\\": \\\"\\\",\\n      \\\"completionDetails\\\": {\\n        \\\"events\\\": [],\\n        \\\"time\\\": null\\n      },\\n      \\\"feedback\\\": [],\\n      \\\"metadata\\\": [],\\n      \\\"overrides\\\": {},\\n      \\\"container\\\": {\\n        \\\"type\\\": \\\"WORKER\\\",\\n        \\\"worker\\\": \\\"h*wSb*apKlDkUFnuLTtjPke7\\\"\\n      },\\n      \\\"recipients\\\": [\\n        {\\n          \\\"id\\\": \\\"xX87G1gSkeLvGXlHn2tn0~iB\\\",\\n          \\\"organization\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\",\\n          \\\"timeCreated\\\": 1455072004000,\\n          \\\"timeLastModified\\\": 1455072025272,\\n          \\\"name\\\": \\\"Blake Turing\\\",\\n          \\\"phone\\\": \\\"+16505552811\\\",\\n          \\\"notes\\\": \\\"\\\",\\n          \\\"skipSMSNotifications\\\": false,\\n          \\\"metadata\\\": []\\n        }\\n      ],\\n      \\\"destination\\\": {\\n        \\\"id\\\": \\\"pfT5L1JclTdhvRnP9GQzMFuL\\\",\\n        \\\"timeCreated\\\": 1455072025000,\\n        \\\"timeLastModified\\\": 1455072025264,\\n        \\\"location\\\": [\\n          -122.41289010000003,\\n          37.787933\\n        ],\\n        \\\"address\\\": {\\n          \\\"apartment\\\": \\\"\\\",\\n          \\\"state\\\": \\\"California\\\",\\n          \\\"postalCode\\\": \\\"94109\\\",\\n          \\\"country\\\": \\\"United States\\\",\\n          \\\"city\\\": \\\"San Francisco\\\",\\n          \\\"street\\\": \\\"Post Street\\\",\\n          \\\"number\\\": \\\"666\\\"\\n        },\\n        \\\"notes\\\": \\\"\\\",\\n        \\\"metadata\\\": []\\n      }\\n    },\\n    {\\n      \\\"id\\\": \\\"kc8SS1tzuZ~jqjlebKGrUmpe\\\",\\n      \\\"timeCreated\\\": 1455156667000,\\n      \\\"timeLastModified\\\": 1455156667234,\\n      \\\"organization\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\",\\n      \\\"shortId\\\": \\\"8f983639\\\",\\n      \\\"trackingURL\\\": \\\"https://onf.lt/8f98363993\\\",\\n      \\\"worker\\\": \\\"1LjhGUWdxFbvdsTAAXs0TFos\\\",\\n      \\\"merchant\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\",\\n      \\\"executor\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\",\\n      \\\"creator\\\": \\\"EJmsbJgHiRLPjNVE7GEIPs7*\\\",\\n      \\\"dependencies\\\": [],\\n      \\\"state\\\": 1,\\n      \\\"completeAfter\\\": 1455151071727,\\n      \\\"completeBefore\\\": null,\\n      \\\"pickupTask\\\": false,\\n      \\\"notes\\\": \\\"Order 332: 24oz Stumptown Finca El Puente, 10 x Aji de Gallina Empanadas, 13-inch Lelenitas Tres Leches\\\",\\n      \\\"completionDetails\\\": {\\n        \\\"events\\\": [],\\n        \\\"time\\\": null\\n      },\\n      \\\"feedback\\\": [],\\n      \\\"metadata\\\": [],\\n      \\\"overrides\\\": {\\n        \\\"recipientSkipSMSNotifications\\\": null,\\n        \\\"recipientNotes\\\": null,\\n        \\\"recipientName\\\": null\\n      },\\n      \\\"container\\\": {\\n        \\\"type\\\": \\\"WORKER\\\",\\n        \\\"worker\\\": \\\"1LjhGUWdxFbvdsTAAXs0TFos\\\"\\n      },\\n      \\\"recipients\\\": [\\n        {\\n          \\\"id\\\": \\\"G7rcM2nqblmh8vj2do1FpaOQ\\\",\\n          \\\"organization\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\",\\n          \\\"timeCreated\\\": 1455156667000,\\n          \\\"timeLastModified\\\": 1455156667229,\\n          \\\"name\\\": \\\"Blas Silkovich\\\",\\n          \\\"phone\\\": \\\"+16505554481\\\",\\n          \\\"notes\\\": \\\"Knows Neiman, VIP status.\\\",\\n          \\\"skipSMSNotifications\\\": false,\\n          \\\"metadata\\\": []\\n        }\\n      ],\\n      \\\"destination\\\": {\\n        \\\"id\\\": \\\"zrVXZi5aDzOZlAghZaLfGAfA\\\",\\n        \\\"timeCreated\\\": 1455156667000,\\n        \\\"timeLastModified\\\": 1455156667220,\\n        \\\"location\\\": [\\n          -122.4438337,\\n          37.7940329\\n        ],\\n        \\\"address\\\": {\\n          \\\"apartment\\\": \\\"\\\",\\n          \\\"state\\\": \\\"California\\\",\\n          \\\"postalCode\\\": \\\"94123\\\",\\n          \\\"country\\\": \\\"United States\\\",\\n          \\\"city\\\": \\\"San Francisco\\\",\\n          \\\"street\\\": \\\"Vallejo Street\\\",\\n          \\\"number\\\": \\\"2829\\\"\\n        },\\n        \\\"notes\\\": \\\"Small green door by garage door has pin pad, enter *4821*\\\",\\n        \\\"metadata\\\": []\\n      }\\n    },\\n    // ...\\n  ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"get\",\n  \"title\": \"Get single task\"\n}\n[/block]\nIf 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, as well as whether the task was successfully completed or if it was considered to have failed by the worker.\n\nTasks 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.\n\nIf a signature was collected from your customer, a ```signatureUploadId``` will also be returned. In order to refer to the hosted signature image file, you may use the following pattern: ```https://d15p8tr8p0vffz.cloudfront.net/:signatureUploadId/282x.png```. Similarly, a photo captured at task completion can be accessed at ```https://d15p8tr8p0vffz.cloudfront.net/:photoUploadId/800x.png```. \n\nAny recipient feedback (rating and comments) provided will appear in ```feedback```.\n\nIf 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.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ curl -X GET \\\"https://onfleet.com/api/v2/tasks/qNMz6CKwQ*26FOslywsiQxhY\\\" \\\\\\n       -u \\\"cd3b3de84cc1ee040bf06512d233719c:\\\"\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"id\\\": \\\"qNMz6CKwQ*26FOslywsiQxhY\\\",\\n  \\\"timeCreated\\\": 1455072004000,\\n  \\\"timeLastModified\\\": 1455152824153,\\n  \\\"organization\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\",\\n  \\\"shortId\\\": \\\"5f8b5c65\\\",\\n  \\\"trackingURL\\\": \\\"https://onf.lt/5f8b5c65f9\\\",\\n  \\\"worker\\\": \\\"h*wSb*apKlDkUFnuLTtjPke7\\\",\\n  \\\"merchant\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\",\\n  \\\"executor\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\",\\n  \\\"creator\\\": \\\"EJmsbJgHiRLPjNVE7GEIPs7*\\\",\\n  \\\"dependencies\\\": [],\\n  \\\"state\\\": 3,\\n  \\\"completeAfter\\\": null,\\n  \\\"completeBefore\\\": null,\\n  \\\"pickupTask\\\": false,\\n  \\\"notes\\\": \\\"\\\",\\n  \\\"completionDetails\\\": {\\n    \\\"events\\\": [\\n      {\\n        \\\"name\\\": \\\"start\\\",\\n        \\\"time\\\": 1455072035445\\n      }\\n    ],\\n    \\\"time\\\": 1455152532732,\\n    \\\"photoUploadId\\\": \\\"1cf9c8d5d00a763865729825\\\",\\n    \\\"notes\\\": \\\"All went great, customer loves us.\\\",\\n    \\\"success\\\": true,\\n    \\\"signatureUploadId\\\": \\\"a49846b937eeab3cea248301\\\"\\n  },\\n  \\\"feedback\\\": [\\n      {\\n        \\\"recipient\\\": \\\"xX87G1gSkeLvGXlHn2tn0~iB\\\",\\n        \\\"rating\\\": 5,\\n        \\\"comments\\\": \\\"Super fast delivery, can't wait for my next order :)\\\"\\n      }\\n   ],\\n  \\\"metadata\\\": [],\\n  \\\"overrides\\\": {},\\n  \\\"recipients\\\": [\\n    {\\n      \\\"id\\\": \\\"xX87G1gSkeLvGXlHn2tn0~iB\\\",\\n      \\\"organization\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\",\\n      \\\"timeCreated\\\": 1455072004000,\\n      \\\"timeLastModified\\\": 1455072025272,\\n      \\\"name\\\": \\\"Peter T\\\",\\n      \\\"phone\\\": \\\"+16505557100\\\",\\n      \\\"notes\\\": \\\"\\\",\\n      \\\"skipSMSNotifications\\\": false,\\n      \\\"metadata\\\": []\\n    }\\n  ],\\n  \\\"destination\\\": {\\n    \\\"id\\\": \\\"Nml*Tdh1EMIk1RE46maqOLEQ\\\",\\n    \\\"timeCreated\\\": 1455072004000,\\n    \\\"timeLastModified\\\": 1455072004352,\\n    \\\"location\\\": [\\n      -122.40522369999996,\\n      37.7718827\\n    ],\\n    \\\"address\\\": {\\n      \\\"apartment\\\": \\\"\\\",\\n      \\\"state\\\": \\\"California\\\",\\n      \\\"postalCode\\\": \\\"94103\\\",\\n      \\\"country\\\": \\\"United States\\\",\\n      \\\"city\\\": \\\"San Francisco\\\",\\n      \\\"street\\\": \\\"Brannan Street\\\",\\n      \\\"number\\\": \\\"888\\\"\\n    },\\n    \\\"notes\\\": \\\"\\\",\\n    \\\"metadata\\\": []\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"get\",\n  \"title\": \"Get single task by shortId\"\n}\n[/block]\nRetrieve a task's details by its ```shortId```.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ curl -X GET \\\"https://onfleet.com/api/v2/tasks/shortId/e5f0cc28\\\" \\\\\\n       -u \\\"cd3b3de84cc1ee040bf06512d233719c:\\\"\",\n      \"language\": \"shell\",\n      \"name\": \"Shell\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"id\\\": \\\"Eyi36gfoJMdAMyK3QiC3iFLq\\\",\\n  \\\"timeCreated\\\": 1455152029000,\\n  \\\"timeLastModified\\\": 1455153428203,\\n  \\\"organization\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\",\\n  \\\"shortId\\\": \\\"e5f0cc28\\\",\\n  \\\"trackingURL\\\": \\\"https://onf.lt/e5f0cc28\\\",\\n  \\\"worker\\\": null,\\n  \\\"merchant\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\",\\n  \\\"executor\\\": \\\"cBrUjKvQQgdRp~s1qvQNLpK*\\\",\\n  \\\"creator\\\": \\\"EJmsbJgHiRLPjNVE7GEIPs7*\\\",\\n  \\\"dependencies\\\": [],\\n  \\\"state\\\": 0,\\n  \\\"completeAfter\\\": 1455151071727,\\n  \\\"completeBefore\\\": null,\\n  \\\"pickupTask\\\": true,\\n  \\\"notes\\\": \\\"Order 332: 24oz Stumptown Finca El Puente, 10 x Aji de Gallina Empanadas, 13-inch Lelenitas Tres Leches\\\",\\n  \\\"completionDetails\\\": {\\n    \\\"events\\\": [],\\n    \\\"time\\\": null\\n  },\\n  \\\"feedback\\\": [],\\n  \\\"metadata\\\": [],\\n  \\\"overrides\\\": {\\n    \\\"recipientSkipSMSNotifications\\\": null,\\n    \\\"recipientNotes\\\": null,\\n    \\\"recipientName\\\": null\\n  },\\n  \\\"container\\\": {\\n    \\\"type\\\": \\\"ORGANIZATION\\\",\\n    \\\"organization\\\": \\\"cBrUjKvQQgdRp~s1qvQNLpK*\\\"\\n  },\\n  \\\"recipients\\\": [],\\n  \\\"destination\\\": {\\n    \\\"id\\\": \\\"d~jvinosyxbjVo5yt3wY8lJl\\\",\\n    \\\"timeCreated\\\": 1455152029000,\\n    \\\"timeLastModified\\\": 1455153428197,\\n    \\\"location\\\": [\\n      -122.4438337,\\n      37.7940329\\n    ],\\n    \\\"address\\\": {\\n      \\\"apartment\\\": \\\"\\\",\\n      \\\"state\\\": \\\"California\\\",\\n      \\\"postalCode\\\": \\\"94123\\\",\\n      \\\"country\\\": \\\"United States\\\",\\n      \\\"city\\\": \\\"San Francisco\\\",\\n      \\\"street\\\": \\\"Vallejo Street\\\",\\n      \\\"number\\\": \\\"2829\\\"\\n    },\\n    \\\"notes\\\": \\\"Small green door by garage door has pin pad, enter *4821*\\\",\\n    \\\"metadata\\\": []\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"JSON\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"put\",\n  \"title\": \"Update task\"\n}\n[/block]\nNote that, for active tasks, only `notes` can be updated, while completed tasks cannot be updated in any way. Further, embedded updates are not currently supported, meaning that if you wish to update an existing task's recipient or destination, you need to handle that before updating the task with the changed entity's ID, if needed.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ curl -X PUT \\\"https://onfleet.com/api/v2/tasks/kc8SS1tzuZ~jqjlebKGrUmpe\\\" \\\\\\n       -u \\\"cd3b3de84cc1ee040bf06512d233719c:\\\" \\\\\\n       -d '{\\\"notes\\\":\\\"Patxi\\\\'s deep dish meat lover special, 2 bottles of Basque cider\\\",\\\"container\\\":{\\\"type\\\":\\\"TEAM\\\",\\\"team\\\":\\\"fwflFNVvrK~4t0m5hKFIxBUl\\\"}}'\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"id\\\": \\\"kc8SS1tzuZ~jqjlebKGrUmpe\\\",\\n  \\\"timeCreated\\\": 1455156667000,\\n  \\\"timeLastModified\\\": 1455156668922,\\n  \\\"organization\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\",\\n  \\\"shortId\\\": \\\"8f983639\\\",\\n  \\\"trackingURL\\\": \\\"https://onf.lt/8f98363993\\\",\\n  \\\"worker\\\": null,\\n  \\\"merchant\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\",\\n  \\\"executor\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\",\\n  \\\"creator\\\": \\\"EJmsbJgHiRLPjNVE7GEIPs7*\\\",\\n  \\\"dependencies\\\": [],\\n  \\\"state\\\": 0,\\n  \\\"completeAfter\\\": 1455151071727,\\n  \\\"completeBefore\\\": null,\\n  \\\"pickupTask\\\": false,\\n  \\\"notes\\\": \\\"Patxi's deep dish meat lover special, 2 bottles of Basque cider\\\",\\n  \\\"completionDetails\\\": {\\n    \\\"events\\\": [],\\n    \\\"time\\\": null\\n  },\\n  \\\"feedback\\\": [],\\n  \\\"metadata\\\": [],\\n  \\\"overrides\\\": {\\n    \\\"recipientSkipSMSNotifications\\\": null,\\n    \\\"recipientNotes\\\": null,\\n    \\\"recipientName\\\": null\\n  },\\n  \\\"container\\\": {\\n    \\\"type\\\": \\\"TEAM\\\",\\n    \\\"team\\\": \\\"fwflFNVvrK~4t0m5hKFIxBUl\\\"\\n  },\\n  \\\"recipients\\\": [\\n    {\\n      \\\"id\\\": \\\"G7rcM2nqblmh8vj2do1FpaOQ\\\",\\n      \\\"organization\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\",\\n      \\\"timeCreated\\\": 1455156667000,\\n      \\\"timeLastModified\\\": 1455156667229,\\n      \\\"name\\\": \\\"Blas Silkovich\\\",\\n      \\\"phone\\\": \\\"+16505554481\\\",\\n      \\\"notes\\\": \\\"Knows Neiman, VIP status.\\\",\\n      \\\"skipSMSNotifications\\\": false,\\n      \\\"metadata\\\": []\\n    }\\n  ],\\n  \\\"destination\\\": {\\n    \\\"id\\\": \\\"zrVXZi5aDzOZlAghZaLfGAfA\\\",\\n    \\\"timeCreated\\\": 1455156667000,\\n    \\\"timeLastModified\\\": 1455156667220,\\n    \\\"location\\\": [\\n      -122.4438337,\\n      37.7940329\\n    ],\\n    \\\"address\\\": {\\n      \\\"apartment\\\": \\\"\\\",\\n      \\\"state\\\": \\\"California\\\",\\n      \\\"postalCode\\\": \\\"94123\\\",\\n      \\\"country\\\": \\\"United States\\\",\\n      \\\"city\\\": \\\"San Francisco\\\",\\n      \\\"street\\\": \\\"Vallejo Street\\\",\\n      \\\"number\\\": \\\"2829\\\"\\n    },\\n    \\\"notes\\\": \\\"Small green door by garage door has pin pad, enter *4821*\\\",\\n    \\\"metadata\\\": []\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"post\",\n  \"title\": \"Complete task\"\n}\n[/block]\nActive tasks can be force completed. A ```completionDetails``` property must be provided in the body of your request, with the following structure.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"success\",\n    \"0-1\": \"boolean\",\n    \"0-2\": \"Whether the task's completion was successful.\",\n    \"1-0\": \"notes\",\n    \"1-1\": \"string\",\n    \"1-2\": \"Optional. Any completion notes for the task.\"\n  },\n  \"cols\": 3,\n  \"rows\": 2\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ curl -X POST \\\"https://onfleet.com/api/v2/tasks/uO2vKr07h6zg7Fzf~2NC3KLg/complete\\\" \\\\\\n     -u \\\"c64f80ba83d7cfce8ae74f51e263ce93:\\\" \\\\\\n     -d '{\\\"completionDetails\\\":{\\\"success\\\":true}}'\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"HTTP/1.1 200 OK\",\n      \"language\": \"http\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"post\",\n  \"title\": \"Clone task\"\n}\n[/block]\nThe property `sourceTaskId` can be used to keep track of the source task from which the task was cloned.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ curl -X POST \\\"https://onfleet.com/api/v2/tasks/uO2vKr07h6zg7Fzf~2NC3KLg/clone\\\" \\\\\\n     -u \\\"c64f80ba83d7cfce8ae74f51e263ce93:\\\"\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"id\\\": \\\"fesYPEu2FWvubaq~2nof*lCA\\\",\\n  \\\"timeCreated\\\": 1489010058000,\\n  \\\"timeLastModified\\\": 1489010058477,\\n  \\\"organization\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\",\\n  \\\"shortId\\\": \\\"9b4zd53d\\\",\\n  \\\"trackingURL\\\": \\\"https://onf.lt/9b4zd53d\\\",\\n  \\\"worker\\\": null,\\n  \\\"merchant\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\",\\n  \\\"executor\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\",\\n  \\\"creator\\\": \\\"EJmsbJgHiRLPjNVE7GEIPs7*\\\",\\n  \\\"dependencies\\\": [],\\n  \\\"state\\\": 0,\\n  \\\"completeAfter\\\": null,\\n  \\\"completeBefore\\\": null,\\n  \\\"pickupTask\\\": false,\\n  \\\"notes\\\": \\\"\\\",\\n  \\\"completionDetails\\\": {\\n    \\\"events\\\": [],\\n    \\\"failureReason\\\": \\\"NONE\\\",\\n    \\\"time\\\": null\\n  },\\n  \\\"feedback\\\": [],\\n  \\\"metadata\\\": [],\\n  \\\"overrides\\\": {},\\n  \\\"quantity\\\": 0,\\n  \\\"serviceTime\\\": 0,\\n  \\\"delayTime\\\": null,\\n  \\\"sourceTaskId\\\": \\\"uO2vKr07h6zg7Fzf~2NC3KLg\\\",\\n  \\\"container\\\": {\\n    \\\"type\\\": \\\"ORGANIZATION\\\",\\n    \\\"organization\\\": \\\"yAM*fDkztrT3gUcz9mNDgNOL\\\"\\n  },\\n  \\\"recipients\\\": [],\\n  \\\"destination\\\": {\\n    \\\"id\\\": \\\"Fa0Oxd21cL3T36qw5mGOvZw6\\\",\\n    \\\"timeCreated\\\": 1485469374000,\\n    \\\"timeLastModified\\\": 1485469374734,\\n    \\\"location\\\": [\\n      -122.43232727050781,\\n      37.79811961477822\\n    ],\\n    \\\"address\\\": {\\n      \\\"apartment\\\": \\\"\\\",\\n      \\\"state\\\": \\\"California\\\",\\n      \\\"postalCode\\\": \\\"94123\\\",\\n      \\\"country\\\": \\\"United States\\\",\\n      \\\"city\\\": \\\"San Francisco\\\",\\n      \\\"street\\\": \\\"Buchanan Street\\\",\\n      \\\"number\\\": \\\"3020\\\"\\n    },\\n    \\\"notes\\\": \\\"\\\",\\n    \\\"metadata\\\": []\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"delete\",\n  \"title\": \"Delete task\"\n}\n[/block]\nActive or completed tasks cannot be deleted.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ curl -i -X DELETE \\\"https://onfleet.com/api/v2/tasks/d2N*68bTBAM6Rd6txuWdH9Xj\\\" \\\\\\n     -u \\\"c64f80ba83d7cfce8ae74f51e263ce93:\\\"\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"HTTP/1.1 200 OK\",\n      \"language\": \"http\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"tasks","type":"basic","title":"Tasks"}
Tasks represent units of work, defined by one destination and one recipient, that administrators create and assign to workers for completion. Task assignment, state and dependencies are important concepts that you should understand well prior to using the task endpoints. [block:api-header] { "type": "basic", "title": "Manual Assignment" } [/block] Once tasks are created, you must assign them to an entity for further management or completion. You may either set a task's `container` for basic assignment functionality (append-only, described below), or interact with the target entity's `container` directly for [advanced assignment functionality](doc:containers). If you omit the `container` property, the task will be automatically assigned to the creator organization and appear as unassigned in the dashboard. To assign a task to an executing connected organization, use `executor` instead. The task `container` property has the following object structure: [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Description", "0-0": "type", "0-1": "string", "0-2": "The type of the container to which the task is to be assigned. The possible values are ```TEAM``` or ```WORKER```.", "1-0": "team", "2-0": "worker", "1-1": "string", "2-1": "string", "1-2": "If ```type``` is ```TEAM```, the ID of the target team.", "2-2": "If ```type``` is ```WORKER```, the ID of the target worker." }, "cols": 3, "rows": 3 } [/block] You may provide a `container` property when creating or updating a task to append the task to that container. Since tasks are always in **exactly one** container until deleted or started, if `container` is missing, tasks are assigned to their creator organization. In the dashboard, tasks assigned to one's organization are shown as *Unassigned*. To perform advanced assignment operations, such as assigning more than a single task simultaneously or inserting tasks at a certain index, check out our [Containers](doc:containers) section. For completed tasks, the ```worker``` property denotes the worker who completed the task. [block:callout] { "type": "info", "title": "Deprecation notice", "body": "For non-completed tasks, the property ```worker``` references the worker that the task is assigned to. Tasks which are assigned to a container other than a `WORKER` container (for example,`TEAM` or `ORGANIZATION`) have a `worker` property of ```null```. \n\nThis properly will be completely removed from non-completed tasks in favor of `container` in future versions of the API." } [/block] [block:api-header] { "type": "basic", "title": "Automatic Assignment" } [/block] You also have the option to automatically assign tasks to one of your currently active workers, that is, workers who are *idle* or *in transit* in the dashboard. Note that this is a basic assignment where the newly-created task is appended to the end of the optimal worker's container. The `autoAssign` object property available at task creation has the following structure: [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Description", "0-0": "mode", "0-1": "string", "0-2": "The desired automatic assignment mode. Either ```distance``` or ```load```.", "1-0": "team", "1-1": "string", "1-2": "Optional. The ID of a team from which to pick the workers to consider for automatic assignment.", "3-0": "considerDependencies", "3-1": "boolean", "3-2": "Optional. Whether to include the target task's dependency family (parent and child tasks) in the resulting assignment operation.", "2-0": "maxAssignedTaskCount", "2-1": "number", "2-2": "Optional. The maximum number of tasks a worker can have assigned after the automatic assignment is made." }, "cols": 3, "rows": 4 } [/block] In both modes, we calculate the geodesic distance using [Vincenty's](https://en.wikipedia.org/wiki/Vincenty%27s_formulae) formula for ellipsoids between destination coordinates, with one meter precision. The ```distance``` mode finds the active worker whose last-known location is closest to the task's destination. The ```load``` mode walks the distance from the active worker's last-known location to their active task, if there is one, and through to each of the ordered destinations corresponding to the worker's assigned tasks, with the final computation being from their last-assigned task to the newly-created one. The worker who has to travel the shortest distance is considered to have the lightest load, and as such will be assigned the task being created. If an automatic assignment is requested and successful, ```didAutoAssign``` will be set to ```true``` and the task's `container` details will indicate which worker the task was appended to. If we fail to find a suitable worker because of an error or any other unexpected condition, ```didAutoAssign``` will be ```false```. [block:api-header] { "type": "basic", "title": "State" } [/block] In addition to the parameters detailed for each endpoint in this section, tasks also have a special property ```state``` to help you understand the task's most recent status. The following integer values are valid task states: [block:parameters] { "data": { "h-0": "Value", "h-1": "Description", "0-0": "0", "0-1": "Unassigned: task has not yet been assigned to a worker.", "1-0": "1", "1-1": "Assigned: task has been assigned to a worker.", "2-0": "2", "2-1": "Active: task has been started by its assigned worker.", "3-0": "3", "3-1": "Completed: task has been completed by its assigned worker." }, "cols": 2, "rows": 4 } [/block] [block:api-header] { "type": "basic", "title": "Dependencies" } [/block] When creating a new task, you may provide the IDs of existing tasks on which the newly-created task will depend by including them in the ```dependencies``` array. You will need to enable dependency management in the dashboard settings to use this functionality: for more details, read [this support center document](http://support.onfleet.com/hc/en-us/articles/204758789-Link-tasks). Maintaining dependencies for existing tasks can be done in the same fashion as any other task property via the _Update task_ endpoint. [block:api-header] { "type": "post", "title": "Create task" } [/block] Note that you may provide the IDs of an existing `recipient` or `destination` if these are available, or simply include their details as objects to have these created automatically in a single request. Body parameters [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Description", "0-0": "merchant", "0-1": "string", "0-2": "Optional. The ID of the organization that will be displayed to the recipient of the task. Defaults to the creating organization. If you perform deliveries on behalf of a connected organization and want to display their name, logo, and branded notifications, provide their organization ID.", "1-0": "executor", "1-1": "string", "1-2": "Optional. The ID of the organization that will be responsible for fulfilling the task. Defaults to the creating organization. If you delegate your deliveries to a third party, provide their organization ID.", "2-0": "destination", "2-1": "string or object", "2-2": "The ID of the task's destination or a valid [Destination](doc:destinations) object.", "3-0": "recipients", "3-1": "string array\nor object array", "3-2": "An array containing zero or one IDs of the task's recipients or a valid array of zero or one [Recipient](doc:recipients) objects.", "4-0": "completeAfter", "4-1": "number", "4-2": "Optional. A timestamp for the earliest time the task should be completed.", "5-0": "completeBefore", "5-1": "number", "5-2": "Optional. A timestamp for the latest time the task should be completed.", "6-0": "pickupTask", "6-1": "boolean", "6-2": "Optional. Whether the task is a pickup task.", "8-0": "notes", "8-1": "string", "8-2": "Optional. Notes for the task.", "9-0": "autoAssign", "9-1": "object", "9-2": "Optional. The automatic assignment options for the newly created task. You may not provide a `container` if using automatic assignment.", "7-0": "dependencies", "7-1": "string array", "7-2": "Optional. One or more IDs of tasks which must be completed prior to this task.", "10-0": "container", "10-1": "object", "10-2": "Optional. The container to which to append this task. Defaults to the creator organization container.", "11-0": "quantity", "11-1": "number", "11-2": "Optional. The number of units to be dropped off while completing this task, for route optimization purposes.", "12-0": "serviceTime", "12-1": "number", "12-2": "Optional. The number of minutes to be spent by the worker on arrival at this task's destination, for route optimization purposes." }, "cols": 3, "rows": 13 } [/block] [block:code] { "codes": [ { "code": "$ curl -X POST \"https://onfleet.com/api/v2/tasks\" \\\n -u \"cd3b3de84cc1ee040bf06512d233719c:\" \\\n -d '{\"destination\":{\"address\":{\"unparsed\":\"2829 Vallejo St, SF, CA, USA\"},\"notes\":\"Small green door by garage door has pin pad, enter *4821*\"},\"recipients\":[{\"name\":\"Blas Silkovich\",\"phone\":\"650-555-4481\",\"notes\":\"Knows Neiman, VIP status.\"}],\"completeAfter\":1455151071727,\"notes\":\"Order 332: 24oz Stumptown Finca El Puente, 10 x Aji de Gallina Empanadas, 13-inch Lelenitas Tres Leches\",\"autoAssign\":{\"mode\":\"distance\"}}'", "language": "shell" } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"id\": \"kc8SS1tzuZ~jqjlebKGrUmpe\",\n \"timeCreated\": 1455156667000,\n \"timeLastModified\": 1455156667234,\n \"organization\": \"yAM*fDkztrT3gUcz9mNDgNOL\",\n \"shortId\": \"8f983639\",\n \"trackingURL\": \"https://onf.lt/8f98363993\",\n \"worker\": \"1LjhGUWdxFbvdsTAAXs0TFos\",\n \"merchant\": \"yAM*fDkztrT3gUcz9mNDgNOL\",\n \"executor\": \"yAM*fDkztrT3gUcz9mNDgNOL\",\n \"creator\": \"EJmsbJgHiRLPjNVE7GEIPs7*\",\n \"dependencies\": [],\n \"state\": 0,\n \"completeAfter\": 1455151071727,\n \"completeBefore\": null,\n \"pickupTask\": false,\n \"notes\": \"Order 332: 24oz Stumptown Finca El Puente, 10 x Aji de Gallina Empanadas, 13-inch Lelenitas Tres Leches\",\n \"completionDetails\": {\n \"events\": [],\n \"time\": null\n },\n \"feedback\": [],\n \"metadata\": [],\n \"overrides\": {\n \"recipientSkipSMSNotifications\": null,\n \"recipientNotes\": null,\n \"recipientName\": null\n },\n \"container\": {\n \"type\": \"WORKER\",\n \"worker\": \"1LjhGUWdxFbvdsTAAXs0TFos\"\n },\n \"recipients\": [\n {\n \"id\": \"G7rcM2nqblmh8vj2do1FpaOQ\",\n \"organization\": \"yAM*fDkztrT3gUcz9mNDgNOL\",\n \"timeCreated\": 1455156667000,\n \"timeLastModified\": 1455156667229,\n \"name\": \"Blas Silkovich\",\n \"phone\": \"+16505554481\",\n \"notes\": \"Knows Neiman, VIP status.\",\n \"skipSMSNotifications\": false,\n \"metadata\": []\n }\n ],\n \"destination\": {\n \"id\": \"zrVXZi5aDzOZlAghZaLfGAfA\",\n \"timeCreated\": 1455156667000,\n \"timeLastModified\": 1455156667220,\n \"location\": [\n -122.4438337,\n 37.7940329\n ],\n \"address\": {\n \"apartment\": \"\",\n \"state\": \"California\",\n \"postalCode\": \"94123\",\n \"country\": \"United States\",\n \"city\": \"San Francisco\",\n \"street\": \"Vallejo Street\",\n \"number\": \"2829\"\n },\n \"notes\": \"Small green door by garage door has pin pad, enter *4821*\",\n \"metadata\": []\n },\n \"didAutoAssign\": true\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "get", "title": "List tasks" } [/block] Returns a paginated collection of all tasks in your organization. The `from` and `to` time range query parameters are considered differently depending on task state. * Completed tasks: time comparison performed on task completion time * All other task states: time comparison performed on task creation time The returned tasks are always sorted by creation time. Each request will return up to 128 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. Query parameters [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Description", "0-0": "from", "1-0": "to", "2-0": "lastId", "0-1": "number", "1-1": "number", "2-1": "string", "1-2": "Optional. If missing, defaults to the current time. The ending time of the range. Tasks created or completed before this time will be included.", "2-2": "Optional. Used to walk the paginated response, if there is one. Tasks created after this ID will be returned.", "0-2": "The starting time of the range. Tasks created or completed at or after this time will be included." }, "cols": 3, "rows": 3 } [/block] [block:code] { "codes": [ { "code": "$ curl -X GET \"https://onfleet.com/api/v2/tasks/all?from=1455072025000\" \\\n -u \"cd3b3de84cc1ee040bf06512d233719c:\"", "language": "shell" } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"lastId\": \"tPMO~h03sOIqFbnhqaOXgUsd\",\n \"tasks\": [\n {\n \"id\": \"11z1BbsQUZFHD1XAd~emDDeK\",\n \"timeCreated\": 1455072025000,\n \"timeLastModified\": 1455072025278,\n \"organization\": \"yAM*fDkztrT3gUcz9mNDgNOL\",\n \"shortId\": \"31aac0a5\",\n \"trackingURL\": \"https://onf.lt/31aac0a5c\",\n \"worker\": \"h*wSb*apKlDkUFnuLTtjPke7\",\n \"merchant\": \"yAM*fDkztrT3gUcz9mNDgNOL\",\n \"executor\": \"yAM*fDkztrT3gUcz9mNDgNOL\",\n \"creator\": \"EJmsbJgHiRLPjNVE7GEIPs7*\",\n \"dependencies\": [],\n \"state\": 1,\n \"completeAfter\": null,\n \"completeBefore\": null,\n \"pickupTask\": false,\n \"notes\": \"\",\n \"completionDetails\": {\n \"events\": [],\n \"time\": null\n },\n \"feedback\": [],\n \"metadata\": [],\n \"overrides\": {},\n \"container\": {\n \"type\": \"WORKER\",\n \"worker\": \"h*wSb*apKlDkUFnuLTtjPke7\"\n },\n \"recipients\": [\n {\n \"id\": \"xX87G1gSkeLvGXlHn2tn0~iB\",\n \"organization\": \"yAM*fDkztrT3gUcz9mNDgNOL\",\n \"timeCreated\": 1455072004000,\n \"timeLastModified\": 1455072025272,\n \"name\": \"Blake Turing\",\n \"phone\": \"+16505552811\",\n \"notes\": \"\",\n \"skipSMSNotifications\": false,\n \"metadata\": []\n }\n ],\n \"destination\": {\n \"id\": \"pfT5L1JclTdhvRnP9GQzMFuL\",\n \"timeCreated\": 1455072025000,\n \"timeLastModified\": 1455072025264,\n \"location\": [\n -122.41289010000003,\n 37.787933\n ],\n \"address\": {\n \"apartment\": \"\",\n \"state\": \"California\",\n \"postalCode\": \"94109\",\n \"country\": \"United States\",\n \"city\": \"San Francisco\",\n \"street\": \"Post Street\",\n \"number\": \"666\"\n },\n \"notes\": \"\",\n \"metadata\": []\n }\n },\n {\n \"id\": \"kc8SS1tzuZ~jqjlebKGrUmpe\",\n \"timeCreated\": 1455156667000,\n \"timeLastModified\": 1455156667234,\n \"organization\": \"yAM*fDkztrT3gUcz9mNDgNOL\",\n \"shortId\": \"8f983639\",\n \"trackingURL\": \"https://onf.lt/8f98363993\",\n \"worker\": \"1LjhGUWdxFbvdsTAAXs0TFos\",\n \"merchant\": \"yAM*fDkztrT3gUcz9mNDgNOL\",\n \"executor\": \"yAM*fDkztrT3gUcz9mNDgNOL\",\n \"creator\": \"EJmsbJgHiRLPjNVE7GEIPs7*\",\n \"dependencies\": [],\n \"state\": 1,\n \"completeAfter\": 1455151071727,\n \"completeBefore\": null,\n \"pickupTask\": false,\n \"notes\": \"Order 332: 24oz Stumptown Finca El Puente, 10 x Aji de Gallina Empanadas, 13-inch Lelenitas Tres Leches\",\n \"completionDetails\": {\n \"events\": [],\n \"time\": null\n },\n \"feedback\": [],\n \"metadata\": [],\n \"overrides\": {\n \"recipientSkipSMSNotifications\": null,\n \"recipientNotes\": null,\n \"recipientName\": null\n },\n \"container\": {\n \"type\": \"WORKER\",\n \"worker\": \"1LjhGUWdxFbvdsTAAXs0TFos\"\n },\n \"recipients\": [\n {\n \"id\": \"G7rcM2nqblmh8vj2do1FpaOQ\",\n \"organization\": \"yAM*fDkztrT3gUcz9mNDgNOL\",\n \"timeCreated\": 1455156667000,\n \"timeLastModified\": 1455156667229,\n \"name\": \"Blas Silkovich\",\n \"phone\": \"+16505554481\",\n \"notes\": \"Knows Neiman, VIP status.\",\n \"skipSMSNotifications\": false,\n \"metadata\": []\n }\n ],\n \"destination\": {\n \"id\": \"zrVXZi5aDzOZlAghZaLfGAfA\",\n \"timeCreated\": 1455156667000,\n \"timeLastModified\": 1455156667220,\n \"location\": [\n -122.4438337,\n 37.7940329\n ],\n \"address\": {\n \"apartment\": \"\",\n \"state\": \"California\",\n \"postalCode\": \"94123\",\n \"country\": \"United States\",\n \"city\": \"San Francisco\",\n \"street\": \"Vallejo Street\",\n \"number\": \"2829\"\n },\n \"notes\": \"Small green door by garage door has pin pad, enter *4821*\",\n \"metadata\": []\n }\n },\n // ...\n ]\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "get", "title": "Get single task" } [/block] 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, as well as 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. If a signature was collected from your customer, a ```signatureUploadId``` will also be returned. In order to refer to the hosted signature image file, you may use the following pattern: ```https://d15p8tr8p0vffz.cloudfront.net/:signatureUploadId/282x.png```. Similarly, a photo captured at task completion can be accessed at ```https://d15p8tr8p0vffz.cloudfront.net/:photoUploadId/800x.png```. 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. [block:code] { "codes": [ { "code": "$ curl -X GET \"https://onfleet.com/api/v2/tasks/qNMz6CKwQ*26FOslywsiQxhY\" \\\n -u \"cd3b3de84cc1ee040bf06512d233719c:\"", "language": "shell" } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"id\": \"qNMz6CKwQ*26FOslywsiQxhY\",\n \"timeCreated\": 1455072004000,\n \"timeLastModified\": 1455152824153,\n \"organization\": \"yAM*fDkztrT3gUcz9mNDgNOL\",\n \"shortId\": \"5f8b5c65\",\n \"trackingURL\": \"https://onf.lt/5f8b5c65f9\",\n \"worker\": \"h*wSb*apKlDkUFnuLTtjPke7\",\n \"merchant\": \"yAM*fDkztrT3gUcz9mNDgNOL\",\n \"executor\": \"yAM*fDkztrT3gUcz9mNDgNOL\",\n \"creator\": \"EJmsbJgHiRLPjNVE7GEIPs7*\",\n \"dependencies\": [],\n \"state\": 3,\n \"completeAfter\": null,\n \"completeBefore\": null,\n \"pickupTask\": false,\n \"notes\": \"\",\n \"completionDetails\": {\n \"events\": [\n {\n \"name\": \"start\",\n \"time\": 1455072035445\n }\n ],\n \"time\": 1455152532732,\n \"photoUploadId\": \"1cf9c8d5d00a763865729825\",\n \"notes\": \"All went great, customer loves us.\",\n \"success\": true,\n \"signatureUploadId\": \"a49846b937eeab3cea248301\"\n },\n \"feedback\": [\n {\n \"recipient\": \"xX87G1gSkeLvGXlHn2tn0~iB\",\n \"rating\": 5,\n \"comments\": \"Super fast delivery, can't wait for my next order :)\"\n }\n ],\n \"metadata\": [],\n \"overrides\": {},\n \"recipients\": [\n {\n \"id\": \"xX87G1gSkeLvGXlHn2tn0~iB\",\n \"organization\": \"yAM*fDkztrT3gUcz9mNDgNOL\",\n \"timeCreated\": 1455072004000,\n \"timeLastModified\": 1455072025272,\n \"name\": \"Peter T\",\n \"phone\": \"+16505557100\",\n \"notes\": \"\",\n \"skipSMSNotifications\": false,\n \"metadata\": []\n }\n ],\n \"destination\": {\n \"id\": \"Nml*Tdh1EMIk1RE46maqOLEQ\",\n \"timeCreated\": 1455072004000,\n \"timeLastModified\": 1455072004352,\n \"location\": [\n -122.40522369999996,\n 37.7718827\n ],\n \"address\": {\n \"apartment\": \"\",\n \"state\": \"California\",\n \"postalCode\": \"94103\",\n \"country\": \"United States\",\n \"city\": \"San Francisco\",\n \"street\": \"Brannan Street\",\n \"number\": \"888\"\n },\n \"notes\": \"\",\n \"metadata\": []\n }\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "get", "title": "Get single task by shortId" } [/block] Retrieve a task's details by its ```shortId```. [block:code] { "codes": [ { "code": "$ curl -X GET \"https://onfleet.com/api/v2/tasks/shortId/e5f0cc28\" \\\n -u \"cd3b3de84cc1ee040bf06512d233719c:\"", "language": "shell", "name": "Shell" } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"id\": \"Eyi36gfoJMdAMyK3QiC3iFLq\",\n \"timeCreated\": 1455152029000,\n \"timeLastModified\": 1455153428203,\n \"organization\": \"yAM*fDkztrT3gUcz9mNDgNOL\",\n \"shortId\": \"e5f0cc28\",\n \"trackingURL\": \"https://onf.lt/e5f0cc28\",\n \"worker\": null,\n \"merchant\": \"yAM*fDkztrT3gUcz9mNDgNOL\",\n \"executor\": \"cBrUjKvQQgdRp~s1qvQNLpK*\",\n \"creator\": \"EJmsbJgHiRLPjNVE7GEIPs7*\",\n \"dependencies\": [],\n \"state\": 0,\n \"completeAfter\": 1455151071727,\n \"completeBefore\": null,\n \"pickupTask\": true,\n \"notes\": \"Order 332: 24oz Stumptown Finca El Puente, 10 x Aji de Gallina Empanadas, 13-inch Lelenitas Tres Leches\",\n \"completionDetails\": {\n \"events\": [],\n \"time\": null\n },\n \"feedback\": [],\n \"metadata\": [],\n \"overrides\": {\n \"recipientSkipSMSNotifications\": null,\n \"recipientNotes\": null,\n \"recipientName\": null\n },\n \"container\": {\n \"type\": \"ORGANIZATION\",\n \"organization\": \"cBrUjKvQQgdRp~s1qvQNLpK*\"\n },\n \"recipients\": [],\n \"destination\": {\n \"id\": \"d~jvinosyxbjVo5yt3wY8lJl\",\n \"timeCreated\": 1455152029000,\n \"timeLastModified\": 1455153428197,\n \"location\": [\n -122.4438337,\n 37.7940329\n ],\n \"address\": {\n \"apartment\": \"\",\n \"state\": \"California\",\n \"postalCode\": \"94123\",\n \"country\": \"United States\",\n \"city\": \"San Francisco\",\n \"street\": \"Vallejo Street\",\n \"number\": \"2829\"\n },\n \"notes\": \"Small green door by garage door has pin pad, enter *4821*\",\n \"metadata\": []\n }\n}", "language": "json", "name": "JSON" } ] } [/block] [block:api-header] { "type": "put", "title": "Update task" } [/block] Note that, for active tasks, only `notes` can be updated, while completed tasks cannot be updated in any way. Further, embedded updates are not currently supported, meaning that if you wish to update an existing task's recipient or destination, you need to handle that before updating the task with the changed entity's ID, if needed. [block:code] { "codes": [ { "code": "$ curl -X PUT \"https://onfleet.com/api/v2/tasks/kc8SS1tzuZ~jqjlebKGrUmpe\" \\\n -u \"cd3b3de84cc1ee040bf06512d233719c:\" \\\n -d '{\"notes\":\"Patxi\\'s deep dish meat lover special, 2 bottles of Basque cider\",\"container\":{\"type\":\"TEAM\",\"team\":\"fwflFNVvrK~4t0m5hKFIxBUl\"}}'", "language": "shell" } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"id\": \"kc8SS1tzuZ~jqjlebKGrUmpe\",\n \"timeCreated\": 1455156667000,\n \"timeLastModified\": 1455156668922,\n \"organization\": \"yAM*fDkztrT3gUcz9mNDgNOL\",\n \"shortId\": \"8f983639\",\n \"trackingURL\": \"https://onf.lt/8f98363993\",\n \"worker\": null,\n \"merchant\": \"yAM*fDkztrT3gUcz9mNDgNOL\",\n \"executor\": \"yAM*fDkztrT3gUcz9mNDgNOL\",\n \"creator\": \"EJmsbJgHiRLPjNVE7GEIPs7*\",\n \"dependencies\": [],\n \"state\": 0,\n \"completeAfter\": 1455151071727,\n \"completeBefore\": null,\n \"pickupTask\": false,\n \"notes\": \"Patxi's deep dish meat lover special, 2 bottles of Basque cider\",\n \"completionDetails\": {\n \"events\": [],\n \"time\": null\n },\n \"feedback\": [],\n \"metadata\": [],\n \"overrides\": {\n \"recipientSkipSMSNotifications\": null,\n \"recipientNotes\": null,\n \"recipientName\": null\n },\n \"container\": {\n \"type\": \"TEAM\",\n \"team\": \"fwflFNVvrK~4t0m5hKFIxBUl\"\n },\n \"recipients\": [\n {\n \"id\": \"G7rcM2nqblmh8vj2do1FpaOQ\",\n \"organization\": \"yAM*fDkztrT3gUcz9mNDgNOL\",\n \"timeCreated\": 1455156667000,\n \"timeLastModified\": 1455156667229,\n \"name\": \"Blas Silkovich\",\n \"phone\": \"+16505554481\",\n \"notes\": \"Knows Neiman, VIP status.\",\n \"skipSMSNotifications\": false,\n \"metadata\": []\n }\n ],\n \"destination\": {\n \"id\": \"zrVXZi5aDzOZlAghZaLfGAfA\",\n \"timeCreated\": 1455156667000,\n \"timeLastModified\": 1455156667220,\n \"location\": [\n -122.4438337,\n 37.7940329\n ],\n \"address\": {\n \"apartment\": \"\",\n \"state\": \"California\",\n \"postalCode\": \"94123\",\n \"country\": \"United States\",\n \"city\": \"San Francisco\",\n \"street\": \"Vallejo Street\",\n \"number\": \"2829\"\n },\n \"notes\": \"Small green door by garage door has pin pad, enter *4821*\",\n \"metadata\": []\n }\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "post", "title": "Complete task" } [/block] Active tasks can be force completed. A ```completionDetails``` property must be provided in the body of your request, with the following structure. [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Description", "0-0": "success", "0-1": "boolean", "0-2": "Whether the task's completion was successful.", "1-0": "notes", "1-1": "string", "1-2": "Optional. Any completion notes for the task." }, "cols": 3, "rows": 2 } [/block] [block:code] { "codes": [ { "code": "$ curl -X POST \"https://onfleet.com/api/v2/tasks/uO2vKr07h6zg7Fzf~2NC3KLg/complete\" \\\n -u \"c64f80ba83d7cfce8ae74f51e263ce93:\" \\\n -d '{\"completionDetails\":{\"success\":true}}'", "language": "shell" } ] } [/block] [block:code] { "codes": [ { "code": "HTTP/1.1 200 OK", "language": "http" } ] } [/block] [block:api-header] { "type": "post", "title": "Clone task" } [/block] The property `sourceTaskId` can be used to keep track of the source task from which the task was cloned. [block:code] { "codes": [ { "code": "$ curl -X POST \"https://onfleet.com/api/v2/tasks/uO2vKr07h6zg7Fzf~2NC3KLg/clone\" \\\n -u \"c64f80ba83d7cfce8ae74f51e263ce93:\"", "language": "shell" } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"id\": \"fesYPEu2FWvubaq~2nof*lCA\",\n \"timeCreated\": 1489010058000,\n \"timeLastModified\": 1489010058477,\n \"organization\": \"yAM*fDkztrT3gUcz9mNDgNOL\",\n \"shortId\": \"9b4zd53d\",\n \"trackingURL\": \"https://onf.lt/9b4zd53d\",\n \"worker\": null,\n \"merchant\": \"yAM*fDkztrT3gUcz9mNDgNOL\",\n \"executor\": \"yAM*fDkztrT3gUcz9mNDgNOL\",\n \"creator\": \"EJmsbJgHiRLPjNVE7GEIPs7*\",\n \"dependencies\": [],\n \"state\": 0,\n \"completeAfter\": null,\n \"completeBefore\": null,\n \"pickupTask\": false,\n \"notes\": \"\",\n \"completionDetails\": {\n \"events\": [],\n \"failureReason\": \"NONE\",\n \"time\": null\n },\n \"feedback\": [],\n \"metadata\": [],\n \"overrides\": {},\n \"quantity\": 0,\n \"serviceTime\": 0,\n \"delayTime\": null,\n \"sourceTaskId\": \"uO2vKr07h6zg7Fzf~2NC3KLg\",\n \"container\": {\n \"type\": \"ORGANIZATION\",\n \"organization\": \"yAM*fDkztrT3gUcz9mNDgNOL\"\n },\n \"recipients\": [],\n \"destination\": {\n \"id\": \"Fa0Oxd21cL3T36qw5mGOvZw6\",\n \"timeCreated\": 1485469374000,\n \"timeLastModified\": 1485469374734,\n \"location\": [\n -122.43232727050781,\n 37.79811961477822\n ],\n \"address\": {\n \"apartment\": \"\",\n \"state\": \"California\",\n \"postalCode\": \"94123\",\n \"country\": \"United States\",\n \"city\": \"San Francisco\",\n \"street\": \"Buchanan Street\",\n \"number\": \"3020\"\n },\n \"notes\": \"\",\n \"metadata\": []\n }\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "delete", "title": "Delete task" } [/block] Active or completed tasks cannot be deleted. [block:code] { "codes": [ { "code": "$ curl -i -X DELETE \"https://onfleet.com/api/v2/tasks/d2N*68bTBAM6Rd6txuWdH9Xj\" \\\n -u \"c64f80ba83d7cfce8ae74f51e263ce93:\"", "language": "shell" } ] } [/block] [block:code] { "codes": [ { "code": "HTTP/1.1 200 OK", "language": "http" } ] } [/block]