Can't download confluence page attachments using API (HTTP 401)

We’ve been using the v2 API for quite some time to list and download Confluence page attachments.

Our code uses basic authentication (e.g: appends the Authorization header with {email:token} base64 encoding)

Listing page attachment works and returns information including a downloadLink.

Downloading this link started failing recently, although it worked perfectly before.

The URL we are constructing to download the actual attachment is:

https://our_instance.atlassian.net/wiki/download/attachments/{pageID}/{filename}?version=1&modificationDate=…&cacheVersion=1&api=v2

The same basic authorization header is added to this request.

The download request results in HTTP status code 401 (Unauthorized)

Again - this worked perfectly up until a few days ago. Trying to understand what changed and how we can solve it.

The access token we are using the is the “classic one”.

Hi LiorTal,

Atlassian announced they were deprecating the endpoint on January 15 and seem to finally be getting around to doing it.. https://developer.atlassian.com/cloud/confluence/changelog/#

Try this:

https://{our_instance}.atlassian.net/wiki/rest/api/content/{page_id}/child/attachment/{attachment_id}/download

You can use this to list the attachments for a page as well:
https://{our_instance}.atlassian.net/wiki/rest/api/content/{page_id}/child/attachment

Which library are you using to make the call? The Apache HTTP library changed it’s behavior recently (in version 4.5 I think) and will now remove manually added credentials when the call is being redirected, which happens when you call the download link.

Just ran into the same problem because I was using _links.download of an attachment. Why does the API still provide links to a removed endpoint?