There’s a great deal of information on the internet about managing Confluence Space permissions with scripts, and how there’s no REST endpoint for it, and how it’s basically impossible.

This is incorrect.

There’s also a lot of information about using the JSONRPC or XMLRPC APIs to accomplish this.   These APIs are only available on Server/DC. In the Cloud they effectively don’t exist, so this is yet more misinformation.

So why all the confusion?

There’s a lot of outdated information out there that floats around and doesn’t disappear even after it stops being correct or relevant. This is one of the major struggles I had when I started learning how to write scripts to interact with Jira and Confluence.    Much of the information used to be relevant, but five or six or ten years later it only serves to distract people looking for a solution. That’s one of the major reasons I started this blog in the first place.

Specific to this instance, another reason for confusion is that the documentation for the REST API does outline an endpoint for Confluence Space permission management, but it includes some very strict limitations that could easily be misinterpreted.

The limitation is this: the API endpoint cannot be used by apps. Any apps.  Including ScriptRunner.  The only way to make use of this API endpoint is to call it from an external script or tool.  So in this case, neither Groovy nor ScriptRunner is applicable.

How you actually address this limitation is up to you.  Below is a very simple Python script that sets permissions on a Confluence Cloud Space. 


Before you try to run this script, I strongly recommend reading the following:
1. The documentation for authenticating with Atlassian’s REST API
2. The API endpoint documentation


import requests
import json
headers = {
    'Authorization': 'Basic <Base 64-encoded username and API Token>',
    'Content-Type': 'application/json',
    'Accept': 'application/json',
data = data=json.dumps({
  "subject": {
    "type": "user",
    "identifier": "<user ID>"
  "operation": {
    "key": "read",
    "target": "space"
  "_links": {}
response ='https://<confluence URL><space key>/permission', headers=headers, data=data)



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>