Download Confluence content attachment via REST API get 404 error

I am using a REST API to get attachments from my Confluence page, then click on the download link, but get a 404 error. Can someone help me resolve this issue?

Welcome to the Atlassian developer community @DatTran,

Short answer, you are missing wiki from the URL path.

Longer answer is that URL construction gets a little confusing in the API documentation. In v1, all the paths start with /wiki. In v2, the paths skip the prefix of /wiki/api/v2/. But let’s follow the expectations. Your client can get the system info using GET For me, that returns:

	"cloudId": "c68adbe0-2b09-4add-b08e-eb5797b31bc9",
	"commitHash": "9b355f7d38446d169d08973b2e45d2a02d633e38",
	"baseUrl": "",
	"edition": "premium",
	"siteTitle": "Confluence",
	"defaultLocale": "en_GB",
	"defaultTimeZone": "America/Chicago"

Here we see that Confluence understands it’s own baseUrl is (which includes the wiki path). Regardless of the documentation confusion, relative paths provided in the API are relative to this base URL. For example, your client can get attachments using GET /api/v2/attachments to find a relative path as downloadLink. Just append that path to the base URL.


Thank you so much, I resolved the issue successfully by adding wiki path

1 Like