Overview
The Registrations API allows you to manage student enrollments (matriculas) in course sections. Each registration links a student to a specific section with an assigned teacher, creating the enrollment relationship necessary for academic tracking.
Endpoints
Method Endpoint Description GET /api/registrationsList all registrations POST /api/registrationsCreate a new registration GET /api/registrations/{id}Get a specific registration PUT /api/registrations/{id}Update a registration DELETE /api/registrations/{id}Delete a registration
List All Registrations
curl -X GET "https://api.example.com/api/registrations" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_TOKEN"
Response
Indicates if the request was successful
Response message in Spanish
Array of registration objects Unique identifier for the registration
Foreign key referencing the student user (users table)
Foreign key referencing the section (sections table)
Foreign key referencing the teacher user (users table)
Registration/enrollment date (YYYY-MM-DD). Can be null.
Whether the registration is active (default: true)
Record creation timestamp
Record last update timestamp
{
"success" : true ,
"message" : "Matriculas listadas con éxito" ,
"data" : [
{
"id" : 1 ,
"estudiante_id" : 5 ,
"section_id" : 3 ,
"docente_id" : 2 ,
"fecha_matricula" : "2026-03-01" ,
"activo" : true ,
"created_at" : "2026-03-05T10:30:00.000000Z" ,
"updated_at" : "2026-03-05T10:30:00.000000Z"
},
{
"id" : 2 ,
"estudiante_id" : 6 ,
"section_id" : 3 ,
"docente_id" : 2 ,
"fecha_matricula" : "2026-03-02" ,
"activo" : true ,
"created_at" : "2026-03-05T11:00:00.000000Z" ,
"updated_at" : "2026-03-05T11:00:00.000000Z"
}
]
}
Create Registration
curl -X POST "https://api.example.com/api/registrations" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"estudiante_id": 7,
"section_id": 4,
"docente_id": 3,
"fecha_matricula": "2026-03-05",
"activo": true
}'
Request Parameters
ID of the student user being enrolled. Must reference a valid user with role “estudiante”.
ID of the section the student is enrolling in. Must reference a valid section.
ID of the teacher user assigned to this registration. Must reference a valid user with role “docente”.
Date when the student enrolled in YYYY-MM-DD format. Can be null.
Whether the registration is active. Defaults to true. Set to false to temporarily disable an enrollment without deleting it.
Response
{
"success" : true ,
"message" : "Matricula creada con éxito" ,
"data" : {
"id" : 3 ,
"estudiante_id" : 7 ,
"section_id" : 4 ,
"docente_id" : 3 ,
"fecha_matricula" : "2026-03-05" ,
"activo" : true ,
"created_at" : "2026-03-05T12:30:00.000000Z" ,
"updated_at" : "2026-03-05T12:30:00.000000Z"
}
}
A unique constraint exists on the combination of estudiante_id and section_id, preventing duplicate enrollments of the same student in the same section.
Get Registration
GET /api/registrations/{id}
curl -X GET "https://api.example.com/api/registrations/1" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_TOKEN"
Path Parameters
The unique identifier of the registration
Response
{
"success" : true ,
"message" : "Matricula obtenida con éxito" ,
"data" : {
"id" : 1 ,
"estudiante_id" : 5 ,
"section_id" : 3 ,
"docente_id" : 2 ,
"fecha_matricula" : "2026-03-01" ,
"activo" : true ,
"created_at" : "2026-03-05T10:30:00.000000Z" ,
"updated_at" : "2026-03-05T10:30:00.000000Z"
}
}
Update Registration
PUT /api/registrations/{id}
curl -X PUT "https://api.example.com/api/registrations/1" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"estudiante_id": 5,
"section_id": 3,
"docente_id": 4,
"fecha_matricula": "2026-03-01",
"activo": false
}'
Path Parameters
The unique identifier of the registration to update
Request Parameters
All parameters from the Create endpoint apply. You can send partial updates.
Registration date (YYYY-MM-DD)
Response
{
"success" : true ,
"message" : "Matricula actualizada con éxito" ,
"data" : {
"id" : 1 ,
"estudiante_id" : 5 ,
"section_id" : 3 ,
"docente_id" : 4 ,
"fecha_matricula" : "2026-03-01" ,
"activo" : false ,
"created_at" : "2026-03-05T10:30:00.000000Z" ,
"updated_at" : "2026-03-05T15:20:00.000000Z"
}
}
Delete Registration
DELETE /api/registrations/{id}
curl -X DELETE "https://api.example.com/api/registrations/1" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_TOKEN"
Path Parameters
The unique identifier of the registration to delete
Response
{
"success" : true ,
"message" : "Matricula eliminada con éxito" ,
"data" : null
}
Permanently deleting a registration removes the student’s enrollment record. Consider setting activo to false instead to preserve historical data.
Business Rules
Unique Enrollments
The database enforces a unique constraint on the combination of estudiante_id and section_id. This means:
A student cannot be enrolled in the same section multiple times
If you need to re-enroll a student, you must first delete the existing registration or update its status
Cascade Deletes
Registrations are automatically deleted when:
The associated student (estudiante_id) is deleted
The associated teacher (docente_id) is deleted
The associated section (section_id) is deleted
Active Status
The activo field allows you to:
Temporarily disable enrollments without losing historical data
Track withdrawn students while maintaining their registration record
Implement soft deletion patterns for better data integrity