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

# Update User Role

> Update another user's WorkOS membership role.

Two-phase write: the WorkOS membership is updated first (authoritative
source). On success, the local `users.role` display cache is mirrored.
On DB-mirror failure, structured logs flag the drift; the hourly
reconciliation worker will heal it on its next run.



## OpenAPI

````yaml /openapi.json patch /api/v1/shared/users/{user_id}/role
openapi: 3.1.0
info:
  title: Seamind Backend
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/shared/users/{user_id}/role:
    patch:
      tags:
        - shared-users
      summary: Update User Role
      description: |-
        Update another user's WorkOS membership role.

        Two-phase write: the WorkOS membership is updated first (authoritative
        source). On success, the local `users.role` display cache is mirrored.
        On DB-mirror failure, structured logs flag the drift; the hourly
        reconciliation worker will heal it on its next run.
      operationId: update_user_role_api_v1_shared_users__user_id__role_patch
      parameters:
        - name: user_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: User Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateUserRoleDTO'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserDetailDTO'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    UpdateUserRoleDTO:
      properties:
        role:
          type: string
          title: Role
          description: 'One of: admin, office-admin, office-employee, crew-member'
      type: object
      required:
        - role
      title: UpdateUserRoleDTO
      description: Payload for changing a user's role.
    UserDetailDTO:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        email:
          type: string
          title: Email
        firstName:
          type: string
          title: Firstname
        lastName:
          type: string
          title: Lastname
        role:
          type: string
          title: Role
        state:
          type: string
          title: State
        lastLogin:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Lastlogin
        createdAt:
          type: string
          format: date-time
          title: Createdat
      type: object
      required:
        - id
        - email
        - firstName
        - lastName
        - role
        - state
        - lastLogin
        - createdAt
      title: UserDetailDTO
      description: |-
        User info for admin view — hides technical fields.

        `role` is the cached WorkOS membership role, used purely to render the
        crew table. Never read it for authorization.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````