# Update a user

`PUT /u/{username}.json`

Authentication: no security requirement declared for this operation.

Parameters:

- `Api-Key` (header, string, required)
  Type: string

- `Api-Username` (header, string, required)
  Type: string

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

Request body: application/json

Type: any

- `name` (optional)
  Type: string

- `external_ids` (optional)
  Type: object

Additional properties: false

Responses:

- 200: user updated

Content type: application/json

Type: any

- `success` (required)
  Type: string

- `user` (required)
  Type: object

Additional properties: false

## Examples

### cURL

```bash
curl -X PUT 'https://discourse.example.com/u/string.json' \
  -H 'Api-Key: string' \
  -H 'Api-Username: string' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "external_ids": {}
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "external_ids": {}
}`;

const response = await fetch('https://discourse.example.com/u/string.json', {
  method: 'PUT',
  headers: {
    'Api-Key': 'string',
    'Api-Username': 'string',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "external_ids": {}
}'''

response = requests.put(
    'https://discourse.example.com/u/string.json',
    data=body.encode('utf-8'),
    headers={
        'Api-Key': 'string',
        'Api-Username': 'string',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
