Update a user by email

This endpoint is only available to organization administrators.

PATCH https://cla.zulipchat.com/api/v1/users/{email}

Administrative endpoint to update the details of another user in the organization by their email address. Works the same way as PATCH /users/{user_id} but fetching the target user by their real email address.

The requester needs to have permission to view the target user's real email address, subject to the user's email address visibility setting. Otherwise, the dummy address of the format user{id}@{realm.host} needs be used. This follows the same rules as GET /users/{email}.

Changes: New in Zulip 10.0 (feature level 313).

Usage examples

curl -sSX PATCH https://cla.zulipchat.com/api/v1/users/hamlet@zulip.com \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY \
    --data-urlencode full_name=NewName \
    --data-urlencode role=400 \
    --data-urlencode 'profile_data=[{"id": 4, "value": "0"}, {"id": 5, "value": "1909-04-05"}]' \
    --data-urlencode new_email=username@example.com

Parameters

email string required in path

Example: "hamlet@zulip.com"

The email address of the user, specified following the same rules as GET /users/{email}.


full_name string optional

Example: "NewName"

The user's full name.

Changes: Removed unnecessary JSON-encoding of this parameter in Zulip 5.0 (feature level 106).


role integer optional

Example: 400

New role for the user. Roles are encoded as:

  • Organization owner: 100
  • Organization administrator: 200
  • Organization moderator: 300
  • Member: 400
  • Guest: 600

Only organization owners can add or remove the owner role.

The owner role cannot be removed from the only organization owner.

Changes: New in Zulip 3.0 (feature level 8), replacing the previous pair of is_admin and is_guest boolean parameters. Organization moderator role added in Zulip 4.0 (feature level 60).


profile_data (object)[] optional

Example: [{"id": 4, "value": "0"}, {"id": 5, "value": "1909-04-05"}]

A dictionary containing the updated custom profile field data for the user.


new_email string optional

Example: "username@example.com"

New email address for the user. Requires the user making the request to be an organization owner and additionally have the .can_change_user_emails special permission.

Changes: New in Zulip 10.0 (feature level 285).


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

A typical unsuccessful JSON response:

{
    "code": "BAD_REQUEST",
    "msg": "Guests cannot be organization administrators",
    "result": "error"
}