---
title: "Update user role"
method: PUT
path: "/authz2/v1/users/{user_id}"
tags: ["esper_cloud_api_User"]
---

# Update user role

`PUT /authz2/v1/users/{user_id}`

Updates the role, group assignments, and access scope for a specific user within the tenant.

Use this endpoint when a user's responsibilities change and their permissions need to be adjusted — including switching between fixed roles, scoping group access, or assigning a custom RBAC role via AuthZ Role User.

**About Update User Role**
This is the current, supported endpoint for modifying another user's role and access within Esper. It operates on the authn_user_id (UUID format), which is distinct from the integer id returned by GET /user/ — use GET /authn2/v1/users/ to retrieve the correct UUID. The request replaces the user's current role and group assignment in full; partial updates are not supported. Returns the updated User object on success.

**Key Fields / Request Body**

role — (required) the role to assign: Enterprise Admin, Viewer, Group Admin, Group Viewer, or AuthZ Role User

groups — (required) list of group UUIDs to scope access; can be empty if has_all_group_access is true or the role does not require group scoping

authz_role_id — UUID of the custom RBAC role; required when role is AuthZ Role User

has_all_group_access — set to true to grant access to all groups; required only for AuthZ Role User role type

can_factory_reset — whether the user should be permitted to factory reset devices

**Common Use Cases**

Promoting a Viewer to Enterprise Admin after a role change

Scoping a user to specific device groups by switching them to Group Admin or Group Viewer

Assigning a custom RBAC role for fine-grained permission control

Revoking broad access by narrowing a user's group list

**Best Practices**

Use GET /authn2/v1/users/ to retrieve the user's UUID (authn_user_id) before calling this endpoint — the integer id from GET /user/ will not work here

When setting role to AuthZ Role User, always provide both authz_role_id and either a populated groups list or has_all_group_access: true

Treat this as a full replacement of the user's role record — always include all intended group assignments in a single call rather than assuming previous values are preserved

**Workflow**

Call GET /authn2/v1/users/ to retrieve the target user's UUID (authn_user_id)

Determine the new role, group scope, and any custom RBAC role ID

PUT to this endpoint with the fully populated request body

Confirm the updated role and group assignments in the returned User object

## Path parameters

- `user_id` string, uuid, required

## Request body

- EsperCloudApiUpdateDifferentUserRequest
  - `authz_role_id` string, uuid
  - `can_factory_reset` boolean
  - `has_all_group_access` boolean
  - `groups` string[], required
  - `role` 'Shoonya Admin' | 'Enterprise Admin' | 'Enterprise User' | 'Viewer' | 'Group Admin' | 'Group Viewer' | 'AuthZ Role User', required

## Response `200`

User Updated Successfully

- EsperCloudApiUser
  - `id` integer
  - `username` string
  - `email` string, email
  - `first_name` string
  - `last_name` string
  - `full_name` string
  - `is_staff` boolean
  - `is_superuser` boolean
  - `is_active` boolean
  - `profile` EsperCloudApiUserProfile
    - `id` integer
    - `enterprise_user_id` string
    - `authn_user_id` string, uuid
    - `authn_connection_id` string, uuid
    - `authz_role_id` string, uuid
    - `role` 'Shoonya Admin' | 'Enterprise Admin' | 'Enterprise User' | 'Viewer' | 'Group Admin' | 'Group Viewer'
    - `enterprise` string, uuid
    - `is_customer` boolean
    - `is_endpoint_creator` boolean
    - `created_on` string, date-time
    - `updated_on` string, date-time
    - `setup_wizard_complete` boolean
    - `default_password_changed` boolean
    - `is_developer` boolean
    - `can_factory_reset` boolean
    - `groups` EsperCloudApiGroup[]
      - `id` string, uuid
      - `name` string
      - `path` string
      - `device_count` integer
  - `emm` EsperCloudApiEMM
    - `id` integer
    - `user` integer
    - `account_identifier` string
    - `account_type` string
    - `display_name` string
    - `google_user_id` string
    - `google_enterprise` integer
    - `is_active` boolean
    - `created_on` string, date-time
    - `updated_on` string, date-time
    - `authentication_token` EsperCloudApiAuthenticationToken
      - `id` integer
      - `token` string
      - `is_active` boolean
      - `updated_on` string, date-time
  - `last_login` string
  - `token` string
  - `has_emm` boolean
  - `is_email_verified` boolean

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden, no permission to perform this action.

---

[API](https://skmtc.net/esper/apis/esper-api-reference.md) · [All operations](https://skmtc.net/esper/apis/esper-api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/esper/esper-api-reference/versions/e1f64cbb488e/schema)
