---
title: "Deactivate a user"
method: POST
path: "/admin/users/{userId}/deactivate"
tags: ["Admin"]
---

# Deactivate a user

`POST /admin/users/{userId}/deactivate`

## Request

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

Block a user from signing in and end all of their sessions. Their data stays. Requires the `users:disable` instance permission; API keys are rejected.

## Path parameters

- `userId` string, required

## Response `200`

The deactivated 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`: You can't deactivate yourself
- `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
- `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/deactivate/post.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)
