Skip to main content

Endpoint

PUT /api/especialidades/:id

Authentication

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

Description

Updates the information of an existing medical specialty. You can modify the name and description of the specialty.

Path Parameters

id
integer
required
Unique identifier of the specialty to update

Request Body

nombre
string
required
Name of the medical specialty
descripcion
string
Description of what the specialty covers or treats

Response

Returns the updated specialty object.

Response Fields

id
integer
Unique identifier for the specialty
nombre
string
Updated name of the specialty
descripcion
string
Updated description of the specialty

Example Request

curl -X PUT "https://api.example.com/api/especialidades/4" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Neurology",
    "descripcion": "Medical specialty dealing with disorders of the nervous system and brain"
  }'

Example Response

{
  "id": 4,
  "nombre": "Neurology",
  "descripcion": "Medical specialty dealing with disorders of the nervous system and brain"
}

Error Responses

400 Bad Request
Missing required field
{
  "message": "El nombre es obligatorio"
}
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
Specialty with the specified ID does not exist
{
  "message": "Especialidad no encontrada"
}
500 Internal Server Error
Server error while updating specialty
{
  "message": "Error al actualizar especialidad"
}

Notes

  • The nombre field is required even when updating
  • Updating a specialty will affect all doctors assigned to it
  • The updated specialty information will be immediately visible to public users

Build docs developers (and LLMs) love