Skip to main content
POST
/
api
/
recognition
/
grant
Grant Recognition
curl --request POST \
  --url https://api.example.com/api/recognition/grant \
  --header 'Content-Type: application/json' \
  --data '
{
  "employeeId": "<string>",
  "type": "<string>",
  "customData": {
    "customData.courseId": "<string>",
    "customData.description": "<string>",
    "customData.points": 123
  }
}
'
{
  "success": true,
  "message": "<string>",
  "data.recognition": {
    "_id": "<string>",
    "employeeId": "<string>",
    "recognitionType": "<string>",
    "rewardType": "<string>",
    "title": "<string>",
    "description": "<string>",
    "pointsAwarded": 123,
    "badgeEarned": "<string>",
    "level": 123,
    "isPublic": true,
    "issuedAt": "<string>"
  }
}

Overview

Grant recognition to employees for various achievements such as completing surveys, finishing courses, or special accomplishments. The system automatically awards points, badges, and diplomas based on the recognition type.

Authentication

This endpoint requires authentication and admin role.
Authorization: Bearer YOUR_JWT_TOKEN

Request Body

employeeId
string
required
The MongoDB ObjectId of the employee receiving recognition (24-character hex string)
type
string
required
Type of recognition to grant. Options:
  • encuesta_completada - Survey completed (5 points)
  • curso_terminado - Course completed (20 points)
  • empleado_mes - Employee of the month (100 points)
  • participacion_activa - Active participation
  • mejora_continua - Continuous improvement
  • logro_especial - Special achievement
customData
object
Optional custom data for the achievement

Response

success
boolean
Indicates if recognition was granted successfully
message
string
Success message
data.recognition
object
The created recognition object

Recognition Types

Each recognition type has predefined configuration:
TypeRewardTitlePointsBadge
encuesta_completadapuntos¡Encuesta Completada!5participativo
curso_terminadodiploma¡Curso Completado!20aprendiz
empleado_mesmencion¡Empleado del Mes!100estrella

Examples

curl -X POST https://api.cuido.com/api/recognition/grant \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "employeeId": "65a1b2c3d4e5f6a7b8c9d0e2",
    "type": "curso_terminado",
    "customData": {
      "courseId": "65a1b2c3d4e5f6a7b8c9d0e1"
    }
  }'

Response Example

{
  "success": true,
  "message": "Reconocimiento otorgado exitosamente",
  "data": {
    "recognition": {
      "_id": "65a1b2c3d4e5f6a7b8c9d0e7",
      "employeeId": "65a1b2c3d4e5f6a7b8c9d0e2",
      "recognitionType": "curso_terminado",
      "rewardType": "diploma",
      "title": "¡Curso Completado!",
      "description": "Has terminado exitosamente tu capacitación",
      "pointsAwarded": 20,
      "badgeEarned": "aprendiz",
      "level": 1,
      "achievementData": {
        "courseId": "65a1b2c3d4e5f6a7b8c9d0e1"
      },
      "isPublic": true,
      "sharedOnSocialMedia": false,
      "issuedAt": "2024-01-15T10:30:00.000Z",
      "createdAt": "2024-01-15T10:30:00.000Z",
      "updatedAt": "2024-01-15T10:30:00.000Z"
    }
  }
}

Error Responses

{
  "success": false,
  "message": "Validation error",
  "errors": [
    {
      "field": "type",
      "message": "Invalid recognition type"
    }
  ]
}

Gamification System

The recognition system is the core of CUIDO’s gamification strategy:
  • Points: Accumulate to level up employees
  • Badges: Visual achievements displayed on profiles
  • Levels: Calculated based on total points (see stats endpoint)
  • Public Wall: Recognitions are visible to encourage team motivation

Automatic Recognition

While this endpoint allows manual granting, recognitions are typically triggered automatically:
  • Survey completion triggers encuesta_completada
  • Course completion triggers curso_terminado
  • Monthly evaluations may trigger empleado_mes

Source Code References

  • Route: src/routes/recognitionRoutes.js:17
  • Controller: src/controllers/recognitionController.js:6
  • Service: src/services/recognitionService.js:9
  • Config: src/services/recognitionService.js:42
  • Validator: src/validators/cuidoValidators.js:69
  • Model: src/models/Recognition.js

Build docs developers (and LLMs) love