# Update a User

`PUT /lokta-lms/api/v1/users/{userId}`

Updates the user

## Parameters
- `userId` (path, integer, required): userId

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

## Responses
- `200`: OK

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

## Example request (cURL)
```bash
curl -X PUT \
  'http://localhost:8080/lokta-lms/api/v1/users/{userId}' \
  -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",
  "repeatPassword": "repeatPassword",
  "roles": [
    2,
    3
  ]
}'
```

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

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