Describe the bug
confluence attachments <pageId> --download always fails with Error: Request failed with status code 404, even though listing attachments on the same page (without --download) works correctly. Adding --pattern does not help. This happens on Atlassian Cloud.
I traced the root cause to the download URL construction: the Cloud /download/attachments/<pageId>/<filename> endpoint requires the query parameters version, modificationDate, and cacheVersion, which are returned inside each attachment's _links.download field from /wiki/rest/api/content/<pageId>/child/attachment. It looks like the CLI is either omitting or mis-constructing these parameters when building the download request, so the server rejects it with 404.
To Reproduce
Steps to reproduce (against Atlassian Cloud):
- Pick any Confluence Cloud page that has at least one attachment. Example page ID:
123456789.
- List attachments — this works fine:
confluence attachments 123456789
# Found 1 attachment:
# 1. example.png (ID: att987654321)
# Type: image/png • Size: 387 KB • Version: 1
- Try to download the same attachment:
confluence attachments 123456789 --download --dest /tmp/conf-test
# Error: Request failed with status code 404
- Narrowing with
--pattern reproduces the same failure:
confluence attachments 123456789 --pattern "*.png" --download --dest /tmp/conf-test
# Error: Request failed with status code 404
- Calling the REST API directly with the same credentials succeeds, proving the auth and permissions are fine — the issue is the URL the CLI sends:
curl -sL -u "$EMAIL:$TOKEN" \
"https://example.atlassian.net/wiki/rest/api/content/123456789/child/attachment" \
| jq -r '.results[]._links.download'
# /download/attachments/123456789/example.png?version=1&modificationDate=1700000000000&cacheVersion=1&api=v2
curl -sL -u "$EMAIL:$TOKEN" \
-o /tmp/conf-test/example.png \
"https://example.atlassian.net/wiki/download/attachments/123456789/example.png?version=1&modificationDate=1700000000000&cacheVersion=1&api=v2"
# → downloads a valid PNG
Dropping any of version / modificationDate / cacheVersion from that URL causes the server to return 404, which matches the CLI's observed behavior.
Expected behavior
confluence attachments <pageId> --download --dest <dir> should download every attachment on the page to <dir>, using the full download URL (including version, modificationDate, and cacheVersion query parameters) from each attachment's _links.download field.
Screenshots
Not applicable — this is a CLI-only failure.
Environment (please complete the following information):
- OS: macOS 26.4.1 (darwin 25.4.0, arm64)
- Node.js version: v25.9.0
- confluence-cli version: 1.29.0
- Confluence version: Cloud (
*.atlassian.net)
- Auth: basic (email + API token), via
~/.confluence-cli/config.json profile
Additional context
- Listing attachments via the CLI works — only
--download is broken, so the bug is isolated to the download path / URL construction, not auth or page resolution.
- Reproduced on multiple Atlassian Cloud sites.
- Suggested fix: when downloading, use the
_links.download value returned by /rest/api/content/<pageId>/child/attachment verbatim, prefixed with the instance base URL (https://<domain>/wiki), instead of rebuilding the path from the attachment ID or title alone. The query string returned by the API already contains all the parameters the Cloud download endpoint requires.
- Workaround I'm currently using: bypass the CLI and call the REST API +
curl -u "$EMAIL:$TOKEN" directly with the full _links.download URL. That works reliably.
Error logs
$ confluence attachments 123456789 --download --dest /tmp/conf-test
Error: Request failed with status code 404
$ confluence attachments 123456789 --pattern "*.png" --download --dest /tmp/conf-test
Error: Request failed with status code 404
Only the message above is emitted — no stack trace is shown by the CLI. If there's a verbose/debug flag that would give a full stack, let me know and I'll re-run and attach it.
Describe the bug
confluence attachments <pageId> --downloadalways fails withError: Request failed with status code 404, even though listing attachments on the same page (without--download) works correctly. Adding--patterndoes not help. This happens on Atlassian Cloud.I traced the root cause to the download URL construction: the Cloud
/download/attachments/<pageId>/<filename>endpoint requires the query parametersversion,modificationDate, andcacheVersion, which are returned inside each attachment's_links.downloadfield from/wiki/rest/api/content/<pageId>/child/attachment. It looks like the CLI is either omitting or mis-constructing these parameters when building the download request, so the server rejects it with 404.To Reproduce
Steps to reproduce (against Atlassian Cloud):
123456789.confluence attachments 123456789 --download --dest /tmp/conf-test # Error: Request failed with status code 404--patternreproduces the same failure:version/modificationDate/cacheVersionfrom that URL causes the server to return 404, which matches the CLI's observed behavior.Expected behavior
confluence attachments <pageId> --download --dest <dir>should download every attachment on the page to<dir>, using the full download URL (includingversion,modificationDate, andcacheVersionquery parameters) from each attachment's_links.downloadfield.Screenshots
Not applicable — this is a CLI-only failure.
Environment (please complete the following information):
*.atlassian.net)~/.confluence-cli/config.jsonprofileAdditional context
--downloadis broken, so the bug is isolated to the download path / URL construction, not auth or page resolution._links.downloadvalue returned by/rest/api/content/<pageId>/child/attachmentverbatim, prefixed with the instance base URL (https://<domain>/wiki), instead of rebuilding the path from the attachment ID or title alone. The query string returned by the API already contains all the parameters the Cloud download endpoint requires.curl -u "$EMAIL:$TOKEN"directly with the full_links.downloadURL. That works reliably.Error logs
Only the message above is emitted — no stack trace is shown by the CLI. If there's a verbose/debug flag that would give a full stack, let me know and I'll re-run and attach it.