Roles
Delete Role
Delete a role (Admin only)
DELETE
Delete Role
Overview
Deletes a role from the system. This is a soft delete operation that sets the role status to inactive rather than permanently removing it.Authentication
Required: Bearer token with admin privilegesPath Parameters
The unique identifier of the role to delete
Response
Indicates if the role was deleted successfully
Confirmation message
Always null for delete operations
Examples
Response Examples
Success (200 OK)
Unauthorized (401)
Forbidden (403)
Not Found (404)
Error Responses
| Status Code | Description |
|---|---|
| 400 | Invalid role ID |
| 401 | Missing or invalid authentication token |
| 403 | User does not have admin privileges |
| 404 | Role not found |
| 500 | Internal server error |
Soft Delete Behavior
This endpoint performs a soft delete by setting the role status to “inactive”. The role record remains in the database but is no longer active. This preserves referential integrity with users who may have this role assigned.
Important Notes
Related Endpoints
List Roles
View all roles
Create Role
Create a new role
Update Role
Modify role details
Source Code Reference
- Route:
src/routes/role.routes.js:delete - Controller:
src/controllers/roleController.js:deleteRole
Delete Role
