zulip/templates/zerver/api/get-all-users.md

82 lines
2.5 KiB
Markdown

# Get all users
Retrieve details on all users in the organization. Optionally
includes values of [custom profile field](/help/add-custom-profile-fields).
`GET {{ api_url }}/v1/users`
You can also [fetch details on a single user](/api/get-user).
## Usage examples
{start_tabs}
{tab|python}
{generate_code_example(python)|/users:get|example}
{tab|js}
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
```js
const zulip = require('zulip-js');
// Pass the path to your zuliprc file here.
const config = {
zuliprc: 'zuliprc',
};
zulip(config).then((client) => {
// Get all users in the realm
client.users.retrieve().then(console.log);
// You may pass the `client_gravatar` query parameter as follows:
client.users.retrieve({client_gravatar: true}).then(console.log);
});
```
{tab|curl}
{generate_code_example(curl, include=[""])|/users:get|example}
You may pass the `client_gravatar` query parameter as follows:
{generate_code_example(curl)|/users:get|example}
{end_tabs}
## Arguments
**Note**: The following arguments are all URL query parameters.
{generate_api_arguments_table|zulip.yaml|/users:get}
## Response
#### Return values
* `members`: A list of dictionaries, each containing the details for
one of the users in the organization.
* `email`: The email address of the user or bot.
* `is_bot`: A boolean specifying whether the user is a bot or not.
* `avatar_url`: URL to the user's gravatar. `None` if the `client_gravatar`
query parameter was set to `True`.
* `full_name`: Full name of the user or bot.
* `is_admin`: A boolean specifying whether the user is an admin or not.
* `bot_type`: `None` if the user isn't a bot. `1` for a `Generic` bot.
`2` for an `Incoming webhook` bot. `3` for an `Outgoing webhook` bot.
`4` for an `Embedded` bot.
* `user_id`: The ID of the user.
* `bot_owner_id`: If the user is a bot (i.e. `is_bot` is `True`), `bot_owner`
is the user ID of the bot's owner (usually, whoever created the bot).
**Changes**: New in Zulip 2.2. In previous versions, there was a `bot_owner`
field containing the email address of the bot's owner.
* `is_active`: A boolean specifying whether the user is active or not.
* `is_guest`: A boolean specifying whether the user is a guest user or not.
* `timezone`: The time zone of the user.
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/users:get|fixture(200)}