Skip to main content

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

MethodEndpointDescription
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

success
boolean
required
Indicates if the request was successful
message
string
required
Response message in Spanish
data
array
required
Array of registration objects
{
  "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

estudiante_id
integer
required
ID of the student user being enrolled. Must reference a valid user with role “estudiante”.
section_id
integer
required
ID of the section the student is enrolling in. Must reference a valid section.
docente_id
integer
required
ID of the teacher user assigned to this registration. Must reference a valid user with role “docente”.
fecha_matricula
date
Date when the student enrolled in YYYY-MM-DD format. Can be null.
activo
boolean
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

curl -X GET "https://api.example.com/api/registrations/1" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN"

Path Parameters

id
integer
required
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

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

id
integer
required
The unique identifier of the registration to update

Request Parameters

All parameters from the Create endpoint apply. You can send partial updates.
estudiante_id
integer
required
ID of the student user
section_id
integer
required
ID of the section
docente_id
integer
required
ID of the teacher user
fecha_matricula
date
Registration date (YYYY-MM-DD)
activo
boolean
Active status

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

curl -X DELETE "https://api.example.com/api/registrations/1" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN"

Path Parameters

id
integer
required
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

Build docs developers (and LLMs) love