Regenerate your API key

POST https://chat.zulip.org/api/v1/users/me/api_key/regenerate

Note: Users should treat their Zulip API key as carefully as they would their password.

Generate a new API key for the user making the request.

Changing a user's API key will immediately log them out of Zulip on devices registered for mobile push notifications.

Usage examples

#!/usr/bin/env python3

import zulip

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

# Generate a new API key for the current user/bot.
result = client.call_endpoint(
    url="/users/me/api_key/regenerate",
    method="POST",
)
print(result)

The -u line implements HTTP Basic authentication. See the Authorization header documentation for how to get those credentials for Zulip users and bots.

curl -sSX POST https://chat.zulip.org/api/v1/users/me/api_key/regenerate \
    -u EMAIL_ADDRESS:API_KEY

Parameters

This endpoint does not accept any parameters.

Response

Return values

  • api_key: string

    The new API key for the user.

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:

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