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

# Role

## Role

A role is a collection of permissions that will be applicable to all the users who are assigned this role.

## create

The create role method adds a new role to your stack.

```
Example:

import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Roles roles = contentstack.stack().roles();
Call<ResponseBody> response = roles.create(requestBody).execute();
if (response.isSuccessful()) {
    System.out.println(response.body().string());
} else {
    System.out.println(response.errorBody().string());
}
```

The body should be of a JSONObject type

## addHeader

Sets header for the request.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Roles roles = contentstack.stack().roles();
roles.addHeader("key", value);
```

Header key for the request.

Header value for the request.

## addParam

Sets header for the request.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Roles roles = contentstack.stack().roles();
roles.addParam("key", value);
```

Query parameter key for the request.

Query parameter value for the request.

## delete

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

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Roles roles = contentstack.stack().roles();
Call<ResponseBody> response = roles.delete().execute();
if (response.isSuccessful) {
    System.out.println("Response" + response);
}
```

## fetch

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

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Roles roles = contentstack.stack().roles();
Call<ResponseBody> response = roles.fetch().execute();
if (response.isSuccessful) {
    System.out.println("Response" + response);
}
```

## find

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

You can add queries to extend the functionality of this API request.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Roles roles = contentstack.stack().roles();
Call<ResponseBody> response = roles.find().execute();
if (response.isSuccessful) {
    System.out.println("Response" + response);
}
```

## update

The "Update role" request lets you modify an existing role of your stack. However, the pre-existing system roles cannot be modified.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Roles roles = contentstack.stack().roles();
Call<ResponseBody> response = roles.update(requestBody).execute();
if (response.isSuccessful) {
    System.out.println("Response" + response);
}
```

The body should be of a JSONObject type.

## removeParam

Set header for the request.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Roles roles = contentstack.stack().roles();
roles.removeParam("key");
```

Removes query parameters using the key of the request.

## Role | Java Management SDK | Contentstack

Role defines a collection of permissions that applies to every user assigned to it, simplifying access control across your stack.