---
title: "Create User"
method: POST
path: "/{sub_domain}/api/users"
tags: ["Users"]
---

# Create User

`POST /{sub_domain}/api/users`

## Request

- Base URL: `https://api.commpeak.com/pbx`
- URL: `https://api.commpeak.com/pbx/{sub_domain}/api/users`
- Auth: API key in header `Authorization`

Creates a new user and returns the created record.

**When to use.** Add a user to your account. If a user with the same `username` already exists, that existing user is returned and no new user is created.

**Required fields.** `username`, `email` and `sip_option`.

**Notes.** If you omit `password`, a temporary password is generated for the user. When `sip_option` is set to Custom URI, `sip_uri` is required. You can also assign roles and desks by passing their IDs. See the request schema for the full list of accepted fields.

**Returns.** `201 Created` with `{ "users": [ { ... } ] }`.

**Example.**
```json
{
  "username": "demo",
  "email": "test@example.com",
  "sip_option": 0
}
```

## Path parameters

- `sub_domain` string, required: PBX Name (subdomain)

## Request body

- UserCreateInput
  - `username` string, required: Username.
  - `email` string, required: Email address.
  - `password` string, nullable: Password for the user account.
  - `sip_option` integer, required: SIP option (0 - WebRTC, 2 - Custom URI (needs sip_uri), 3 - Built in PBX).
  - `is_active` integer, nullable: Whether the user is active (1/0).
  - `sip_uri` string, nullable: SIP URI (required when sip_option is Custom URI).
  - `auto_dial` integer, nullable: Auto-dial status (1/0).
  - `is_deleted` integer, nullable: Whether the user is deleted (1/0).
  - `use_extended_ip_acl` integer, nullable: Use extended IP ACL (1 - yes, 0 - no).
  - `timezone_id` integer, nullable: Timezone ID.
  - `first_name` string, nullable: First name.
  - `last_name` string, nullable: Last name.
  - `virtual_extension` string, nullable: Virtual extension.
  - `default_language` string, nullable: Default language (e.g. en_US, es_ES, pt_BR).
  - `max_session_time` string, nullable: Maximum session time.
  - `max_concurrent_sessions` string, nullable: Maximum concurrent sessions.
  - `twofa_type` string, nullable: Two-factor authentication type (default, disabled, email, google).
  - `member_all_desks` string, nullable: Member of all desks (1/0).
  - `user_region` string, nullable: PBX region (0 - default).
  - `desks` integer[], nullable: IDs of desks associated with the user.
  - `roles` integer[], nullable: IDs of roles assigned to the user.

## Response `201`

Successful Response

- UsersResponse
  - `users` UserResult[], required
    - `id` integer, nullable: User ID.
    - `username` string, nullable: Username.
    - `email` string, nullable: Email address.
    - `is_active` integer, nullable: Whether the user is active (1/0).
    - `is_deleted` integer, nullable: Whether the user is deleted (1/0).
    - `sip_uri` string, nullable: SIP URI.
    - `sip_option` integer, nullable: SIP option (0 - WebRTC, 2 - Custom URI, 3 - Built in PBX).
    - `auto_dial` integer, nullable: Auto-dial status (1/0).
    - `first_name` string, nullable: First name.
    - `last_name` string, nullable: Last name.
    - `virtual_extension` string, nullable: Virtual extension.
    - `default_language` string, nullable: Default language (e.g. en_US, es_ES, pt_BR).
    - `timezone_id` integer, nullable: Timezone ID.
    - `is_clockedin` string, nullable: Last clock-in timestamp; "0000-00-00 00:00:00" when never clocked in (despite the "is_" prefix this is a timestamp, not a boolean).
    - `is_predictive_clockedin` string, nullable: Last predictive-mode clock-in timestamp; "0000-00-00 00:00:00" when never clocked in.
    - `use_extended_ip_acl` integer, nullable: Use extended IP ACL (1 - yes, 0 - no).
    - `use_webrtc` integer, nullable: Use WebRTC (1/0).
    - `max_session_time` integer, nullable: Maximum session time.
    - `max_concurrent_sessions` integer, nullable: Maximum concurrent sessions.
    - `member_all_desks` integer, nullable: Member of all desks (1/0).
    - `member_all_skill_groups` integer, nullable: Boolean flag stored as integer: 1 = true, 0 = false. Member of every skill group in the tenant.
    - `twofa_type` string, nullable: Two-factor authentication type (default, disabled, email, google).
    - `user_region` integer, nullable: PBX region (0 - default).
    - `registration_password` string, nullable: Registration password.
    - `roles` unknown
    - `desks` unknown[], nullable: Desks associated with the user, as a map of deskId to desk name.
      - unknown
    - `skill_groups` unknown[], nullable
      - unknown
    - `groups` unknown[], nullable
      - unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/commpeak/apis/commpeak-pbx-api.md) - [All operations](https://skmtc.dev/commpeak/apis/commpeak-pbx-api/llms.txt) - [OpenAPI document](https://skmtc.dev/commpeak/apis/commpeak-pbx-api/revisions/0b1e8c7fd3f6?raw)
