> For the complete documentation index, see [llms.txt](https://developer.perculus.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.perculus.com/v2-en/services/user-management/user-create.md).

# Creating a User

Below is a list of available parameters when creating a user.

<table data-full-width="false"><thead><tr><th>Parameter</th><th width="134">Type</th><th width="113">Required</th><th width="116">Default</th><th>Description</th></tr></thead><tbody><tr><td>name</td><td>string</td><td>Yes</td><td>n/a</td><td>Name of the user</td></tr><tr><td>surname</td><td>string</td><td>Yes</td><td>n/a</td><td>Surname of the user</td></tr><tr><td>email</td><td>string</td><td>Yes</td><td>n/a</td><td>Email of the user</td></tr><tr><td>username</td><td>string</td><td>Yes</td><td>n/a</td><td>Username of the user</td></tr><tr><td>role</td><td>string</td><td>No</td><td>u</td><td>Role of the user(<a href="/pages/UTVEaKGzw0Q9EmCFXDq1">see</a>)</td></tr><tr><td>psd</td><td>string</td><td>No</td><td>null</td><td>Password of the user</td></tr><tr><td>mobile</td><td>string</td><td>No</td><td>null</td><td>Mobile of the user</td></tr><tr><td>login_allowed</td><td>bool</td><td>No</td><td>true</td><td>Flag if the login is allowed</td></tr><tr><td>active</td><td>bool</td><td>No</td><td>true</td><td>Flag if the user is active</td></tr><tr><td>lang</td><td>string</td><td>No</td><td>tr-TR</td><td>Language of the user(<a href="/pages/lsSvGzmzOzBbQwfL34jH">see</a>). This option modifies: <mark style="color:green;">session interface, panel interface and mails.</mark></td></tr><tr><td>timezone</td><td>string</td><td>No</td><td>Europe/Istanbul</td><td>Timezone of the user(<a href="/pages/gQdFQ1QzG6GgP6cR2hOQ">see</a>) This option modifies: how the user sees <mark style="color:green;">sessions' hours.</mark></td></tr><tr><td>expires_at</td><td>string</td><td>No</td><td>null</td><td>Date which the user will expire(<a href="/pages/KC5egNFm9kBLa1ddQFOf">see</a>)</td></tr></tbody></table>

{% hint style="warning" %}
For an account, `email` and `username` of a user should be **unique** across **its users**.
{% endhint %}

**Example request**

{% tabs %}
{% tab title="CURL" %}

```bash
curl -L -X POST 'https://<DOMAIN>/api/groups/xapi/user' \
-H 'Content-Type: application/json' \
--data-raw '{
    "name": "John",
    "surname": "Doe",
    "username": "johndoe",
    "email": "john.doe@example.com"
}'
```

{% endtab %}

{% tab title="Python" %}

```python
client.users.upsert_user(
     {
            name: "John",
            surname: "Doe",
            email: "johndoe@example.com",
            username: "johndoe"
     }
)
```

{% endtab %}
{% endtabs %}

**Example response**

{% hint style="info" %}
You must securely store the **USER\_GUID** to perform other operations for the user.
{% endhint %}

A successful create operation will return `201 Created`  with body including the following information:

```json
{
  "user_guid": "6D9D158D-5A41-4FE5-A151-DE008BC978DE",
  "name": "John",
  "surname": "Doe",
  "username": "johndoe",
  "email": "john.doe@example.com",
  "role": "u",
  "mobile": null,
  "login_allowed": true,
  "status": 1,
  "lang": "en-US",
  "timezone": "Europe/Istanbul",
  "expires_at": null,
  "creation_date": null,
  "updating_date": null
}
```
