---
title: "Role"
description: "Role"
url: "https://www.contentstack.com/docs/developers/sdks/content-management-sdk/javascript/reference/role"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-06-08"
---

# Role

## Role

A [role](/docs/developers/invite-users-and-assign-roles/about-stack-roles) is a collection of permissions that will be applicable to all the users who are assigned this role.

## update

The Update role call lets you modify an existing role of your stack.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

client.stack({ api_key: 'api_key'}).role('role_uid')
.fetch({ include_rules: true, include_permissions: true})
.then((role) => {
 role.name = 'My New Role'
 role.description = 'Role description'
 role.rules = [
{
  module: 'asset',
  assets: ['$all'],
  acl: {
    read: true,
    create: true,
    update: true,
    publish: true,
    delete: true
  }
},
{
  module: 'environment',
  environments: [],
  acl: { read: true }
},
{
  module: 'locale',
  locales: [Array],
  acl: { read: true }
}]
 return role.update()
})
.then((role) => console.log(role))
```

## delete

The Delete role call deletes an existing role from your stack.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

client.stack({ api_key: 'api_key'}).role('role_uid').delete()
.then((response) => console.log(response.notice))
```

## create

The Create call creates a new role in a particular stack of your Contentstack account.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

const role = {
    "name": "Role Name",
    "description": "From CMA Js",
    "rules": [
        {
            "module": "environment",
            "environments": [],
            "acl": {
                "read": true
            }
        },
        {
            "module": "locale",
            "locales": [],
            "acl": {
                "read": true
            }
        },
        {
            "module": "taxonomy",
            "taxonomies": [
                "taxonomy_UID"
            ],
            "terms": [
                "taxonomy_UID.term_UID"
            ],
            "content_types": [
                {
                    "uid": "$all",
                    "acl": {}
                }
            ]
        }
    ]
}

client.stack({ api_key: 'api_key'}).role()
.create({ role })
.then((role) => console.log(role))
```

The role details with name, description and rules to be created.

## fetch

The Get a single role request returns comprehensive information on a specific role.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

client.stack({ api_key: 'api_key'}).role('role_uid').fetch()
.then((role) => console.log(role))
```

## fetchAll

The ‘Get all roles’ request returns comprehensive information about all roles created in a stack.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

client.stack({ api_key: 'api_key'}).role()
.fetchAll()
.then((role) => console.log(role))
```

The \`include\_count’ parameter includes the count of total number of role in your stack, along with the details of each role.

Set this parameter to 'true' to include the details of the permissions assigned to a particular role.

The ‘limit’ parameter will return a specific number of role in the output.

The ‘skip’ parameter will skip a specific number of role in the response.

## query

The Query on Role will allow to fetch details of all or specific role.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

client.stack({ api_key: 'api_key'}).role()
.query({ query: { filename: 'Asset Name' } })
.find()
.then((role) => console.log(role))
```

The \`include\_count’ parameter includes the count of total number of role in your stack, along with the details of each role.

Set this parameter to 'true' to include the details of the permissions assigned to a particular role.

The ‘limit’ parameter will return a specific number of role in the output.

The ‘skip’ parameter will skip a specific number of role in the response.

## Role | JavaScript Management SDK | Contentstack

Role is a collection of permissions applied to all users assigned that role in the Contentstack JavaScript Management SDK.