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

# StackRoleMappings

## StackRoleMappings

The StackRoleMappings methods allows you to retrieve, add, update and delete users from a team.

## add

The add method adds an user to the team.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })
const addRole = {
stackApiKey: 'stackApiKey',
roles: ['role_uid']
}
client.organization('organizationUid').teams('teamUid').stackRoleMappings().add(addRole)
.then((response) => console.log(response))
```

## fetchAll

The fetchAll method allows you to fetch all details of the roles of that team.

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

client.organization('organizationUid').teams('teamUid').stackRoleMappings().fetchAll()
.then((response) => console.log(response))
```

## delete

The delete method deletes all roles of the stack.

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

client.organization('organization_uid').teams('teamUid').stackRoleMappings('stackApiKey').delete()
.then((response) => console.log(response)
```

## update

The update method is used to update the roles.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })
const updateRoles = {
roles: ['role_uid1', 'role_uid2']
}

client.organization('organizationUid').teams('teamUid').stackRoleMappings('stackApiKey').update(updateRoles)
.then((response) => console.log(response))
```

## StackRoleMappings | JavaScript Management SDK | Contentstack

StackRoleMappings lets you retrieve, add, update, and delete users from a team in the Contentstack JavaScript Management SDK.