Skip to content

Asana: Get an attachment

Asana attachments.getAttachment: arguments, response, policy and SDK examples.

← Attachments operations · Get started

Operation asana.getattachment

Provider route: GET /attachments/{attachment_gid}. Alter supplies the connection’s credentials and routing.

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["attachments"]["getAttachment"]>[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.attachments.getAttachment(input);
const result = await call.wait();
return result.bodyJson();
} finally {
await app.close();
}
}
import os
from alter_sdk import App
from 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.attachments.get_attachment(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
pathobjectRequired within parentAdditional keys: not allowed
path.attachment_gidstringRequired within parent
queryobjectOptionalAdditional keys: not allowed
query.opt_prettybooleanOptional
query.opt_fieldsarrayOptional
query.opt_fields[]stringEach itemOne of: connected_to_app, created_at, download_url, host, name, parent, parent.created_by, parent.name, parent.resource_subtype, permanent_url, resource_subtype, size, view_url

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$JSONRoot
$ (allOf 1)objectAll variants apply
$ (allOf 1).dataModelOptionalExpand Get an attachment — response body — data data — Attachment Response
$ (allOf 2)ModelAll variants applyExpand Get an attachment — response body — data

Referenced models: Get an attachment — response body — data data — Attachment Response, Get an attachment — response body — data

1 more schema is linked from the tables above, on the schema pages.

Get an attachment — response body — data data — Attachment Response
FieldTypePresenceDescription and constraints
$JSONRoot
$ (allOf 1)ModelAll variants applyExpand Get attachments from an object — response body — data, next page data item
$ (allOf 2)objectAll variants apply
$ (allOf 2).created_atstringOptionalThe time at which this resource was created.
Format: date-time
Read only: true
$ (allOf 2).download_urlJSONOptional
$ (allOf 2).download_url (anyOf 1)stringAlternativeThe URL containing the content of the attachment.
*Note:* May be null if the attachment is hosted by [Box](https://www.box.com/) and will be null if the attachment is a Video Message hosted by [Vimeo](https://vimeo.com/). If present, this URL may only be valid for two minutes from the time of retrieval. You should avoid persisting this URL somewhere and just refresh it on demand to ensure you do not keep stale URLs.
Format: uri
Read only: true
$ (allOf 2).download_url (anyOf 2)nullAlternative
$ (allOf 2).permanent_urlJSONOptional
$ (allOf 2).permanent_url (anyOf 1)stringAlternativeA stable URL for accessing the attachment through the Asana web application. This URL redirects to the file download location (e.g., an S3 link) if the user is authenticated and authorized to view the parent object (e.g., a task). Unauthorized users will receive a `403 Forbidden` response. This link is persistent and does not expire, but requires an active session to resolve.
Format: uri
Read only: true
$ (allOf 2).permanent_url (anyOf 2)nullAlternative
$ (allOf 2).hoststringOptionalThe service hosting the attachment. Valid values are `asana`, `dropbox`, `gdrive`, `onedrive`, `box`, `vimeo`, and `external`.
Read only: true
$ (allOf 2).parentJSONOptional
$ (allOf 2).parent (anyOf 1)JSONAlternative
$ (allOf 2).parent (anyOf 1) (allOf 1)ModelAll variants applyExpand Search tasks in a workspace — response body — data data item
$ (allOf 2).parent (anyOf 1) (allOf 2)objectAll variants applyThe task this attachment is attached to.
Read only: true
$ (allOf 2).parent (anyOf 1) (allOf 2).resource_subtypeJSONOptional
$ (allOf 2).parent (anyOf 1) (allOf 2).resource_subtype (anyOf 1)stringAlternativeThe resource subtype of the parent resource that the filter applies to.
$ (allOf 2).parent (anyOf 1) (allOf 2).resource_subtype (anyOf 2)nullAlternative
$ (allOf 2).parent (anyOf 2)nullAlternative
$ (allOf 2).sizeJSONOptional
$ (allOf 2).size (anyOf 1)integerAlternativeThe size of the attachment in bytes. Only present when the `resource_subtype` is `asana`.
Read only: true
$ (allOf 2).size (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
$ (allOf 2).view_urlJSONOptional
$ (allOf 2).view_url (anyOf 1)stringAlternativeThe URL where the attachment can be viewed, which may be friendlier to users in a browser than just directing them to a raw file. May be null if no view URL exists for the service.
Format: uri
Read only: true
$ (allOf 2).view_url (anyOf 2)nullAlternative
$ (allOf 2).connected_to_appbooleanOptionalWhether the attachment is connected to the app making the request for the purposes of showing an app components widget. Only present when the `resource_subtype` is `external` or `gdrive`.
Read only: true

Referenced models: Get attachments from an object — response body — data, next page data item, Search tasks in a workspace — response body — data data item

Get an attachment — response body — data
FieldTypePresenceDescription and constraints
$objectRoot
dataModelRequired within parentExpand Get an attachment — response body — data data — sdk__Attachment Response

Referenced models: Get an attachment — response body — data data — sdk__Attachment Response

Get attachments from an object — response body — data, next page data item
FieldTypePresenceDescription and constraints
$objectRootAn *attachment* object represents any file attached to a task in Asana, whether it's an uploaded file or one associated via a third-party service such as Dropbox or Google Drive.
gidstringOptionalGlobally unique identifier of the resource, as a string.
Read only: true
resource_typestringOptionalThe base type of this resource.
Read only: true
namestringOptionalThe name of the file.
Read only: true
resource_subtypestringOptionalThe service hosting the attachment. Valid values are `asana`, `dropbox`, `gdrive`, `onedrive`, `box`, `vimeo`, and `external`.
Search tasks in a workspace — response body — data data item
FieldTypePresenceDescription and constraints
$objectRootThe *task* is the basic object around which many operations in Asana are centered.
gidstringOptionalGlobally unique identifier of the resource, as a string.
Read only: true
resource_typestringOptionalThe base type of this resource.
Read only: true
namestringOptionalThe name of the task.
resource_subtypestringOptionalThe subtype of this resource. Different subtypes retain many of the same fields and behavior, but may render differently in Asana or represent resources with different semantic meaning.
The resource_subtype `milestone` represent a single moment in time. This means tasks with this subtype cannot have a start_date.
Known values: default_task, milestone, approval, custom
created_byobjectOptional[Opt In](/docs/inputoutput-options). A *user* object represents an account in Asana that can be given access to various workspaces, projects, and tasks.
Read only: true
created_by.gidstringOptionalGlobally unique identifier of the resource.
created_by.resource_typestringOptionalThe type of resource.
Get an attachment — response body — data data — sdk__Attachment Response
FieldTypePresenceDescription and constraints
$objectRootA generic Asana Resource, containing a globally unique identifier.A generic Asana Resource, containing a globally unique identifier.
An *attachment* object represents any file attached to a task in Asana, whether it's an uploaded file or one associated via a third-party service such as Dropbox or Google Drive.
gidstringOptionalGlobally unique identifier of the resource, as a string.
Read only: true
resource_typestringOptionalThe base type of this resource.
Read only: true
namestringOptionalThe name of the file.
Read only: true
resource_subtypestringOptionalThe service hosting the attachment. Valid values are `asana`, `dropbox`, `gdrive`, `onedrive`, `box`, `vimeo`, and `external`.
created_atstringOptionalThe time at which this resource was created.
Format: date-time
Read only: true
download_urlJSONOptional
download_url (anyOf 1)stringAlternativeThe URL containing the content of the attachment.
*Note:* May be null if the attachment is hosted by [Box](https://www.box.com/) and will be null if the attachment is a Video Message hosted by [Vimeo](https://vimeo.com/). If present, this URL may only be valid for two minutes from the time of retrieval. You should avoid persisting this URL somewhere and just refresh it on demand to ensure you do not keep stale URLs.
Format: uri
Read only: true
download_url (anyOf 2)nullAlternative
permanent_urlJSONOptional
permanent_url (anyOf 1)stringAlternativeA stable URL for accessing the attachment through the Asana web application. This URL redirects to the file download location (e.g., an S3 link) if the user is authenticated and authorized to view the parent object (e.g., a task). Unauthorized users will receive a `403 Forbidden` response. This link is persistent and does not expire, but requires an active session to resolve.
Format: uri
Read only: true
permanent_url (anyOf 2)nullAlternative
hoststringOptionalThe service hosting the attachment. Valid values are `asana`, `dropbox`, `gdrive`, `onedrive`, `box`, `vimeo`, and `external`.
Read only: true
parentJSONOptional
parent (anyOf 1)ModelAlternativeExpand Get an attachment — response body — data data parent created by, gid, name, resource subtype, resource type
parent (anyOf 2)nullAlternative
sizeJSONOptional
size (anyOf 1)integerAlternativeThe size of the attachment in bytes. Only present when the `resource_subtype` is `asana`.
Read only: true
size (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
view_urlJSONOptional
view_url (anyOf 1)stringAlternativeThe URL where the attachment can be viewed, which may be friendlier to users in a browser than just directing them to a raw file. May be null if no view URL exists for the service.
Format: uri
Read only: true
view_url (anyOf 2)nullAlternative
connected_to_appbooleanOptionalWhether the attachment is connected to the app making the request for the purposes of showing an app components widget. Only present when the `resource_subtype` is `external` or `gdrive`.
Read only: true

Referenced models: Get an attachment — response body — data data parent created by, gid, name, resource subtype, resource type

SDK function policy ID: asana.getattachment. Catalog operation: asana:getAttachment. 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: ["attachments:read"]

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.