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

# Patch apiadminusers 

> GET / PATCH /api/admin/users/{id}/ — sysadmin-only user detail.

PATCH accepts ``is_active`` and ``is_system_admin``; every other field
is silently ignored. The last-active-sysadmin guard refuses any change
that would leave the system with zero active sysadmins.



## OpenAPI

````yaml /api-reference/openapi.yaml patch /api/admin/users/{id}/
openapi: 3.0.3
info:
  title: Console API
  version: 1.0.0
  description: Central control plane API for the Dataerai platform.
servers:
  - url: https://{server}
    description: Your Dataerai deployment (the API is served under /api)
    variables:
      server:
        default: your-deployment.dataerai.com
        description: Host of your Dataerai deployment
security: []
paths:
  /api/admin/users/{id}/:
    patch:
      tags:
        - api
      description: |-
        GET / PATCH /api/admin/users/{id}/ — sysadmin-only user detail.

        PATCH accepts ``is_active`` and ``is_system_admin``; every other field
        is silently ignored. The last-active-sysadmin guard refuses any change
        that would leave the system with zero active sysadmins.
      operationId: admin_users_update
      parameters:
        - in: path
          name: id
          schema:
            type: string
            format: uuid
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchedAdminUserPatch'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/PatchedAdminUserPatch'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/PatchedAdminUserPatch'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminUserDetail'
          description: ''
      security:
        - cookieAuthCsrfExempt: []
components:
  schemas:
    PatchedAdminUserPatch:
      type: object
      description: |-
        Only the two privilege flags are mutable through this surface; every
        other user field stays out of reach of sysadmin user-management.
      properties:
        is_active:
          type: boolean
        is_system_admin:
          type: boolean
    AdminUserDetail:
      type: object
      description: |-
        Resolve ``user.person`` once per serialization pass.

        ``user.person`` memoizes per instance, but distinct users in a list are
        distinct instances — so a list serializer would still issue one
        ``Person`` query per row. When used ``many=True`` this mixin routes
        through :class:`_PersonReadThroughListSerializer`, which calls
        ``User.attach_persons`` to batch the whole page into a single query;
        the per-render ``context`` cache below then dedups the name+email
        double-read for each user.

        The context cache lives only for the lifetime of the serializer tree,
        so one ``.data`` render resolves each distinct user's ``Person`` at
        most once and re-batches fresh on the next render.
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        email:
          type: string
          readOnly: true
        name:
          type: string
          readOnly: true
        is_active:
          type: boolean
          readOnly: true
          title: Active
          description: >-
            Designates whether this user should be treated as active. Unselect
            this instead of deleting accounts.
        is_system_admin:
          type: boolean
          readOnly: true
        organizations:
          type: array
          items:
            $ref: '#/components/schemas/AdminUserOrgMembership'
          readOnly: true
        date_joined:
          type: string
          format: date-time
          readOnly: true
        last_login:
          type: string
          format: date-time
          readOnly: true
          nullable: true
        is_last_active_sysadmin:
          type: boolean
          readOnly: true
      required:
        - date_joined
        - email
        - id
        - is_active
        - is_last_active_sysadmin
        - is_system_admin
        - last_login
        - name
        - organizations
    AdminUserOrgMembership:
      type: object
      description: |-
        The ``{id, name, role}`` tuple inside a user row's ``organizations``
        list — surfaced as a typed schema for frontend codegen.
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        role:
          $ref: '#/components/schemas/OrgMemberRoleEnum'
      required:
        - id
        - name
        - role
    OrgMemberRoleEnum:
      enum:
        - member
        - admin
      type: string
      description: |-
        * `member` - Member
        * `admin` - Admin

````