You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Users accessing Confluence Cloud via the OAuth2 API gateway (https://api.atlassian.com/ex/confluence/<tenant-id>) get a 401 Unauthorized; scope does not match error with the current Cloud defaults.
Root cause
The ConfluenceCloud client defaults to api_root="wiki/api/v2" and api_version="2". The Confluence v2 REST API requires a different OAuth scope set (read:content:confluence) compared to v1. Standard Atlassian API tokens (issued via id.atlassian.com) are scoped for the v1 REST API and fail against v2 endpoints.
GET https://api.atlassian.com/ex/confluence/<tenant-id>/wiki/api/v2/content
→ 401 Unauthorized; scope does not match
Workaround (currently required)
Pass api_root and api_version explicitly to force v1:
confluence=Confluence(
url="https://api.atlassian.com/ex/confluence/<tenant-id>",
username=email,
password=api_token,
cloud=True,
api_root="wiki/rest/api", # override default wiki/api/v2api_version="latest", # must match api_root
)
This is not discoverable and causes silent failures for new users.
Proposed fix
Auto-detect the appropriate api_root based on the URL when not explicitly set. For api.atlassian.com gateway URLs, fall back to wiki/rest/api (v1) since standard API tokens are issued for v1 scopes. Users with proper v2 OAuth app credentials can still override explicitly.
Alternatively, improve the error message to guide users toward the correct api_root setting when a 401 scope error is detected.
Description
Users accessing Confluence Cloud via the OAuth2 API gateway (
https://api.atlassian.com/ex/confluence/<tenant-id>) get a 401Unauthorized; scope does not matcherror with the current Cloud defaults.Root cause
The
ConfluenceCloudclient defaults toapi_root="wiki/api/v2"andapi_version="2". The Confluence v2 REST API requires a different OAuth scope set (read:content:confluence) compared to v1. Standard Atlassian API tokens (issued via id.atlassian.com) are scoped for the v1 REST API and fail against v2 endpoints.Workaround (currently required)
Pass
api_rootandapi_versionexplicitly to force v1:This is not discoverable and causes silent failures for new users.
Proposed fix
Auto-detect the appropriate
api_rootbased on the URL when not explicitly set. Forapi.atlassian.comgateway URLs, fall back towiki/rest/api(v1) since standard API tokens are issued for v1 scopes. Users with proper v2 OAuth app credentials can still override explicitly.Alternatively, improve the error message to guide users toward the correct
api_rootsetting when a 401 scope error is detected.Environment
api.atlassian.comOAuth2 gatewayRelated