> ## Documentation Index
> Fetch the complete documentation index at: https://docs.claap.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Update user group

> Rename a user group, or add and remove members. At least one of "name", "addUserIds" or "removeUserIds" must be provided.

Renames a user group, or adds and removes members. A new name must not be used by another user group. Users are identified by the `id` returned by the [list users](/api-reference/endpoint/list_users) endpoint.

* All user identifiers are checked first: if one is not found, nothing is changed.
* Guests cannot be in user groups and are skipped.
* Removing a user who is not in the group does nothing.


## OpenAPI

````yaml PATCH /v1/user-groups/{userGroupId}
openapi: 3.1.0
info:
  title: Claap API
  description: Development documentation
  version: 0.0.0
servers:
  - url: https://api.claap.io/
security:
  - ApiKey: []
paths:
  /v1/user-groups/{userGroupId}:
    patch:
      description: >-
        Rename a user group, or add and remove members. At least one of "name",
        "addUserIds" or "removeUserIds" must be provided.
      operationId: patchV1UserGroupsByUserGroupId
      parameters:
        - in: path
          name: userGroupId
          schema:
            type: string
            description: User group identifier
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 100
                  description: >-
                    New user group name. It must not be used by another user
                    group of the workspace.
                addUserIds:
                  type: array
                  items:
                    type: string
                  maxItems: 50
                  description: >-
                    Identifiers of the users to add to the group. Guests cannot
                    be in groups and are skipped.
                removeUserIds:
                  type: array
                  items:
                    type: string
                  maxItems: 50
                  description: Identifiers of the users to remove from the group.
      responses:
        '200':
          description: User group was successfully updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: object
                    properties:
                      userGroup:
                        $ref: '#/components/schemas/ApiUserGroup'
                    required:
                      - userGroup
                required:
                  - result
        '400':
          description: >-
            The request is not valid. For instance nothing to update is
            provided, the name is longer than 100 characters or already used by
            another user group, more than 50 user identifiers are provided in
            "addUserIds" or "removeUserIds", or a user was not found. In that
            case the user group is left unchanged.
        '404':
          description: User group was not found.
components:
  schemas:
    ApiUserGroup:
      type: object
      properties:
        userGroupId:
          type: string
          description: User group identifier.
        name:
          type: string
          description: User group name.
        memberUserIds:
          type: array
          items:
            type: string
          description: Identifiers of the workspace users in the group.
      required:
        - userGroupId
        - name
        - memberUserIds
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-Claap-Key

````