Endpoint
DELETE /api/management/users/{id}
Authentication
This endpoint requires authentication with a valid JWT token and the ADMIN role.
Authorization: Bearer <your_jwt_token>
Path Parameters
The unique identifier of the user to delete
Response
Returns a success response with no data when the user is successfully deleted.
Indicates if the request was successful (will be true for successful deletion)
ISO 8601 timestamp of the response
No data is returned for successful deletion
Example Request
curl -X DELETE "http://localhost:8080/api/management/users/1" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
Example Response
{
"success": true,
"timestamp": "2026-03-03T10:30:00Z"
}
Error Responses
401 Unauthorized
Returned when authentication credentials are missing or invalid.
{
"success": false,
"timestamp": "2026-03-03T10:30:00Z",
"error": {
"code": "UNAUTHORIZED",
"message": "Authentication required"
}
}
403 Forbidden
Returned when the authenticated user does not have the ADMIN role.
{
"success": false,
"timestamp": "2026-03-03T10:30:00Z",
"error": {
"code": "FORBIDDEN",
"message": "Access denied. ADMIN role required."
}
}
404 Not Found
Returned when no user exists with the specified ID.
{
"success": false,
"timestamp": "2026-03-03T10:30:00Z",
"error": {
"code": "USER_NOT_FOUND",
"message": "User not found with id: 999"
}
}
409 Conflict
Returned when the user cannot be deleted due to existing dependencies (e.g., active loans, reservations).
{
"success": false,
"timestamp": "2026-03-03T10:30:00Z",
"error": {
"code": "USER_HAS_DEPENDENCIES",
"message": "Cannot delete user with active loans or reservations"
}
}
Important Notes
Deleting a user is a permanent action and cannot be undone. Ensure that:
- The user has no active loans or reservations
- All user-related data has been properly archived or transferred if needed
- You have confirmed this is the correct user to delete
In production systems, consider implementing soft deletion (marking users as inactive) instead of permanent deletion to maintain data integrity and audit trails.