# Update the current user's UI preferences (per-feature shallow merge).

`PUT /api/user/ui-preferences`

Authentication (security requirement alternatives):

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

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

Request body: application/json (required)

Type: object

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

- `aiChat` (optional)
  Reference: [AiChatUiPreferencesDTO](https://sourcey-gauzy.pages.dev/api-reference/models/aichatuipreferencesdto/index.md); Type: object

Responses:

- 202: Merged UI preferences

- 400: Invalid patch

- 401: Unauthorized

- 403: Forbidden

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:3000/api/user/ui-preferences' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "aiChat": {
    "expanded": true,
    "position": "start",
    "width": 0,
    "maximized": true
  }
}'
```

### JavaScript

```javascript
const body = `{
  "aiChat": {
    "expanded": true,
    "position": "start",
    "width": 0,
    "maximized": true
  }
}`;

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

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

### Python

```python
import requests

body = '''{
  "aiChat": {
    "expanded": true,
    "position": "start",
    "width": 0,
    "maximized": true
  }
}'''

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