Not enough permissions to alter ContentRestrictions (Confluence via REST API)

I’ve got a Python script that is creating/updating pages on Confluence Cloud via the REST API. The account being used to perform the changes is a space admin.

I’m trying to extend the script so that it applies view restrictions to each page after it has been saved to Confluence. However, I am getting the error “Not enough permissions to alter ContentRestrictions” when I try to do this.

    body = [
        {
            "operation": "read",
            "restrictions": {
                "user": [
                    {
                        "type": "known",
                        "accountId": bot_id
                    }
                ],
                "group": [
                    {
                        "type": "group",
                        "name": "employees"
                    },
                    {
                        "type": "group",
                        "name": group_name
                    }
                ]
            }
        },
        {
            "operation": "update",
            "restrictions": {
                "user": [
                    {
                        "type": "known",
                        "accountId": bot_id
                    }
                ],
                "group": []
            }
        }
    ]

where bot_id is retrieved from GET /rest/api/user/current with the same authentication.

The weird thing is that if I do this using my own account credentials then it works but I’m struggling to find where I have more power/permissions than the bot account.

Thanks.

I haven’t checked your particular request object, but one thing that you might check is whether your account actually has the setpagepermissions permission. That one is required to set content restrictions. As far as I’m aware, the space admin permission does not imply any of the other space permissions.

Good catch, @candid!

That permission was indeed missing and adding it solved my problem.

Thank you very much.

1 Like