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

# Deactivate User

> Remove a user from your Langdock workspace while preserving their data

<Info>
  **⚠️ Using our API via a dedicated deployment?** Just replace `api.langdock.com` with your deployment's base URL: **`<deployment-url>/api/public`**
</Info>

This endpoint removes a user from your workspace. Their data — including conversations, assistants, files, and integrations — is preserved and fully restored if they are re-added later.

## Prerequisites

* **API Key** with the `USER_MANAGEMENT_API` scope
* The API key must be created by a workspace admin

## Behavior

* **User not found or not an active member?** Returns `404`.
* Deactivated users lose workspace access immediately.
* All user data is retained and accessible again upon reactivation.

<Info>
  Langdock intentionally blocks browser-origin requests to protect your API key and ensure your applications remain secure. For more information, please see our guide on [API Key Best Practices](/en/admin/ai-adoption-and-rollout/best-practices/api-key-best-practices).
</Info>


## OpenAPI

````yaml POST /user-management/v1/deactivate-user
openapi: 3.0.0
info:
  title: Langdock API
  version: 3.0.0
servers:
  - url: https://api.langdock.com
security:
  - bearerAuth: []
paths:
  /user-management/v1/deactivate-user:
    post:
      tags:
        - User Management
      summary: Deactivate a workspace user
      description: >
        Removes a user from the workspace by email. The user immediately loses
        access,

        but all their data (conversations, assistants, files, integrations) is
        preserved

        and restored if they are re-added later.
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserEmailRequest'
            examples:
              deactivate_user:
                summary: Deactivate a user
                value:
                  email: user@example.com
      responses:
        '200':
          description: User deactivated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserManagementResponse'
              examples:
                success:
                  summary: User deactivated
                  value:
                    status: success
                    message: User deactivated
        '401':
          description: >-
            Unauthorized - API key is missing, invalid, or the key creator was
            not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserManagementError'
        '404':
          description: User not found or not an active member
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserManagementError'
              examples:
                not_found:
                  summary: User not found
                  value:
                    message: User not found or not an active member
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserManagementError'
components:
  schemas:
    UserEmailRequest:
      type: object
      required:
        - email
      properties:
        email:
          type: string
          format: email
          description: Email address of the user
          example: user@example.com
    UserManagementResponse:
      type: object
      properties:
        status:
          type: string
          enum:
            - success
          description: Always "success" when the request is processed
          example: success
        message:
          type: string
          description: Human-readable summary of the result
          example: User deactivated
      required:
        - status
        - message
    UserManagementError:
      type: object
      properties:
        message:
          type: string
          description: Error message
          example: User not found or not an active member
      required:
        - message
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: API key as Bearer token. Format "Bearer YOUR_API_KEY"

````