Question
Can I download all ticket attachments in Zendesk Support?
Answer
Zendesk Support doesn't have a full download or export functionality for attachments. However, you can use the Zendesk API for both an individual ticket and for all tickets.
For an individual ticket
To retrieve the attachments of one ticket:
- Find your attachment URLs within:
https://subdomain.zendesk.com/api/v2/tickets/TICKET_ID/comments.json - Replace the
subdomainwith your actual subdomain andTICKET_IDwith your ticket ID - Each comment has an
attachments arrayattribute, which contains a link to any attachment included in that comment. To get the file associated with it, download the file linked at thecontent_urlattribute.
For all tickets
To retrieve the attachments of all tickets:
-
Accounts with access to exports can perform a JSON export of tickets, which contains links to the various attachments as:
https://subdomain.zendesk.com/api/v2/attachments/ATTACHMENT_ID.jsonNote: The same attachment links will show up in the JSON export associated with user photos. If that user has been deleted or changed their photo, those links will fail to return files. - Replace the
subdomainwith your actual subdomain andATTACHMENT_IDwith the attachment ID - To download the attachments associated with each link, perform a
GETrequest to thatattachmentsendpoint - Then, download the file linked at the
content_urlattribute
Private attachments and authentication
For accounts created on or after December 5, 2024, or those that use messaging, attachments can be marked as private. This introduces specific requirements for programmatic access:
Authentication is required: Unlike public attachments, private attachments can't be accessed through a browser without an active session or through the API without valid credentials. You must use Basic Authentication, email or token, or an OAuth bearer token.
Token-based content URLs: The
content_urlprovided by the API for private attachments is often a pre-signed, temporary URLLink expiry: These URLs are short-lived. If you perform a bulk migration or download, you must download the file immediately after you access the attachment endpoint. Don't store the
content_urlfor later use, as it will expire and return a403 Forbiddenerror.Permissions: The API credentials used must have the permissions of an agent or admin who has access to the specific ticket where the attachment resides