Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/TheSerchCp/SEAM-API/llms.txt

Use this file to discover all available pages before exploring further.

Permanently removes a role from the system by its numeric idRole. The role must exist — a missing role returns 404 Not Found. If any database records still reference this role via a foreign-key constraint (such as user-role assignments), the database raises an ER_ROW_IS_REFERENCED_2 error and the deletion fails with 409 Conflict. After a successful deletion, a data:changed Socket.IO event is broadcast to all connected clients.
Deleting a role does not automatically cascade to user accounts at the application layer. If any users currently hold this role, the database will raise a foreign-key constraint error and the deletion will fail with 409 Conflict. Unassign all users from the role before deleting it. You should also remove all permission assignments for the role first via the Unassign Permission endpoint.

Authentication

Requires a valid JWT and the DELETE /api/v1/roles/:idRole permission assigned to the caller’s role.

Request

Method: DELETE Path: /api/v1/roles/:idRole

Headers

Authorization
string
required
Bearer token obtained from the login endpoint. Format: Bearer <token>

Path Parameters

idRole
string
required
The numeric ID of the role to delete. Must match ^\d+$ (digits only, no decimals or negative values).

Response

200 OK

Returns null for data on a successful deletion.
success
boolean
Always true for successful responses.
message
string
Human-readable confirmation message. Value: "Rol eliminado exitosamente".
data
null
Always null for delete operations.
Example Response
{
  "success": true,
  "message": "Rol eliminado exitosamente",
  "data": null
}

Error Responses

StatusDescription
400 Bad RequestidRole path parameter is not a valid numeric string.
401 UnauthorizedMissing or invalid JWT token.
403 ForbiddenAuthenticated user’s role lacks the DELETE /api/v1/roles/:idRole permission.
404 Not FoundNo role exists with the given idRole.
409 ConflictThe role is still referenced by other records (ER_ROW_IS_REFERENCED_2 foreign-key constraint).
404 Not Found
{
  "success": false,
  "message": "Rol con id 99 no encontrado",
  "data": null
}
409 Conflict — Foreign Key Constraint
{
  "success": false,
  "message": "Conflicto con el estado actual",
  "data": null
}

Code Example

cURL
curl -X DELETE http://localhost:3000/api/v1/roles/4 \
  -H "Authorization: Bearer <your_token>"

Socket.IO Events

On success, the server emits the following events:
EventTargetOperationStatus sequence
operation:progressRequesting socketroles:deletestartprocessingsuccess
data:changedAll connected clientsroles:deleteBroadcast with { idRole } of the deleted role
Clients listening to data:changed can use the initiatorSocketId field in the payload to skip redundant UI updates if they already know the result from the HTTP response.

Build docs developers (and LLMs) love