---
title: "Roles"
description: "Roles"
url: "https://www.contentstack.com/docs/developers/sdks/content-management-sdk/python/reference/roles"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-09-04"
---

# Roles

## Roles

A [role](/docs/headless-cms/types-of-roles) is a collection of permissions that will be applicable to all the users who are assigned this role.

## create

The create method adds a new role in your stack.

```
data = {
	"role": {
		"name": "testRole",
		"description": "This is a test role.",
		"rules": [
			{
				"module": "branch_alias",
				"branch_aliases": [
					"deploy"
				],
				"acl": {
					"read": true
				}
			},
			{
				"module": "content_type",
				"content_types": [
					"$all"
				],
				"acl": {
					"read": true,
					"sub_acl": {
						"read": true
					}
				}
			},
			{
				"module": "asset",
				"assets": [
					"$all"
				],
				"acl": {
					"read": true,
					"update": true,
					"publish": true,
					"delete": true
				}
			},
			{
				"module": "environment",
				"environments": [
					"$all"
				],
				"acl": {
					"read": true
				}
			},
			{
				"module": "taxonomy",
				"taxonomies": [
					"taxonomy_UID"
				],
				"terms": [
					"taxonomy_UID.term_UID"
				],
				"content_types": [
					{
						"uid": "$all",
						"acl": {}
					}
				]
			}
		]
	}
}
import contentstack_management 
client = contentstack_management.Client(authtoken='authtoken')
response = client.stack('api_key').roles().create(data).json()
```

Data required to create a new role

## delete

The delete method removes an existing role from a particular stack of your organization.

```
import contentstack_management 
client = contentstack_management.Client(authtoken='authtoken')
response = response = client.stack('api_key').roles('role_uid').delete().json()
```

UID of the role

## fetch

The fetch method retrieves the details of a specific role from the stack.

```
import contentstack_management 
client = contentstack_management.Client(authtoken='authtoken')
response = client.stack('api_key').roles('role_uid').fetch().json()
```

UID of the role

## find

The find method retrieves the details of all the environments in a particular stack.

```
import contentstack_management
client = contentstack_management.Client(authtoken='authtoken')
response = client.stack("api_key").roles().find().json()
```

## update

The update method allows you to make changes in the existing role of your stack.

```
data = {
       "role":{
           "name":"sampleRole",
           "description":"This is a test role.",
           "rules":[
           {
               "module":"branch",
               "branches":[
               "main"
               ],
               "acl":{
               "read":true
               }
           },
           {
               "module":"branch_alias",
               "branch_aliases":[
               "deploy"
               ],
               "acl":{
               "read":true
               }
           },
           {
               "module":"content_type",
               "content_types":[
               "$all"
               ],
               "acl":{
               "read":true,
               "sub_acl":{
                   "read":true
               }
               }
           },
           {
               "module":"asset",
               "assets":[
               "$all"
               ],
               "acl":{
               "read":true,
               "update":true,
               "publish":true,
               "delete":true
               }
           },
           {
               "module":"folder",
               "folders":[
               "$all"
               ],
               "acl":{
               "read":true,
               "update":true,
               "publish":true,
               "delete":true,
               "sub_acl":{
                   "read":true,
                   "update":true,
                   "publish":true,
                   "delete":true
               }
               }
           },
           {
               "module":"environment",
               "environments":[
               "$all"
               ],
               "acl":{
               "read":true
               }
           },
           {
               "module":"locale",
               "locales":[
               "$all"
               ],
               "acl":{
               "read":true
               }
           }
           ],
           "uid":"blt5a570885da41c710"
       }
       }
import contentstack_management 
client = contentstack_management.client(authtoken='your_authtoken')
response = client.stack('api_key').roles("role_uid").update(data).json()
```

The updated information for the role

## Roles | Python Management SDK | Contentstack

Roles are collections of permissions applied to the users assigned to them in the Contentstack Python Management SDK.