Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


How to access Confluence use atlassian-python-api and a Personal Access Token

I can use the following for basic auth:

from atlassian import Confluence

confluence = Confluence(url='', username = 'myusername', password='mypassword')

This also works if I use an API token value instead of password.

How do I alter this to use a Personal Access Token (as created within Confluence) instead? I tried substituting that in for the password, but it gives an error.

Is there a further authentication step that I am missing? I have managed to do something similar in Jira, but the same approach does not work for Confluence. 

2 answers

1 accepted

1 vote
Answer accepted

I found a different approach:

import requests

response =, data=page_data_json, headers={'Authorization': f'Bearer {pat}',"Accept": "application/json",'Content-Type': 'application/json'})

if response.status_code == 200:
print("Child page created successfully")
print("Failed to create the child page. Status code:", response.status_code)

It is not quite as convenient as using the inbuilt Confluence function, but it seems to work. 

0 votes
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 20, 2023

Hi @nirabe Welcome to the Atlassian community.

Have you check the below document for how to use the PAT in Jira/Confluence instead of basic auth?

Below is the example of using PAT same way you need to modify to use in Python script


curl -H "Authorization: Bearer <yourToken>" https://{baseUrlOfYourInstance}/rest/api/content

Hi @Sagar and thanks for the prompt reply.

Yes, I had seen the link you shared. I cannot use cURL. There have been some suggestions of using requests instead.

I may go down this route, but it seems much more complicated than the approach for Jira, which is odd.

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events