How to Create a SharePoint Permission Level with the REST API in Power Automate
SharePoint has no flow action that creates a permission level, but its REST API does: one POST to the site's role definitions, with the level's name, description and permissions. A flow can look for the level first, so it's created once however often the flow runs.
Syntax
Both requests go through Send an HTTP request to SharePoint (How to Use Send an HTTP Request to SharePoint), with the header Accept: application/json;odata=nometadata. A permission level is a role definition in the REST API.
Look for the level
| Field | Value |
|---|---|
| Method | GET |
| Uri | _api/web/roledefinitions?$filter=Name eq '<level name>'&$select=Id |
The answer's value array holds the level's ID when it exists, and is empty when it doesn't.
Create the level
| Field | Value |
|---|---|
| Method | POST |
| Uri | _api/web/roledefinitions |
| Headers | Content-Type: application/json;odata=verbose, as well as Accept |
{
"__metadata": { "type": "SP.RoleDefinition" },
"Name": "<level name>",
"Description": "<description>",
"BasePermissions": {
"__metadata": { "type": "SP.BasePermissions" },
"High": "<high>",
"Low": "<low>"
}
}
<level name>: the name people see on the site's Permission Levels page.<description>: the text shown next to the name on that page.<high>and<low>: the level's permissions, written as two numbers. The next section shows how to work them out.
Microsoft's Users, groups, and roles REST API reference gives this body under RoleDefinitionCollection, with an Order as well. I left Order out: SharePoint then gave the level the order 2147483647, the same order it gave a level created by hand on the Permission Levels page, and listed it last on that page.
How High and Low Work
Every permission has a number in Microsoft's PermissionKind list: View Items is 1, Add Items is 2, Edit Items is 3, and so on up to 41, with two special ones above that. Microsoft's SPBasePermissions says the permissions are flags that allow a bitwise combination of its member values: each permission is one bit, and a level is all its bits added together.
The REST API sends those bits as two numbers. Microsoft's reference doesn't say how they're split, so I worked it out from the PermissionKind numbers and checked it against SharePoint's own levels:
- Permissions 1 to 32 are in
Low. Permission n adds 2 to the power of (n − 1). - Permissions 33 to 64 are in
High. Permission n adds 2 to the power of (n − 33).
Decoding the numbers of Read, Contribute, Edit and Design this way gives exactly the permissions Microsoft lists for each of those levels in User permissions and permission levels.
You don't need to add up every bit by hand. Start from a built-in level that's close, read its two numbers in the browser (How to See a SharePoint Permission Level's Permissions in the Browser), and add or take away the permissions that differ. These are the list permissions, all in Low:
| Permission | PermissionKind | Adds to Low |
|---|---|---|
| View Items | 1 | 1 |
| Add Items | 2 | 2 |
| Edit Items | 3 | 4 |
| Delete Items | 4 | 8 |
| Approve Items | 5 | 16 |
| Open Items | 6 | 32 |
| View Versions | 7 | 64 |
| Delete Versions | 8 | 128 |
| Manage Lists | 12 | 2048 |
For example, Read is High 176 and Low 138612833. Read plus Add Items is High 176 and Low 138612833 + 2 = 138612835.
The Example
A level called Read and Add lets people see and add items, but not edit or delete them: Read plus Add Items. It's created on the root site contoso.sharepoint.com. The flow, Create a Permission Level, has four parts:
- Manually trigger a flow (How to Create an Instant Cloud Flow Inside a Solution in Power Automate).
- Find the permission level, the GET.
- If the permission level is missing, a condition.
- Create the permission level, the POST, in the condition's True branch.
Prerequisites
- Full Control of the site for the account the flow's SharePoint connection uses. Creating permission levels needs the Manage Permissions permission, which only Full Control includes by default.
Step 1: Look for the Level
Add Send an HTTP request to SharePoint and rename it Find the permission level:
| Field | Value |
|---|---|
| Site Address | Your site |
| Method | GET |
| Uri | _api/web/roledefinitions?$filter=Name eq 'Read and Add'&$select=Id |
| Headers | Accept: application/json;odata=nometadata |

Step 2: Check the Answer
Add a Condition called If the permission level is missing (How to Add a Condition in Power Automate). On the left, add this expression (How to Add an Expression in Power Automate); choose is equal to; on the right, add the expression true:
empty(body('Find_the_permission_level')?['value'])
body('Find_the_permission_level') is the answer of the GET, ?['value'] is its list of matching levels, and empty() is true when that list has nothing in it. In expressions, an action is named with underscores for its spaces.
Step 3: Create the Level
In the True branch, add Create the permission level:
| Field | Value |
|---|---|
| Site Address | Your site |
| Method | POST |
| Uri | _api/web/roledefinitions |
| Headers | Accept: application/json;odata=nometadata |
Content-Type: application/json;odata=verbose |
{
"__metadata": { "type": "SP.RoleDefinition" },
"Name": "Read and Add",
"Description": "Can view and add list items, but not edit or delete them.",
"BasePermissions": {
"__metadata": { "type": "SP.BasePermissions" },
"High": "176",
"Low": "138612835"
}
}

Step 4: Run the Flow
Save the flow and test it manually (How to Test a Cloud Flow Manually in Power Automate). The level didn't exist yet, so the condition was true and Create the permission level ran:

When the level already exists, Find the permission level returns its ID, the condition is false, and nothing is created.
The Result
Site settings > Site permissions > Permission Levels lists Read and Add with its description:

Selecting it shows its permissions. In List Permissions, Add Items is ticked along with Read's View Items, Open Items, View Versions, Create Alerts and View Application Pages, while Edit Items and Delete Items are not:

I left that page with the browser's Back button, without saving anything.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
| Creating without looking first | Every run tries to create the level again | Look for the level and create it only when it's missing |
Working out Low from scratch | One wrong bit gives the level a permission you didn't mean | Start from a built-in level's numbers and add or take away |
Leaving out the __metadata lines | SharePoint can't tell what the body describes | Keep both type lines |
| Running the flow with an account that isn't a site owner | SharePoint refuses the POST, because creating levels needs Manage Permissions | Use an account with Full Control of the site |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Create the permission level fails with Invalid JSON | The body isn't valid JSON | Check the quotes and commas, as in Fixed: "Invalid JSON. A Token Was Not Recognized in the JSON Content" |
| An access-denied error | The connection's account can't manage permissions | Use an account with Full Control |
| The level is created again on every run | The name in $filter doesn't match the name in the body | Use exactly the same name in both |
| The level has the wrong permissions | High or Low is off | Compare its permissions page with what you meant, and recalculate |
FAQ
Can I change a level's permissions later?
Yes, on its page under Permission Levels, as in How to Create a Custom Permission Level in SharePoint. The flow doesn't change a level that already exists, because it only creates one when the name is missing.
Why are the numbers strings in the body?
Microsoft's reference writes them as strings, 'High': '176', and SharePoint accepted them that way, so the example does the same.
How do I make a level without delete?
Take Delete Items (8) and Delete Versions (128) away from Contribute: Low 1011028719 − 136 = 1011028583, with High 432. That's the Contribute Without Delete level the Overtime Timesheet setup flow creates.
Does this need a premium licence?
No. Send an HTTP request to SharePoint is part of the standard SharePoint connector.
Conclusion
Look for the level with _api/web/roledefinitions?$filter=Name eq '<level name>', and when the value array is empty, POST an SP.RoleDefinition to _api/web/roledefinitions with its name, description and BasePermissions. Start from a built-in level's High and Low and add each permission's value, such as 2 for Add Items.
Additional Resources
- Users, groups, and roles REST API reference: the role definition requests.
- PermissionKind enum: every permission's number.
- User permissions and permission levels: what each built-in level includes.
