deleteById
id: deleteUserById title: Delete User By ID​
DELETE /api/users/:id
​
Delete a user by ID. Admins can delete any user. Non-admin users can delete only their own account.
Response​
-
200 OK
{ "success": true, "message": "User deleted successfully" }
-
403 Forbidden
{ "success": false, "error": "Forbidden" }
-
404 Not Found
{ "success": false, "error": "User not found" }
-
500 Internal Server Error
{ "success": false, "error": "Internal server error" }
Example​
curl -X DELETE http://localhost:8080/api/users/1 \
--cookie "token=your_jwt_token"