Update a user
This endpoint is only available to organization administrators.
Administrative endpoint to update the details of another user in the organization.
PATCH https://zulip.dioco.io/api/v1/users/{user_id}
Supports everything an administrator can do to edit details of another
user's account, including editing full name,
role, and custom profile
fields.
Usage examples
#!/usr/bin/env python3
import zulip
# Pass the path to your zuliprc file here.
client = zulip.Client(config_file="~/zuliprc")
# Change a user's full name.
user_id = 10
result = client.update_user_by_id(user_id, full_name = "New Name")
# Change value of the custom profile field with ID 9.
user_id = 8
result = client.update_user_by_id(user_id, profile_data = [{'id': 9, 'value': 'some data'}])
print(result)
curl -sSX PATCH https://zulip.dioco.io/api/v1/users/12 \
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
-d 'full_name="NewName"' \
-d 'role=400' \
--data-urlencode profile_data='[{"id": 4, "value": "vim"}, {"id": 5, "value": "1909-04-05"}]'
Parameters
user_id required in path
Example: 12
full_name optional
Example: "NewName"
role optional
Example: 400
New role for the user. Roles are encoded as:
- Organization owner: 100
- Organization administrator: 200
- 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.
profile_data optional
Example: [{"id": 4, "value": "vim"}, {"id": 5, "value": "1909-04-05"}]
A dictionary containing the to be updated custom profile field data for the user.
Response
Example response
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"
}