---
title: "Update a user"
method: PATCH
path: "/admin/users/{userId}"
tags: ["Admin"]
---

# Update a user

`PATCH /admin/users/{userId}`

## Request

- Base URL: `https://cloud.kaneo.app/api`
- URL: `https://cloud.kaneo.app/api/admin/users/{userId}`
- Auth: HTTP bearer

Change a user's name, email, or instance role. A new email must be verified again. You can't change your own role or remove the last administrator. Requires the `users:update` instance permission; API keys are rejected.

## Path parameters

- `userId` string, required

## Request body

- object
  - `name` string
  - `email` string, email: A new address must be verified again. It can't belong to another user.
  - `role` string: Instance role: `admin` administers the instance, `user` has no instance permissions, or the name of a custom role. Only administrators can assign `admin`, and nobody can assign a role with permissions they don't have.

## Response `200`

The updated user

- AdminUser
  - `id` string, required
  - `name` string, required
  - `email` string, required
  - `emailVerified` boolean, required
  - `isAnonymous` boolean, required
  - `image` string, nullable, required
  - `createdAt` string, date-time, required
  - `updatedAt` string, date-time, required
  - `role` string, nullable, required
  - `banned` boolean, required
  - `banReason` string, nullable, required
  - `banExpires` string, date-time, nullable, required
  - `lastActiveAt` string, date-time, nullable, required: When one of the user's current sessions was last refreshed; null without a session.
  - `signInMethods` string[], required: Linked sign-in methods: `credential` (password), `github`, `google`, `discord`, or `custom` (OIDC).

## Other responses

- `400`: Invalid fields, an unknown role, your own role, or the last administrator
- `401`: Missing or invalid credentials
- `403`: The caller lacks the instance permission, the user has permissions the caller lacks, or the request used an API key
- `404`: User not found
- `409`: Another user has this email address
- `429`: The API key exceeded its rate limit or usage quota. Wait the number of seconds in Retry-After before retrying. The X-RateLimit headers are sent only when the rate limit was hit.

## Changes

- **2026-10-27** `8f3ec578c70a`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/usekaneo/apis/kaneo-api/changes/admin/users/:userId/patch.md)

---

[API](https://skmtc.dev/usekaneo/apis/kaneo-api.md) - [All operations](https://skmtc.dev/usekaneo/apis/kaneo-api/llms.txt) - [OpenAPI document](https://skmtc.dev/usekaneo/apis/kaneo-api/revisions/741a49dfb347?raw)
