Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/iamalexis689725/cole/llms.txt

Use this file to discover all available pages before exploring further.

The Attendance API lets teachers record, view, and correct attendance for each class session within a given teacher assignment and academic period. Attendance is modeled as a header record (Asistencia) with a child detail record (AsistenciaDetalle) per student. Each header is uniquely identified by its assignment and date, so the system prevents accidental duplicate entries and returns 409 Conflict if attendance for a given date already exists.
All attendance routes require a valid Sanctum bearer token, the role:profesor middleware, and the module:asistencia feature module to be active for the tenant.

Record Attendance

Creates a new attendance session for the given assignment and date. The request must include one entry per enrolled student.
POST /api/periodos/{periodo}/asignaciones/{asignacion}/asistencia
periodo
integer
required
The academic period ID.
asignacion
integer
required
The teacher assignment (asignacion_docente) ID, which must belong to the given period.
fecha
string (date)
required
The session date in YYYY-MM-DD format.
asistencias
array
required
Array of per-student attendance records. Must contain at least one item.
Example request
curl -X POST https://your-tenant.coleapp.io/api/periodos/5/asignaciones/18/asistencia \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "fecha": "2026-06-10",
    "asistencias": [
      { "estudiante_id": 101, "estado": "presente" },
      { "estudiante_id": 102, "estado": "falta", "observacion": "No avisó" },
      { "estudiante_id": 103, "estado": "tarde",  "observacion": "Llegó 10 min tarde" },
      { "estudiante_id": 104, "estado": "justificado", "observacion": "Cita médica" }
    ]
  }'
Example response 201 Created
{
  "message": "Asistencia registrada correctamente",
  "data": {
    "id": 88,
    "asignacion_docente_id": 18,
    "fecha": "2026-06-10",
    "created_at": "2026-06-10T08:05:00.000000Z",
    "updated_at": "2026-06-10T08:05:00.000000Z",
    "detalles": [
      {
        "id": 301,
        "asistencia_id": 88,
        "estudiante_id": 101,
        "estado": "presente",
        "observacion": null,
        "estudiante": { "id": 101, "user": { "name": "Ana Torres" } }
      },
      {
        "id": 302,
        "asistencia_id": 88,
        "estudiante_id": 102,
        "estado": "falta",
        "observacion": "No avisó",
        "estudiante": { "id": 102, "user": { "name": "Luis Ramírez" } }
      }
    ]
  }
}
409 Conflict — duplicate date If attendance has already been recorded for the same assignment and date:
{
  "message": "Ya se registró asistencia para esta materia en esta fecha"
}

Get Attendance by Date

Retrieves the attendance session (with all student detail records) for a specific date.
GET /api/periodos/{periodo}/asignaciones/{asignacion}/asistencia/{fecha}
periodo
integer
required
The academic period ID.
asignacion
integer
required
The teacher assignment ID.
fecha
string (date)
required
The session date in YYYY-MM-DD format.
Returns the Asistencia record with its detalles (each including the related estudiante.user), or 404 with "message": "No hay asistencia registrada" if no session was recorded on that date. Example response 200 OK
{
  "id": 88,
  "asignacion_docente_id": 18,
  "fecha": "2026-06-10",
  "detalles": [
    {
      "id": 301,
      "estudiante_id": 101,
      "estado": "presente",
      "observacion": null,
      "estudiante": { "id": 101, "user": { "name": "Ana Torres" } }
    }
  ]
}

List All Attendance Sessions

Returns all attendance header records for the assignment, ordered by date descending. Detail records are not expanded in this list view.
GET /api/periodos/{periodo}/asignaciones/{asignacion}/asistencia
periodo
integer
required
The academic period ID.
asignacion
integer
required
The teacher assignment ID.
Example response 200 OK
[
  {
    "id": 88,
    "asignacion_docente_id": 18,
    "fecha": "2026-06-10",
    "created_at": "2026-06-10T08:05:00.000000Z",
    "updated_at": "2026-06-10T08:05:00.000000Z"
  },
  {
    "id": 75,
    "asignacion_docente_id": 18,
    "fecha": "2026-06-03",
    "created_at": "2026-06-03T08:10:00.000000Z",
    "updated_at": "2026-06-03T08:10:00.000000Z"
  }
]

Update an Attendance Session

Replaces all detail records for an existing attendance session. The update operation deletes all existing AsistenciaDetalle rows for the session and inserts fresh ones from the request body. This ensures corrections are applied atomically.
PUT /api/asistencia/{id}
id
integer
required
The Asistencia (session header) ID to update.
asistencias
array
required
The new complete set of per-student attendance records for this session. All previous detail rows will be replaced.
Example request
curl -X PUT https://your-tenant.coleapp.io/api/asistencia/88 \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "asistencias": [
      { "estudiante_id": 101, "estado": "presente" },
      { "estudiante_id": 102, "estado": "justificado", "observacion": "Certificado médico presentado" },
      { "estudiante_id": 103, "estado": "presente" },
      { "estudiante_id": 104, "estado": "presente" }
    ]
  }'
Example response 200 OK
{
  "message": "Asistencia actualizada",
  "data": {
    "id": 88,
    "asignacion_docente_id": 18,
    "fecha": "2026-06-10",
    "detalles": [
      {
        "id": 310,
        "estudiante_id": 101,
        "estado": "presente",
        "observacion": null,
        "estudiante": { "id": 101, "user": { "name": "Ana Torres" } }
      },
      {
        "id": 311,
        "estudiante_id": 102,
        "estado": "justificado",
        "observacion": "Certificado médico presentado",
        "estudiante": { "id": 102, "user": { "name": "Luis Ramírez" } }
      }
    ]
  }
}

Valid Attendance States

ValueMeaning
presenteStudent was present for the class.
faltaStudent was absent without justification.
justificadoStudent was absent with an accepted justification.
tardeStudent arrived late to the class.

Build docs developers (and LLMs) love