# PUT /api/user/{id}

Authentication (security requirement alternatives):

```json
[
  {
    "bearer": []
  },
  {
    "bearer": []
  }
]
```

- bearer: http (bearer), header JWT. Enter JWT token

Parameters:

- `id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Schema: [UpdateUserDTO](https://sourcey-gauzy.pages.dev/api-reference/models/updateuserdto/index.md)

- `email` (optional)
  Type: string

- `roleId` (optional)
  Type: string

- `role` (optional)
  Type: object
  
  Role reference: an object with the role `id` (UUID).

- `firstName` (optional)
  Type: string

- `lastName` (optional)
  Type: string

- `imageUrl` (optional)
  Type: string

- `preferredLanguage` (optional)
  Type: string
  
  enum: ["en","bg","he","ru","fr","es","zh","de","pt","it","nl","pl","ar"]

- `isActive` (optional)
  Type: boolean
  
  default: true

- `imageId` (optional)
  Type: string

- `defaultTeamId` (optional)
  Type: string

- `lastTeamId` (optional)
  Type: string

- `defaultOrganizationId` (optional)
  Type: string

- `lastOrganizationId` (optional)
  Type: string

- `hash` (optional)
  Type: string

Responses:

- 202: 

- 401: Unauthorized

- 403: Forbidden

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:3000/api/user/string' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "email": "string",
  "roleId": "string",
  "role": {},
  "firstName": "string",
  "lastName": "string",
  "imageUrl": "string",
  "preferredLanguage": "en",
  "isActive": true,
  "imageId": "string",
  "defaultTeamId": "string",
  "lastTeamId": "string",
  "defaultOrganizationId": "string",
  "lastOrganizationId": "string",
  "hash": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "email": "string",
  "roleId": "string",
  "role": {},
  "firstName": "string",
  "lastName": "string",
  "imageUrl": "string",
  "preferredLanguage": "en",
  "isActive": true,
  "imageId": "string",
  "defaultTeamId": "string",
  "lastTeamId": "string",
  "defaultOrganizationId": "string",
  "lastOrganizationId": "string",
  "hash": "string"
}`;

const response = await fetch('http://localhost:3000/api/user/string', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "email": "string",
  "roleId": "string",
  "role": {},
  "firstName": "string",
  "lastName": "string",
  "imageUrl": "string",
  "preferredLanguage": "en",
  "isActive": true,
  "imageId": "string",
  "defaultTeamId": "string",
  "lastTeamId": "string",
  "defaultOrganizationId": "string",
  "lastOrganizationId": "string",
  "hash": "string"
}'''

response = requests.put(
    'http://localhost:3000/api/user/string',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
