Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Python requests to Confluence Cloud Rest API: suddenly error 401 after years

Christoph
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 21, 2025

Hello,

For years, I’ve been accessing the Confluence Cloud using the Python module requests to automatically read pages. Authentication has always worked as follows:


import requests

session
= requests.Session()

session.trust_env = False
 


headers: dict = {

    "Authorization": "Basic Usermail:PasswordAsBase64String"

}

URL = "https://MYCOMPANY.atlassian.net/wiki/rest/masterdetail/1.0/detailssummary/lines?cql=label=produkt_spezifikation&spaceKey=TPOM&pageSize=1000&headings=Multilanguage-Bezeichner"

GETResponse = session.get(URL, headers=headers)

JSONResponse = json.loads(GETResponse.text)



Since I didn’t know what the issue was, I switched to token-based authentication. The call now looks like this, but it results in the same error:

import requests

from requests.auth import HTTPBasicAuth

 

URL = "https://MYCOMPANY.atlassian.net/wiki/rest/masterdetail/1.0/detailssummary/lines?cql=label=produkt_spezifikation&spaceKey=TPOM&pageSize=1000&headings=Multilanguage-Bezeichner"

GETResponse = session.get(URL, auth=HTTPBasicAuth(confluenceMail, confluenceToken))

JSONResponse = json.loads(GETResponse.text)
Something changed between October 16th at 4:00 PM and October 17th at 1:30 AM, and since then I haven’t been able to access the data.

When I open the URLs in a browser, the data is displayed correctly. However, Python fails to access the specific URLs. I can still access the homepage of our team space, which is:

https://MYCOMPANY.atlassian.net/wiki/spaces/TPOM/overview/rest/api/content/

But as soon as I try to access the masterdetail pages, I get a 401 error.


What can I do?

1 answer

0 votes
Sebastian Krzewiński
Community Champion
October 22, 2025

Hi @Christoph 

 

Please check if api token is valid and not expired.

 

Regards,

Seba

Christoph
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 22, 2025

Hello @Sebastian Krzewiński ,

thank you for your answer. Yes, I have a new token. It seems like the issue is related to the masterdetail. When I use the Atlassian Python module, I can access the data. Can anyone tell me how to get the master-detail working again? I not really want to modify our whole toolchain if not really necessary

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events