---
title: "Update user information (admin only)"
method: PATCH
path: "/users/{user_id}"
tags: ["Users"]
---

# Update user information (admin only)

`PATCH /users/{user_id}`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/users/{user_id}`
- Auth: HTTP bearer

## Path parameters

- `user_id` integer, required

## Request body

- UpdateUserRequest: Body of `PATCH /users/{user_id}`. Unknown fields are rejected so a misspelt field is an error instead of a silent no-op.
  - `email` string, nullable
  - `name` string, nullable: Deprecated: the old name of `username`, still accepted. Sending both with different values is refused.
  - `username` string, nullable: The new username, as in `CreateUserRequest`.

## Response `200`

User updated successfully

- RouteUserWithRoles
  - `roles` RouteRole[], required
    - `created_at` string, date-time, required
    - `id` integer, required
    - `name` string, required
    - `updated_at` string, date-time, required
  - `user` RouteUser, required
    - `created_at` string, date-time, required
    - `deleted_at` string, date-time, nullable
    - `email` string, required
    - `email_verified` boolean, required
    - `id` integer, required
    - `image` string, required
    - `mfa_enabled` boolean, required
    - `must_change_password` boolean, required
    - `name` string, required
    - `updated_at` string, date-time, required
    - `username` string, required

## Other responses

- `400`: Invalid input
- `401`: Unauthorized
- `403`: Forbidden - Non-admin attempt
- `404`: User not found
- `500`: Internal server error

## Changes

- **2026-11-26** `e1864d950604`: 5 breaking
  - the `roles/items/created_at` response's property type changed from `integer` to `string`, and format from `int64` to `date-time` for status `200`
  - the `roles/items/updated_at` response's property type changed from `integer` to `string`, and format from `int64` to `date-time` for status `200`
  - the `user/created_at` response's property type changed from `integer` to `string`, and format from `int64` to `date-time` for status `200`
  - the `user/deleted_at` response's property type changed from `integer, null` to `string, null`, and format from `int64` to `date-time` for status `200`
  - …1 more
- **2026-11-26** `199b8052eb32`: 2 info
  - added the new optional request property `username`
  - request property `name` deprecated
- **2026-09-07** `5ab851bb63bf`: 1 info
  - added the required property `user/must_change_password` to the response with the `200` status
- **2026-09-07** `22543057a288`: 1 breaking
  - removed the required property `user/must_change_password` from the response with the `200` status
- **2026-09-07** `8be6c67df066`: 1 info
  - added the required property `user/must_change_password` to the response with the `200` status

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/users/:user_id/patch.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
