Sub-jobs
Sub-jobs are nested job entities that belong to a parent job. They allow you to break down complex jobs into smaller, manageable tasks while optionally inheriting settings from their parent.
Key Concepts
useParentData
The useParentData field controls whether a sub-job inherits settings from its parent:
| useParentData | Behavior |
|---|---|
true (default) | Inherits assign, gps, and description from parent. Cannot specify these fields |
false | Must provide own assign field. gps and description are optional |
ImportantSub-jobs can only be added to a parent job that was created with at least one sub-job. You cannot add sub-jobs to a standalone job after creation.
Create Sub-Jobs
Option 1: Create with Parent Job
Include sub-jobs in the subJobs array when creating the parent:
[
{
"instanceIds": [6833518],
"title": "Parent Job",
"assign": {
"type": "both",
"userIds": [],
"groupIds": [5321397]
},
"subJobs": [
{
"title": "Sub-Job 1"
},
{
"title": "Sub-Job 2"
}
]
}
]Option 2: Add to Existing Parent
Add a sub-job to an existing parent job using parentId:
[
{
"parentId": "19cc77e2-0aab-4578-a79c-0d8160671a34",
"title": "New Sub-Job",
"code": "SUB-003"
}
]Sub-Job with Custom Settings
To give a sub-job its own assignment settings:
[
{
"parentId": "19cc77e2-0aab-4578-a79c-0d8160671a34",
"title": "Custom Sub-Job",
"useParentData": false,
"description": "Custom description",
"assign": {
"type": "both",
"userIds": [7031021],
"groupIds": []
},
"gps": {
"address": "Different location"
}
}
]Update Sub-Jobs
Use the Update Job endpoint with the sub-job ID:
PUT /jobs/v1/jobs/{subJobId}
You cannot change a sub-job's parent. The parentId in the request must match the current parent.
Request (inheriting from parent)
{
"parentId": "19cc77e2-0aab-4578-a79c-0d8160671a34",
"title": "Updated Sub-Job Title",
"useParentData": true
}Request (custom settings)
{
"parentId": "19cc77e2-0aab-4578-a79c-0d8160671a34",
"title": "Updated Sub-Job Title",
"useParentData": false,
"assign": {
"type": "both",
"userIds": [7031021],
"groupIds": []
}
}Delete Sub-Jobs
Use the Delete Job endpoint with the sub-job ID:
DELETE /jobs/v1/jobs/{subJobId}
curl -X DELETE \
'https://api.connecteam.com/jobs/v1/jobs/7c86a7c2-6736-4c91-aeec-b1beb64fb7b5' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN'Note: You cannot delete the last remaining sub-job. A parent must always have at least one sub-job.
Error Responses
| Status | Error | Description |
|---|---|---|
| 400 | assign must be defined when use_parent_data is false | Missing assign field |
| 400 | assign cannot be set when use_parent_data is true | Remove assign field |
| 400 | gps cannot be set when use_parent_data is true | Remove gps field |
| 400 | description cannot be set when use_parent_data is true | Remove description field |
| 400 | Cannot update sub-job parent | parentId cannot be changed |
| 400 | Deleting the last sub-job is not supported | Keep at least one sub-job |
| 400 | Parent job not found | Invalid parentId |
Updated 19 days ago
