Skip to main content

Endpoint

DELETE /api/medicos/:id

Authentication

This endpoint requires authentication with an admin role. Include a valid JWT token in the Authorization header.
Authorization: Bearer <token>

Description

Soft deletes a doctor by setting their activo status to false. This is not a permanent deletion - the doctor record remains in the database but is marked as inactive.
This is a soft delete operation. The doctor record is preserved in the database but marked as inactive. This allows maintaining historical data and relationships while removing the doctor from active use.

Path Parameters

id
integer
required
Unique identifier of the doctor to deactivate

Response

Returns a success message confirming the deactivation.

Response Fields

message
string
Confirmation message indicating successful deactivation

Example Request

curl -X DELETE "https://api.example.com/api/medicos/3" \
  -H "Authorization: Bearer YOUR_TOKEN"

Example Response

{
  "message": "Médico desactivado correctamente"
}

Error Responses

401 Unauthorized
Missing or invalid authentication token
{
  "message": "Token no proporcionado"
}
403 Forbidden
User does not have admin role
{
  "message": "Acceso denegado"
}
404 Not Found
Doctor with the specified ID does not exist
{
  "message": "Médico no encontrado"
}
500 Internal Server Error
Server error while deactivating doctor
{
  "message": "Error al eliminar médico"
}

Reactivation

To reactivate a deactivated doctor, use the Update Doctor endpoint and set activo to true:
curl -X PUT "https://api.example.com/api/medicos/3" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"activo": true}'

Notes

  • Deactivated doctors will not appear in the public doctors list (/api/medicos/public)
  • Deactivated doctors are still visible in the admin list (/api/medicos)
  • All historical data and relationships are preserved
  • The associated person record remains unchanged

Build docs developers (and LLMs) love