Deactivate a user

This endpoint is only available to organization administrators.

DELETE https://zulip.shipyard.rs/api/v1/users/{user_id}

Deactivates a user given their user ID.

Usage examples

#!/usr/bin/env python

import zulip

# The user for this zuliprc file must be an organization administrator
client = zulip.Client(config_file="~/zuliprc-admin")

# Deactivate a user
user_id = 8
result = client.deactivate_user_by_id(user_id)
print(result)

curl -sSX DELETE https://zulip.shipyard.rs/api/v1/users/12 \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY \
    --data-urlencode 'deactivation_notification_comment=Farewell!
'

Parameters

user_id integer required in path

Example: 12

The target user's ID.


deactivation_notification_comment string optional

Example: "Farewell!\n"

If not null, requests that the deactivated user receive a notification email about their account deactivation.

If not "", encodes custom text written by the administrator to be included in the notification email.

Changes: New in Zulip 5.0 (feature level 135).


Response

Example response(s)

Changes: As of Zulip 7.0 (feature level 167), if any parameters sent in the request are not supported by this endpoint, a successful JSON response will include an ignored_parameters_unsupported array.

A typical successful JSON response may look like:

{
    "msg": "",
    "result": "success"
}

An example JSON error response when attempting to deactivate the only organization owner in an organization:

{
    "code": "BAD_REQUEST",
    "msg": "Cannot deactivate the only organization owner",
    "result": "error"
}