Skip to main content

PATCH /api/roles//deactivate

Deactivates a role, preventing it from being assigned to new users. Users who currently have this role will lose access to its associated permissions.

Authentication

This endpoint requires authentication. Include a valid JWT token in the Authorization header.

Path Parameters

id
UUID
required
The unique identifier of the role to deactivate

Response

This endpoint returns 204 No Content on success with an empty response body.

Error Responses

  • 404 Not Found: Role with the specified ID does not exist
  • 500 Internal Server Error: Unexpected server error

Example Request

curl -X PATCH https://api.example.com/api/roles/550e8400-e29b-41d4-a716-446655440000/deactivate \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Example Success Response

HTTP/1.1 204 No Content

Example Error Response

{
  "timestamp": "2024-01-15T10:30:00Z",
  "requestId": "abc-123-def",
  "message": "Role not found",
  "detail": "No role exists with ID: 550e8400-e29b-41d4-a716-446655440000"
}

Usage Notes

  • Deactivating a role that is already inactive has no effect
  • After deactivation, the role’s status will be set to INACTIVE
  • Users with this role will immediately lose access to its associated permissions
  • The role cannot be assigned to users while it is inactive
  • This action is logged in the audit trail with action type DESACTIVAR_ROL
  • Consider the impact on existing users before deactivating a role

Build docs developers (and LLMs) love