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

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to add or remove page restrictions Python



I couldn't find anywhere how I can add or remove page restrictions for user and group by using Python ?


It can be any API( xmlrpc or REST API), just help me to do that ?


potentially I just need to remove all permission for everybody and then add only for one user

2 answers

Hi Gurgen,

You can see the XMLRPC documentation for setting permissions here, specifically setContentPermissions:

If you search for some further XMLRPC examples, they shouldn't be too hard to find.

And in case someone is curious about the Cloud version, you can already set page permissions via REST:

Hi Stephen


Thank you very much.


Is there a way to do this by REST API ? seems that feature is in experimental API. I found one way, but that is still in 'experimental' s

PUT https://confluence/rest/experimental/content/<id>/restriction/byOperation/read/user?userName=billgates


So I am worried whether I can use xmlrpc deprecated method for customers. How long this is going to be supported in XMLRPC ?

0 votes
AnnWorley Atlassian Team Apr 26, 2018

Hi Gurgen,

I don't know how to remove restrictions using the Python with the REST API. Based on the Confluence REST API Documentation it looks like the API will let you GET the restrictions but does not provide a way to update them.

Please consider SQL as an alternative, as described in: How to remove all restrictions from a specific page via the database.



Thanks I have found that, but I don't need DB.


any suggestion, by using xmlrpc ? anyway ? if you provide me API I can write Python code myself. I need to do that in Python.

most prob you can update the permissions and that should remove whatever you needed.

you can omit the group or user if you don't require to update either one of them

url = '{id}/restriction'
headers = { "Accept": "application/json", "Content-Type": "application/json" }
payload = json.dumps( [
"operation": "update",
"restrictions": {
"user": [
{ "type": "known",
"username": "<string>",
"userKey": "<string>",
"accountId": "<string>"
"group": [
"type": "<string>",
"name": "<string>",
] )

r = requests.put( url, verify=False, data=payload, headers=headers, auth=(username, passwd) )

 Take a look at for reference...try to do a get permission on the page first to understand what kinda operation there not use administer as the operation...that's for cloud

This one doesn't work either. 

@fwoon @John_Huang  have you execute it successfully or not?

@Helen Song 

Yes i most definitely can. Just verified it on 7.4.1 Confluence Server.

Take note that this is a page restriction update, not space permission restriction.

Again to reiterate, make sure you know the group name if you are adding the group, if it's an individual, make sure you get the userKey, username, displayName. If you don't know, simply do a get on a page that has that user/group on the page restrictions

url = BASE_URL + pageId + PERM_URL
headers = { "X-Atlassian-Token": "nocheck" }
payload = {
"expand" : "update.restrictions.user,,read.restrictions.user,"
r = requests.get(url, verify=False, headers=headers, params=payload, auth=(username, passwd))

#Check for successful call
if r.status_code == 200:
print r.text

Thank you very much.

Do you know how to lock the page by groovy or REST API?

It looks like that is method of update read permission, is it possible to lock one page edit permission but keep all read permission as before?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

Announcing Team Calendars in Confluence Data Center

Hi Community! We're thrilled to share that Team Calendars for Confluence is now a built-in feature for Confluence Data Center releases 7.11 and beyond.  A long time favorite,  Team Cale...

177 views 0 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you