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

# Update a user (admin)

> Admin-only. Change a user's role and/or reset their password (back to first-login mode). The built-in `admin` user is locked to the admin role, and the last remaining admin cannot be demoted.



## OpenAPI

````yaml /openapi.yaml patch /api/v1/auth/users/{username}
openapi: 3.0.3
info:
  title: Datris API
  description: >
    REST API for the Datris AI Data Platform. Ingest, validate, transform,
    store, and retrieve data.


    For AI agent integration, use the [MCP
    Server](https://docs.datris.ai/mcp-server) instead.
  version: 1.11.3
  contact:
    name: Datris
    url: https://datris.ai
  license:
    name: Apache 2.0
servers:
  - url: http://localhost:8080
    description: Local development
security:
  - ApiKeyAuth: []
paths:
  /api/v1/auth/users/{username}:
    patch:
      tags:
        - Auth
      summary: Update a user (admin)
      description: >-
        Admin-only. Change a user's role and/or reset their password (back to
        first-login mode). The built-in `admin` user is locked to the admin
        role, and the last remaining admin cannot be demoted.
      parameters:
        - name: username
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                role:
                  type: string
                resetPassword:
                  type: boolean
                  description: >-
                    If true, clears the password so the user must set a new one
                    on next login
      responses:
        '200':
          description: User updated
        '400':
          description: Invalid role
        '404':
          description: User not found
        '409':
          description: Role change refused (built-in admin locked, or last admin)
        '500':
          description: Error
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Optional API key for authentication (enabled via application.yaml)

````