Asana: Get a task
Asana tasks.getTask: arguments, response, policy and SDK examples.
← Tasks operations · Get started
Operation asana.gettask
Provider route: GET /tasks/{task_gid}. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/asana with npm, or alter-sdk-asana with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { AsanaIntegration } from "@alter-ai/asana";
async function execute(input: Parameters<AsanaIntegration["tasks"]["getTask"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new AsanaIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.tasks.getTask(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_asana import AsanaIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = AsanaIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.tasks.get_task(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
path | object | Required within parent | Additional keys: not allowed |
path.task_gid | string | Required within parent | |
query | Model | Optional | Expand Get a task — request body — query |
Referenced models: Get a task — request body — query
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | JSON | Root | |
$ (allOf 1) | object | All variants apply | |
$ (allOf 1).data | Model | Optional | Expand Get a task — response body — data data — Task Response |
$ (allOf 2) | Model | All variants apply | Expand Get a task — response body — data |
Referenced models: Get a task — response body — data data — Task Response, Get a task — response body — data
Schemas
Section titled “Schemas”34 more schemas are linked from the tables above, on the schema pages.
Get a task — response body — data data — Task Response
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | JSON | Root | |
$ (allOf 1) | Model | All variants apply | Expand Get a task — response body — data / data / approval_status: pending, approved, rejected, changes requested, assignee status: today, upcoming, later, new, inbox, resource subtype: default task, milestone, approval, custom |
$ (allOf 2) | object | All variants apply | |
$ (allOf 2).assignee | JSON | Optional | |
$ (allOf 2).assignee (anyOf 1) | JSON | Alternative | |
$ (allOf 2).assignee (anyOf 1) (allOf 1) | Model | All variants apply | Expand Get users in a team — response body — data data item |
$ (allOf 2).assignee (anyOf 1) (allOf 2) | JSON | All variants apply | |
$ (allOf 2).assignee (anyOf 2) | null | Alternative | |
$ (allOf 2).assignee_section | JSON | Optional | |
$ (allOf 2).assignee_section (anyOf 1) | JSON | Alternative | |
$ (allOf 2).assignee_section (anyOf 1) (allOf 1) | Model | All variants apply | Expand Get sections in a project — response body — data, next page data item |
$ (allOf 2).assignee_section (anyOf 1) (allOf 2) | object | All variants apply | The *assignee section* is a subdivision of a project that groups tasks together in the assignee's "My tasks" list. It can either be a header above a list of tasks in a list view or a column in a board view of "My tasks." The `assignee_section` property will be returned in the response only if the request was sent by the user who is the assignee of the task. Note that you can only write to `assignee_section` with the gid of an existing section visible in the user's "My tasks" list. |
$ (allOf 2).assignee_section (anyOf 2) | null | Alternative | |
$ (allOf 2).custom_fields | array | Optional | Array of custom field values applied to the task. These represent the custom field values recorded on this project for a particular custom field. For example, these custom field values will contain an `enum_value` property for custom fields of type `enum`, a `text_value` property for custom fields of type `text`, and so on. Please note that the `gid` returned on each custom field value *is identical* to the `gid` of the custom field, which allows referencing the custom field metadata through the `/custom_fields/custom_field_gid` endpoint. The array includes custom fields from projects the task belongs to directly and from projects inherited from its full ancestor chain. Read only: true |
$ (allOf 2).custom_fields[] | Model | Each item | Expand Get a custom field — response body — data data — Custom Field Response |
$ (allOf 2).custom_type | JSON | Optional | |
$ (allOf 2).custom_type (anyOf 1) | JSON | Alternative | |
$ (allOf 2).custom_type (anyOf 1) (allOf 1) | Model | All variants apply | Expand Get a custom type — response body — data data asana created type identifier, gid, name, resource type |
$ (allOf 2).custom_type (anyOf 1) (allOf 2) | JSON | All variants apply | |
$ (allOf 2).custom_type (anyOf 2) | null | Alternative | |
$ (allOf 2).custom_type_status_option | JSON | Optional | |
$ (allOf 2).custom_type_status_option (anyOf 1) | JSON | Alternative | |
$ (allOf 2).custom_type_status_option (anyOf 1) (allOf 1) | Model | All variants apply | Expand Get a task — response body — data data assignee, assignee section, custom fields, custom type, custom type status option, effective memberships, followers, parent, permalink url, projects, tags, workspace custom type status option gid, name, resource type gid, name, resource type |
$ (allOf 2).custom_type_status_option (anyOf 1) (allOf 2) | JSON | All variants apply | |
$ (allOf 2).custom_type_status_option (anyOf 2) | null | Alternative | |
$ (allOf 2).followers | array | Optional | Array of users following this task. Read only: true |
$ (allOf 2).followers[] | Model | Each item | Expand Get users in a team — response body — data data item |
$ (allOf 2).parent | JSON | Optional | |
$ (allOf 2).parent (anyOf 1) | JSON | Alternative | |
$ (allOf 2).parent (anyOf 1) (allOf 1) | Model | All variants apply | Expand Search tasks in a workspace — response body — data data item |
$ (allOf 2).parent (anyOf 1) (allOf 2) | object | All variants apply | The parent of this task, or `null` if this is not a subtask. This property cannot be modified using a PUT request but you can change it with the `setParent` endpoint. You can create subtasks by using the subtasks endpoint. Read only: true |
$ (allOf 2).parent (anyOf 2) | null | Alternative | |
$ (allOf 2).projects | array | Optional | *Create-only.* Array of projects this task is directly associated with. At task creation time, this array can be used to add the task to many projects at once. After task creation, these associations can be modified using the addProject and removeProject endpoints. Read only: true |
$ (allOf 2).projects[] | Model | Each item | Expand Search projects in a workspace — response body — data data item |
$ (allOf 2).effective_memberships | array | Optional | <p><strong style={{ color: "#4573D2" }}>Full object requires scope: </strong><code>projects:read</code>, <code>project_sections:read</code></p> Opt-in, read-only. The union of direct and inherited memberships for this task. If the task is both directly associated with and inherits the same project, the direct membership takes precedence. Read only: true |
$ (allOf 2).effective_memberships[] | Model | Each item | Expand Get a task — response body — data data assignee, assignee section, custom fields, custom type, custom type status option, effective memberships, followers, parent, permalink url, projects, tags, workspace effective memberships item |
$ (allOf 2).tags | array | Optional | Array of tags associated with this task. In order to change tags on an existing task use `addTag` and `removeTag`. Read only: true |
$ (allOf 2).tags[] | Model | Each item | Expand Get a task's tags — response body — data, next page data item |
$ (allOf 2).workspace | JSON | Optional | |
$ (allOf 2).workspace (allOf 1) | Model | All variants apply | Expand Update a workspace — request body — body data |
$ (allOf 2).workspace (allOf 2) | object | All variants apply | *Create-only*. The workspace this task is associated with. Once created, task cannot be moved to a different workspace. This attribute can only be specified at creation time. Read only: true |
$ (allOf 2).permalink_url | string | Optional | A url that points directly to the object within Asana. Read only: true |
Referenced models: Get a task — response body — data data assignee, assignee section, custom fields, custom type, custom type status option, effective memberships, followers, parent, permalink url, projects, tags, workspace custom type status option gid, name, resource type gid, name, resource type, Get a custom field — response body — data data — Custom Field Response, Get a custom type — response body — data data asana created type identifier, gid, name, resource type, Get a task — response body — data data assignee, assignee section, custom fields, custom type, custom type status option, effective memberships, followers, parent, permalink url, projects, tags, workspace effective memberships item, Search projects in a workspace — response body — data data item, Get sections in a project — response body — data, next page data item, Get a task's tags — response body — data, next page data item, Get a task — response body — data / data / approval_status: pending, approved, rejected, changes requested, assignee status: today, upcoming, later, new, inbox, resource subtype: default task, milestone, approval, custom, Search tasks in a workspace — response body — data data item, Get users in a team — response body — data data item, Update a workspace — request body — body data
Get a task — response body — data
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
data | Model | Required within parent | Expand Get a task — response body — data data — sdk__Task Response |
Referenced models: Get a task — response body — data data — sdk__Task Response
Get a task — response body — data data assignee, assignee section, custom fields, custom type, custom type status option, effective memberships, followers, parent, permalink url, projects, tags, workspace custom type status option gid, name, resource type gid, name, resource type
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | <p><strong style={{ color: "#4573D2" }}>Full object requires scope: </strong><code>custom_types:read</code></p> A generic Asana Resource, containing a globally unique identifier. |
gid | string | Optional | Globally unique identifier of the resource, as a string. Read only: true |
resource_type | string | Optional | The base type of this resource. Read only: true |
name | string | Optional | The name of the custom type status option. |
Get sections in a project — response body — data, next page data item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A *section* is a subdivision of a project that groups tasks together. It can either be a header above a list of tasks in a list view or a column in a board view of a project. |
gid | string | Optional | Globally unique identifier of the resource, as a string. Read only: true |
resource_type | string | Optional | The base type of this resource. Read only: true |
name | string | Optional | The name of the section (i.e. the text displayed as the section header). |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: asana.gettask. Catalog operation: asana:getTask. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Required provider scopes: ["tasks:read"]