Regenerate a bot's API key

POST https://chat.zulip.org/api/v1/bots/{bot_id}/api_key/regenerate

Generate a new API key for a bot user. Only the bot's owner and organization administrators have access to a bot's API key.

Usage examples

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/bots/17/api_key/regenerate \
    -u EMAIL_ADDRESS:API_KEY

Parameters

bot_id integer required in path

Example: 17

The user ID of the target bot.


Response

Return values

  • api_key: string

    The new API key for the bot.

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": "hkA04ZYcqXKalvYMA8OeXSfzUOLrtbZv",
    "msg": "",
    "result": "success"
}

An example JSON response when the bot ID is invalid:

{
    "code": "BAD_REQUEST",
    "msg": "No such bot",
    "result": "error"
}