# Create a User

`POST /lokta-lms/api/v1/users`

Adds new application user.

Note: Password information is not required (or processed). Password details at present are auto-generated and then sent to the email account given (which is why it can take a few seconds to complete).

Mandatory Fields: 
username, firstname, lastname, email, officeId, roles, sendPasswordToEmail

Optional Fields: 
staffId,passwordNeverExpires,isLoginRetriesEnabled

## Request body (application/json)
- `clients` (array)
- `email` (string)
- `firstname` (string)
- `isLoginRetriesEnabled` (boolean)
- `isPasswordResetAllowed` (boolean)
- `lastname` (string)
- `officeId` (integer)
- `password` (string)
- `passwordNeverExpires` (boolean)
- `repeatPassword` (string)
- `roles` (array)
- `sendPasswordToEmail` (boolean)
- `staffId` (integer)
- `username` (string)

## Responses
- `200`: OK

## Response fields
- `officeId` (integer)
- `resourceId` (integer)

## Example request (cURL)
```bash
curl -X POST \
  'http://localhost:8080/lokta-lms/api/v1/users' \
  -u '{username}:{password}' \
  -H 'Tenant-Identifier: default' \
  -H 'Content-Type: application/json' \
  -d '{
  "clients": [
    2,
    3
  ],
  "email": "user@example.com",
  "firstname": "Test",
  "isLoginRetriesEnabled": true,
  "isPasswordResetAllowed": true,
  "lastname": "User",
  "officeId": 1,
  "password": "password",
  "passwordNeverExpires": true,
  "repeatPassword": "repeatPassword"
}'
```

## Example response
```json
{
  "officeId": 1,
  "resourceId": 11
}
```

Interactive: https://developer.lokta.ai/reference.html#operation/createUser
