Set the parent of a task
Changed on<b>Required scope: </b><code>tasks:write</code>
Updates the parent of a given task. This endpoint can be used to make a task a subtask of another task, or to remove its existing parent. When using insert_before and insert_after, at most one of those two options can be specified, and they must already be subtasks of the parent. Returns the complete, updated record of the affected task.
Request
- Base URL: https://app.asana.com/api/1.0
- URL: https://app.asana.com/api/1.0/tasks/{task_gid}/setParent
- Auth: one of:
- HTTP bearer
- OAuth 2 (authorization code, authorization URL https://app.asana.com/-/oauth_authorize, token URL https://app.asana.com/-/oauth_token, scopes: tasks:write)
Query parameters
This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. Properties can include nested fields. To learn more, see the input/output options guide.
Request body
Example request
{
"data": {
"parent": "987654",
"insert_after": "null",
"insert_before": "124816"
}
}Response
Successfully changed the parent of the specified subtask.
Example response
{
"data": {
"gid": "12345",
"resource_type": "task",
"name": "Buy catnip",
"resource_subtype": "default_task",
"created_by": {
"gid": "1111",
"resource_type": "user"
},
"approval_status": "pending",
"assignee_status": "upcoming",
"assigned_by": {
"gid": "12345",
"resource_type": "user",
"name": "Greg Sanchez"
},
"completed_at": "2012-02-22T02:06:58.147Z",
"completed_by": {
"gid": "12345",
"resource_type": "user",
"name": "Greg Sanchez"
},
"created_at": "2012-02-22T02:06:58.147Z",
"dependencies": [
{
"gid": "12345",
"resource_type": "task"
}
],
"dependents": [
{
"gid": "12345",
"resource_type": "task"
}
],
"due_at": "2019-09-15T02:06:58.147Z",
"due_on": "2019-09-15",
"external": {
"gid": "my_gid",
"data": "A blob of information"
},
"html_notes": "<body>Mittens <em>really</em> likes the stuff from Humboldt.</body>",
"hearted": true,
"hearts": [
{
"gid": "12345",
"user": {
"gid": "12345",
"resource_type": "user",
"name": "Greg Sanchez"
}
}
],
"has_subtasks_date_mismatch": true,
"liked": true,
"likes": [
{
"gid": "12345",
"user": {
"gid": "12345",
"resource_type": "user",
"name": "Greg Sanchez"
}
}
],
"memberships": [
{
"project": {
"gid": "12345",
"resource_type": "project",
"name": "Stuff to buy",
"resource_subtype": "default_project"
},
"section": {
"gid": "12345",
"resource_type": "section",
"name": "Next Actions"
}
}
],
"modified_at": "2012-02-22T02:06:58.147Z",
"notes": "Mittens really likes the stuff from Humboldt.",
"num_hearts": 5,
"num_likes": 5,
"num_subtasks": 3,
"start_at": "2019-09-14T02:06:58.147Z",
"start_on": "2019-09-14",
"actual_time_minutes": 200,
"assignee": {
"gid": "12345",
"resource_type": "user",
"name": "Greg Sanchez"
},
"assignee_section": {
"gid": "12345",
"resource_type": "section",
"name": "Next Actions"
},
"custom_fields": [
{
"gid": "12345",
"resource_type": "custom_field",
"name": "Status",
"enum_options": [
{
"gid": "12345",
"resource_type": "enum_option",
"name": "Low",
"enabled": true,
"color": "blue"
}
],
"enabled": true,
"representation_type": "number",
"id_prefix": "ID",
"input_restrictions": [
"task"
],
"date_value": {
"date": "2024-08-23",
"date_time": "2024-08-23T22:00:00.000Z"
},
"enum_value": {
"gid": "12345",
"resource_type": "enum_option",
"name": "Low",
"enabled": true,
"color": "blue"
},
"multi_enum_values": [
{
"gid": "12345",
"resource_type": "enum_option",
"name": "Low",
"enabled": true,
"color": "blue"
}
],
"number_value": 5.2,
"text_value": "Some Value",
"display_value": "blue",
"description": "Development team priority",
"precision": 2,
"format": "custom",
"currency_code": "EUR",
"custom_label": "gold pieces",
"custom_label_position": "suffix",
"is_global_to_workspace": true,
"has_notifications_enabled": true,
"asana_created_field": "priority",
"created_by": {
"gid": "12345",
"resource_type": "user",
"name": "Greg Sanchez"
},
"people_value": [
{
"gid": "12345",
"resource_type": "user",
"name": "Greg Sanchez"
}
],
"reference_value": [
{
"gid": "12345",
"resource_type": "task",
"name": "Bug Task"
}
],
"html_text_value": "<body>Some Value</body>",
"privacy_setting": "public_with_guests",
"default_access_level": "user",
"resource_subtype": "text"
}
],
"custom_type": {
"gid": "12345",
"resource_type": "custom_type",
"name": "Bug ticket",
"asana_created_type_identifier": "COMMAND_TICKET"
},
"custom_type_status_option": {
"gid": "12345",
"resource_type": "custom_type_status_option",
"name": "Solution pending"
},
"followers": [
{
"gid": "12345",
"resource_type": "user",
"name": "Greg Sanchez"
}
],
"parent": {
"gid": "12345",
"resource_type": "task",
"name": "Bug Task",
"resource_subtype": "default_task",
"created_by": {
"gid": "1111",
"resource_type": "user"
}
},
"projects": [
{
"gid": "12345",
"resource_type": "project",
"name": "Stuff to buy",
"resource_subtype": "default_project"
}
],
"effective_memberships": [
{
"project": {
"gid": "12345",
"resource_type": "project",
"name": "Stuff to buy",
"resource_subtype": "default_project"
},
"section": {
"gid": "12345",
"resource_type": "section",
"name": "Next Actions"
}
}
],
"tags": [
{
"gid": "59746",
"name": "Grade A"
}
],
"workspace": {
"gid": "12345",
"resource_type": "workspace",
"name": "My Company Workspace"
},
"permalink_url": "https://app.asana.com/1/12345/task/123456789"
}
}Changes
- info
added the enum value
has_subtasks_date_mismatchto the propertyitems/of thequeryrequest parameteropt_fields - info
added the optional property
//////to the response with the status
- info
- info
added the enum value
custom_type.asana_created_type_identifierto the propertyitems/of thequeryrequest parameteropt_fields - info
added the enum value
memberships.project.resource_subtypeto the propertyitems/of thequeryrequest parameteropt_fields - info
added the enum value
projects.resource_subtypeto the propertyitems/of thequeryrequest parameteropt_fields - info
added the optional property
/////////to the response with the status - info
added the optional property
///////to the response with the status - info
added the optional property
/////////to the response with the status - info
added the optional property
////to the response with the status
- info