GitHub Issue Attachments Cannot Be Downloaded via API or PAT

Tadashi Shigeoka ·  Fri, August 8, 2025

At my company, we use GitHub Enterprise, and a requirement arose to batch download and process files attached to Issues for automation purposes. What seemed like a straightforward task ultimately hit a wall due to GitHub’s specifications. Here, I’ll share the journey and final conclusion.

What I Wanted to Achieve

GitHub Issues allow you to easily attach images and document files via drag and drop. The goal was to programmatically download these attachments automatically within CI/CD pipelines or batch processes.

The attachment file URLs can be obtained in the following format:

https://[GHE_HOSTNAME]/user-attachments/files/[FILE_ID]/[FILENAME]

What I Tried (And Failed)

Assuming that Personal Access Tokens (PAT) would enable authentication, I tried the following methods.

1. Using GitHub CLI (gh)

First, I attempted API access using the gh command.

# Try hitting the URL directly with gh api
gh api --method GET "https://[GHE_HOSTNAME]/user-attachments/files/12345678/sample.docx" > ~/Downloads/sample.docx
 
# Result: 404 Not Found
# gh: HTTP 404: Not Found (https://[GHE_HOSTNAME]/api/v3/user-attachments/files/12345678/sample.docx)

2. Using curl with PAT

Next, I tried sending a direct request with curl including the PAT in the Authorization header.

curl -H "Authorization: token [YOUR_PAT]" -L -o sample.docx "https://[GHE_HOSTNAME]/user-attachments/files/12345678/sample.docx"
 
# Result: 404 Not Found

Both methods resulted in 404 errors, and I couldn’t download the files. Unable to find clear answers in the documentation about whether PAT scopes were insufficient or if completely different API endpoints existed, I decided to contact GitHub Support.

Conclusion: API Download Is Currently Not Supported

I received a very clear response from Support. The conclusion is:

“Currently, downloading Issue attachments is not supported via API.”

The key points from Support’s response are as follows:

  • The Issue attachment feature does not support APIs.
  • Access control is tied to valid browser sessions.
  • Therefore, it does not support authentication methods used for API access such as Personal Access Tokens (PAT), OAuth Apps, or GitHub Apps.
  • As a result, file downloads can only be done manually through the browser UI.

Support’s response:

We apologize for the confusion caused. Currently, the API does not support the issue attachment feature, which means attachments cannot be added or retrieved programmatically. Instead, access control is tied to a valid browser session and does not support the use of Personal Access Tokens (PATs), OAuth Apps, or GitHub Apps, which are used for API access. As a result, downloading attachments is only possible through the browser interface.

We’ve received similar feedback regarding an attachment API endpoint and we’ve added your report as a +1 to the existing internal tracking Issue; however, we can’t say if or when new functionality may be available. At this point, we can only recommend that you keep an eye on the GitHub Blog and the Changelog for related updates. We understand this may be frustrating and wish we had better news to share, but we’re afraid we don’t at this time.

Summary

The attempt to automatically download files attached to GitHub Issues via API proved impossible due to specification constraints.

Similar feature requests have been made by many users, and GitHub is internally tracking this as a candidate for improvement. However, since the specific implementation timeline is undecided, we currently need to consider alternatives such as “manually downloading from the browser” or “managing files within Git repositories instead of as attachments.”

While hoping for future updates, it would be good to regularly check the GitHub Blog and Changelog.

I hope this saves at least one person from wasting time on the same issue.

That’s all from the Gemba.