> ## 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

> Update a workspace user: change their role, or suspend or reactivate them. Exactly one of "role" or "state" must be provided.

Changes the role of a user, or suspends or reactivates them. Provide exactly one of `role` or `state`.

* Changing the state resets the role of a member to Member, and their license to the default of the workspace, usually Basic.
* The last admin of the workspace cannot be demoted or suspended.


## OpenAPI

````yaml PATCH /v1/users/{userId}
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/users/{userId}:
    patch:
      description: >-
        Update a workspace user: change their role, or suspend or reactivate
        them. Exactly one of "role" or "state" must be provided.
      operationId: patchV1UsersByUserId
      parameters:
        - in: path
          name: userId
          schema:
            type: string
            description: User identifier
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                role:
                  type: string
                  enum:
                    - Member
                    - Admin
                    - Owner
                  description: >-
                    New role of the user. A guest given one of these roles
                    becomes a member and gets the default license of the
                    workspace, usually Basic.
                state:
                  type: string
                  enum:
                    - Active
                    - Suspended
                  description: >-
                    Suspend or reactivate the user. Changing the state resets
                    the role of a member to Member, and their license to the
                    default of the workspace, usually Basic.
            example:
              role: Admin
      responses:
        '200':
          description: User was successfully updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: object
                    properties:
                      user:
                        $ref: '#/components/schemas/ApiWorkspaceUser'
                    required:
                      - user
                required:
                  - result
              example:
                result:
                  user:
                    email: jane.doe@example.com
                    id: Xk2Rd7Mv4Bn9Ts1Lq6Wf3
                    isDesktopAppInstalled: true
                    isMobileAppInstalled: false
                    license: Pro
                    name: Jane Doe
                    role: Admin
                    state: Active
        '400':
          description: >-
            The request is not valid. For instance both or none of "role" and
            "state" are provided.
        '403':
          description: >-
            The change is not allowed. For instance the user is the last admin,
            the user is not active and their role cannot be changed, the
            workspace has no active subscription and the role is not Owner, the
            license quota is exceeded, or user editing is restricted by SCIM
            provisioning.
        '404':
          description: User was not found.
components:
  schemas:
    ApiWorkspaceUser:
      type: object
      properties:
        email:
          type: string
          description: User email.
        id:
          type: string
          description: User identifier, scoped to the workspace.
        isDesktopAppInstalled:
          type: boolean
          description: >-
            Whether the user has signed in to the desktop app, absent when
            unknown.
        isMobileAppInstalled:
          type: boolean
          description: >-
            Whether the user has signed in to the mobile app, absent when
            unknown.
        license:
          type: string
          enum:
            - None
            - Basic
            - Pro
            - Business
          description: User license.
        name:
          type: string
          description: User full name.
        role:
          type: string
          enum:
            - Owner
            - Admin
            - Member
            - Guest
            - None
          description: User role in the workspace.
        state:
          type: string
          enum:
            - Active
            - Deleted
            - Gone
            - Suspended
          description: User state in the workspace.
      required:
        - email
        - id
        - license
        - name
        - role
        - state
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-Claap-Key

````