Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Download attachment from Confluence with OAuth 2.0

Karol Leszczyński April 23, 2025

Hi,

I'm using OAuth 2.0 to login users to Confluence. I want to get content of pages with attachments.

To get attachments info i use this method:
https://api.atlassian.com/ex/confluence/{cloud_id}/wiki/rest/api/content/{content_id}/child/attachment

response is like this:

"_links": {
"webui": "/pages/viewpageattachments.action?pageId=xxx&preview=zzz",
"self": "https://aaa.atlassian.net/wiki/rest/api/content/ccc",
"download": "/download/attachments/{attachments_id}/{file_name}?version=1&modificat

ionDate=1744797121672&cacheVersion=1&api=v2"
}

I trying to use this download url and construct API call but nothing is working. I tried multiple prefixes like https://api.atlassian.com or myconflience.atlassian.com and non of them are working. I'm can find multiple post from 2021 from people claiming they also have problems with it but i'm not sure it was fixed.

regards

1 answer

Karol Leszczyński April 24, 2025

https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-content---attachments/#api-wiki-rest-api-content-id-child-attachment-get 

 

Method you provided do not allow to download attachment, it only returns metadata.   

Marek Bujak
Contributor
April 25, 2025

You are right. I thought it was the method you were using to get the attachments. Not sure if that will help you, but I've seen that using "https://yourdomain.atlassian.net/wiki" before download link, starts downloading in browser straight away. Not sure how it's going to behave while running from script.

https://yourdomain.atlassian.net/wiki/download/attachments/{attachments_id}/{file_name}?version=1&modificationDate=1744797121672&cacheVersion=1&api=v2"

Karol Leszczyński April 27, 2025

https://yourdomain.atlassian.net/wiki/download/attachments/{attachments_id}/{file_name}?version=1&modificationDate=1744797121672&cacheVersion=1&api=v2"

 

In Postman call this return me login page in html even if i attached Access token. 

When i tried this link in browser it went in to some infinite look of redirects. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events