Skip to main content
PUT
/
api
/
employees
/
:id
curl -X PUT https://api.cuido.com/api/employees/60d5ec49f1b2c72b8c8e4f1a \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "wellnessMetrics": {
      "currentMoodScore": 4,
      "averageWorkload": 5,
      "riskLevel": "medio"
    }
  }'
{
  "success": true,
  "message": "Empleado actualizado exitosamente",
  "data": {
    "employee": {
      "_id": "60d5ec49f1b2c72b8c8e4f1a",
      "personalInfo": {
        "name": "Dr. María García",
        "email": "[email protected]",
        "identification": "123456789",
        "phoneNumber": "+57 300 123 4567"
      },
      "jobInfo": {
        "position": "medico",
        "department": "urgencias",
        "startDate": "2024-01-15T00:00:00.000Z",
        "shift": "noche"
      },
      "hospitalId": "HOSP001",
      "wellnessMetrics": {
        "currentMoodScore": 4,
        "averageWorkload": 5,
        "teamSupportScore": 3,
        "satisfactionScore": 5,
        "riskLevel": "medio"
      },
      "gamification": {
        "totalPoints": 350,
        "currentStreak": 7,
        "maxStreak": 14,
        "level": 4,
        "badges": []
      },
      "isActive": true,
      "createdAt": "2024-01-15T10:30:00.000Z",
      "updatedAt": "2024-03-05T15:45:00.000Z"
    }
  }
}

Authentication

Authorization
string
required
Bearer token for authentication
This endpoint requires admin privileges.

Path Parameters

id
string
required
The unique MongoDB identifier of the employee to update

Request Body

All fields are optional. Only include the fields you want to update.
personalInfo
object
Update personal information
jobInfo
object
Update employment information
hospitalId
string
Update hospital identifier
wellnessMetrics
object
Update wellness metrics
gamification
object
Update gamification data
isActive
boolean
Update active status

Response

success
boolean
Indicates if the request was successful
message
string
Success message
data
object
Response data
curl -X PUT https://api.cuido.com/api/employees/60d5ec49f1b2c72b8c8e4f1a \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "wellnessMetrics": {
      "currentMoodScore": 4,
      "averageWorkload": 5,
      "riskLevel": "medio"
    }
  }'
{
  "success": true,
  "message": "Empleado actualizado exitosamente",
  "data": {
    "employee": {
      "_id": "60d5ec49f1b2c72b8c8e4f1a",
      "personalInfo": {
        "name": "Dr. María García",
        "email": "[email protected]",
        "identification": "123456789",
        "phoneNumber": "+57 300 123 4567"
      },
      "jobInfo": {
        "position": "medico",
        "department": "urgencias",
        "startDate": "2024-01-15T00:00:00.000Z",
        "shift": "noche"
      },
      "hospitalId": "HOSP001",
      "wellnessMetrics": {
        "currentMoodScore": 4,
        "averageWorkload": 5,
        "teamSupportScore": 3,
        "satisfactionScore": 5,
        "riskLevel": "medio"
      },
      "gamification": {
        "totalPoints": 350,
        "currentStreak": 7,
        "maxStreak": 14,
        "level": 4,
        "badges": []
      },
      "isActive": true,
      "createdAt": "2024-01-15T10:30:00.000Z",
      "updatedAt": "2024-03-05T15:45:00.000Z"
    }
  }
}

Common Update Scenarios

Update Wellness Assessment

After a wellness check-in, update the employee’s metrics:
await updateEmployee(employeeId, {
  wellnessMetrics: {
    currentMoodScore: 4,
    averageWorkload: 5,
    teamSupportScore: 4,
    satisfactionScore: 7,
    riskLevel: 'medio'
  }
});

Award Points and Badge

When an employee completes an activity:
const employee = await getEmployee(employeeId);
const newPoints = employee.gamification.totalPoints + 50;
const newLevel = Math.floor(newPoints / 100) + 1;

await updateEmployee(employeeId, {
  gamification: {
    totalPoints: newPoints,
    level: newLevel,
    badges: [
      ...employee.gamification.badges,
      {
        name: 'Actividad Completada',
        earnedAt: new Date().toISOString(),
        description: 'Completó un ejercicio de mindfulness'
      }
    ]
  }
});

Change Department

When an employee transfers to a new department:
await updateEmployee(employeeId, {
  jobInfo: {
    department: 'hospitalizacion',
    shift: 'mañana'
  }
});

Deactivate Employee

When an employee leaves:
await updateEmployee(employeeId, {
  isActive: false
});

Build docs developers (and LLMs) love