Deactivate own user

DELETE https://zulip.fairsharing.org/api/v1/users/me

Deactivates the current user's account. See also the administrative endpoint for deactivating another user.

This endpoint is primarily useful to Zulip clients providing a user settings UI.

Usage examples

#!/usr/bin/env python3

import zulip

# Pass the path to your zuliprc file here.
client = zulip.Client(config_file="~/zuliprc")

# Deactivate the account of the current user/bot.
result = client.call_endpoint(
    url="/users/me",
    method="DELETE",
)
print(result)

curl -sSX DELETE https://zulip.fairsharing.org/api/v1/users/me \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY

Parameters

This endpoint does not accept any parameters.

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"
}

If the current user is the only organization owner or only user in the organization, their account cannot be deactivated and an error response will be returned. The is_last_owner field in the error response indicates whether the user is the only owner (true) or the only user (false). The entity field in the error response is a internationalized string that notes if the current user is the only organization owner or the only user.

An example JSON error response when the current user is the only organization owner in the organization:

{
    "code": "CANNOT_DEACTIVATE_LAST_USER",
    "entity": "organization owner",
    "is_last_owner": true,
    "msg": "Cannot deactivate the only organization owner",
    "result": "error"
}