Create a user

This endpoint is only available to organization administrators.

This endpoint is limited to organizations administrators who additionally have the can_create_users permission for the Zulip organization.

Zulip Cloud users can request the can_create_users permission for a bot by contacting Zulip Cloud support with an explanation for why it is needed.

Self-hosted installations can toggle can_create_users on an account using the manage.py change_user_role command.

Changes: Before Zulip 4.0 (feature level 36), this endpoint was available to all organization administrators.

Create a new user account via the API.

POST https://bgst.chat.bundjugend.de/api/v1/users

Usage examples

#!/usr/bin/env python

import zulip

# The user for this zuliprc file must be an organization administrator
client = zulip.Client(config_file="~/zuliprc-admin")

# Create a user
request = {
    "email": "newbie@zulip.com",
    "password": "temp",
    "full_name": "New User",
}
result = client.create_user(request)
print(result)

More examples and documentation can be found here.

const zulipInit = require("zulip-js");

// The user for this zuliprc file must be an organization administrator.
const config = { zuliprc: "zuliprc-admin" };

(async () => {
    const client = await zulipInit(config);

    const params = {
        email: "notnewbie@zulip.com",
        password: "temp",
        full_name: "New User",
    };

    console.log(await client.users.create(params));
})();

curl -sSX POST https://bgst.chat.bundjugend.de/api/v1/users \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY \
    --data-urlencode email=username@example.com \
    --data-urlencode password=abcd1234 \
    --data-urlencode 'full_name=New User'

Parameters

email string required

Example: "username@example.com"

The email address of the new user.


password string required

Example: "abcd1234"

The password of the new user.


full_name string required

Example: "New User"

The full name of the new user.


Response

Return values

  • user_id: integer

    The ID assigned to the newly created user.

    Changes: New in Zulip 4.0 (feature level 30).

Example response

A typical successful JSON response may look like:

{
    "msg": "",
    "result": "success",
    "user_id": 25
}

A typical JSON response for when another user with the same email address already exists in the realm:

{
    "msg": "Email 'newbie@zulip.com' already in use",
    "result": "error"
}