Update a user
Admin-only. Password is optional — omit to keep the existing hash.
Request
Method: PUT
Path: /api/users/{id}
Authentication: Not required
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
| id | integer | path | Yes |
Request Body
Content Type: application/json
Schema: See component schemas below
Responses
200 - User updated
400 - Invalid payload or user ID
403 - Requires admin role
404 - User not found
Examples
cURL
curl -X PUT \
-H "Content-Type: application/json" \
http://localhost:3000/api/users/{id} \
-d '{"example": "data"}'
JavaScript
const response = await fetch('http://localhost:3000/api/users/{id}', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
// Request data
}),
});
const data = await response.json();
console.log(data);
This documentation is automatically generated from the OpenAPI specification.