Update User

This endpoint is only available to organization administrators.

Administrative endpoint to update the details of another user in the organization.

PATCH https://oilshell.zulipchat.com/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
full_name = "New Name"
url = 'users/' + str(user_id)
result = client.call_endpoint(
    url=url,
    method='PATCH',
    request={'full_name': json.dumps(full_name)}
)
print(result)

# Change value of the custom profile field with ID 9.
user_id = 8
profile_data = [{'id': 9, 'value': 'some data'}]
url = 'users/' + str(user_id)
result = client.call_endpoint(
    url=url,
    method='PATCH',
    request={'profile_data': json.dumps(profile_data)}
)
print(result)

curl -sSX PATCH https://oilshell.zulipchat.com/api/v1/users/12 \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY \
    -d 'full_name="NewName"' \
    -d 'is_admin=false' \
    -d 'is_guest=true' \
    --data-urlencode profile_data='[{"id": 4, "value": "vim"}, {"id": 5, "value": "1909-04-05"}]'

Arguments

user_id required

Example: 12

The user id of the user.


full_name optional

Example: "NewName"

The user's full name.


is_admin optional

Example: false

Whether the target user is an administrator.


is_guest optional

Example: true

Whether the target user is a guest.


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