Hi @Eugene
When using a scoped token, you need to use a different api endpoint.
curl --request GET --url 'https://api.atlassian.com/ex/confluence/<your_cloud_id>/wiki/rest/api/audit' --user ''<your_email>:<scoped_api_token>'' --header 'Accept: application/json'
You can't use the main url of the instance.
Hi, Marc -Devoteam,
Thank you for your guidance on using the api.atlassian.com endpoint with Scoped API Tokens. Following your instructions, I was able to successfully read page content and metadata.
Working:
- Reading page content via `https://api.atlassian.com/ex/confluence/{cloudId}/wiki/rest/api/content/{pageId}` ✅
- Listing attachments via `https://api.atlassian.com/ex/confluence/{cloudId}/wiki/rest/api/content/{pageId}/child/attachment` ✅
- Getting attachment metadata (fileId, mediaType, etc.) ✅
Not Working:
- Downloading actual attachment files - returns 401 "Unauthorized; scope does not match"
---
What I've Tried:
1. Download via REST API v1 path:
GET https://api.atlassian.com/ex/confluence/{cloudId}/wiki/download/attachments/{pageId}/{filename} Response: 401 - {"code":401,"message":"Unauthorized; scope does not match"}
2. Download via REST API v2:
GET https://api.atlassian.com/ex/confluence/{cloudId}/wiki/api/v2/attachments/{attachmentId}/download Response: 401 - {"code":401,"message":"Unauthorized; scope does not match"}
3. Download via Media API with mediaToken:
GET https://api.media.atlassian.com/file/{fileId}/binary Authorization: Bearer {mediaToken from attachment response} Response: 401 - {"error":{"code":"ForbiddenError","title":"This resource requires authorization"}}
--
My Token Scopes:
I have enabled ALL available read scopes in both Classic and Granular tabs, including:
- `readonly:content.attachment:confluence` (Classic)
- `read:attachment:confluence` (Granular)
- All other `read:` scopes
Questions:
1. Is attachment file download supported with Scoped API Tokens?
2. If yes, what is the correct endpoint and required scope for downloading attachment binary content?
3. If no, is this a known limitation of Scoped API Tokens, or is there a planned feature to support this?
4. The error message "scope does not match" suggests a specific scope is required - what scope is needed for attachment downloads?
Thank you for your assistance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Eugene
Based on the API documentation your API calls are not correct.
API V1: https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-content---attachments/#api-wiki-rest-api-content-id-child-attachment-attachmentid-download-get "only gets a url to download the attachment"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The documentation for Confluence API v1 and Confluence API v2 do not seem to fully apply for calls to api.atlassian.com. I also use the 'api.atlassian.com/ex/confluence/<cloudId>/wiki/rest/api/content/<pageId>' format which I am not finding documented in https://developer.atlassian.com/cloud/confluence/rest/v1/intro or https://developer.atlassian.com/cloud/confluence/rest/v2.
Is there separate and/or updated documentation for api.atlassian.com Confluence calls?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
api.atlassian.net endpoint is of MCP/Forge, used with service account tokens, jira operations (alerting), etc..
It has the same options.
Not all API endpoints can be used with a service account or scoped token.
Mostly only API endpoints, specifically options need to be stated, it will show the header Granular and then the scopes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.