Get SharePoint Role Definition ID's

What is Role Definition ID

In SharePoint we are all familiar with SharePoint Permission and Permission levels like Full Control, Edit, and Contribute etc. We use these permission levels to manage Site/List/item level accessibility. Sometimes we create custom permission for business requirements. These permissions are defined in the SharePoint with a unique id which is called “SharePoint Role Definition ID”.

Why it is needed

In general, role definition id's are not needed to provide permission to a user or group in a Site, List or a List Item. We can do it with OOB by clicking some steps. But when we try to set permission by using REST Calls, we can’t use the permission level’s name. Then we need these Role Definition IDs. As an example if we try to change a user’s/group’s permission with rest call, it will be as follows:
  1. <SiteAddress>/_api/web/lists/getbytitle(‘<ListTitle>’)/items(ListItemId)/roleassignments/addroleassignment(principalid='<Group/User’sPrincipleID>',roleDefId=<RoleDefinitionID>)  

How to get Role Definition ID

So, now the question that comes to mind is, how to get these permission levels assigned  an ID or SharePoint Role Definition Id. For most of the common permission levels, we can get the Role Definition Id from the internet easily. Here are some out of the box role definition names (Permission level) and their corresponding role definition IDs given below.
 Role Definition Name  Role Definition Id
 Full Control  1073741829
 Design  1073741828
 Edit  1073741830
 Contribute  1073741827
 Read  1073741826
 Limited Access  1073741825
 View Only  1073741924
But what about any custom permission level which is being created for some specific purpose in that site? Now step by step, we will walk through the process of how to get the SharePoint Custom Role Definition ID. To get the custom permission’s role definition ID we have to use rest call. And with this rest call we will also get the above out of the box role definition IDs.
Let’s create a custom permission in the site collection and get the role definition id for that as an example with the following steps.
  • First go to the site settings of the site collection.
  • Click on Site Permissions. For Modern sites, site permission option is available in the Settings option on the right corner of top menu bar as shown in the bellow image (fig 1).
Fig 1: Site Permissions in Site Settings 
  • Site permission window will open.
  • Click on the “Permission Levels” menu from the top menu as shown in the below image (Fig 2).
Fig 2: Permission Level Opttion in Site Permission Window 
  • Permission levels window will be opened as in the following image.
  • We can get all the permission levels for this site collection, both out of the box and custom ones. We can also change the permission details of this role definition.
Fig 3: Permission Level Window 
  • Now click on the “Add a permission Level” link as shown in the above image (fig 3).
  • This will open a new window to create new permission level as shown in the following image (fig 4).
Fig 4: New Permission Level Creation Page 
  • Now, provide your custom permission’s name in the text box.
  • We can provide a description for future understanding.
  • Now we have an option for selecting different types of permissions which are being categorized with “List Permissions”, “Site Permissions” and “Personal Permissions”.
  • We need to check the needed permission as shown in the image (fig 4).
  • Click in the “Create” button.
Fig 5: The Custom Permission has been created
  • Now our custom permission level “TestPermission” has been created as we can see in the above image.
  • Now, let’s get the role definition id of this custom permission level. To do that we have to call the rest api which we already discussed before.\
  • For me the REST API URL is as following,
  • This is a “GET” request. So we can request this url in our web browser. We will get the response in XML format where we can get all the Role Definitions and Role Definition ID.
  • For better visibility we can use any online XML beautification tools or XML (XML to JSON Converter). Here is the result I got:
FIg 6: Response of the Rest Call
  • We can find our custom permission level as well as out of the box permission level’s role definition id and other details here.
  • So, for our custom permission level “TestPermission”, the role definition id is “1073741928”.


So this is the way to find the SharePoint Role Definition ID’s. In recent days when SharePoint 2010 Workflows are going to be retired, we had to use SharePoint 2013 workflow or Microsoft power automation. In these procedures we need these Role Definition ID’s to set permission with REST Call. I hope this article will help. Happy Coding.