> For the complete documentation index, see [llms.txt](https://skyslit.gitbook.io/magicjs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://skyslit.gitbook.io/magicjs/api-references/backend/utils/unassignrolefromuser.md).

# unassignRoleFromUser()

This function, as its name suggests, is used to remove or unassign a specific role from a user within a system. In the provided code example, it appears that the function is used to remove the "ADMIN" role from a user.

> Here is an Example:

```typescript
import { createBackendFunction, utils } from "@magicjs.dev/backend"

export default createBackendFunction(
  async function (userId) {

    await utils.unassignRoleFromUser(String(userId), "ADMIN")
    return { message: "Role unassigned" }
  },
)
```

[Click here to refer GitHub.](https://github.com/skyslit/magicjs.dev/blob/main/packages/backend/src/utils.ts#L41)
