Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/vruizz22/innova-backend-serverless/llms.txt

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

The Classrooms API manages the organizational layer of the platform — teachers create classrooms (courses), generate time-limited invite codes, and students join those courses using the code. Every guide, assignment, and grading workflow is scoped to a course, making classroom management the essential first step for any new class.

POST /classrooms

Create a new classroom owned by the authenticated teacher. The course name can be supplied explicitly or auto-derived from the grade level, letter, and subject (e.g. "8° básico A · Matemática"). Auth: JWT (TEACHER)

Request body

name
string
Display name for the classroom. If omitted, a label is auto-generated from gradeLevel, letter, and the resolved subject name.
description
string
Optional description shown to students.
gradeLevel
number
Grade level from 1 to 12. Grades 1–8 are treated as básico; grades 9–12 map to I–IV Medio. Defaults to 4 if omitted.
letter
string
Section letter (e.g. "A", "B"). Combined with gradeLevel in the auto-generated name.
subjectCode
string
Subject code to look up in the subjects table (e.g. "MATH"). Defaults to "MATH" if omitted.

Response

Returns the newly created Course Prisma record.
id
string
UUID of the new classroom/course.
name
string
Display name (explicitly provided or auto-derived).
gradeLevel
number
The grade level stored on the record.
letter
string | null
Section letter, if provided.
academicYear
number
Calendar year the course was created in.
Example request
curl -X POST https://api.example.com/classrooms \
  -H "Authorization: Bearer <teacher_jwt>" \
  -H "Content-Type: application/json" \
  -d '{
    "gradeLevel": 8,
    "letter": "A",
    "subjectCode": "MATH"
  }'
Example response
{
  "id": "course_abc123",
  "name": "8° básico A · Matemática",
  "gradeLevel": 8,
  "letter": "A",
  "academicYear": 2024
}
Both the subject (subjectCode) and a school record must already exist in the database (seeded). If either is missing, the endpoint returns 404 Not Found.

GET /classrooms/mine

Get all non-archived classrooms where the authenticated teacher has a courseTeacher link (ordered by addedAt ascending). Auth: JWT (TEACHER)

Response

Returns an array of Course objects. Archived courses (archivedAt is not null) are excluded automatically.
[].id
string
Course UUID.
[].name
string
Course display name.
[].gradeLevel
number
Grade level.
[].academicYear
number
Academic year.
Example request
curl https://api.example.com/classrooms/mine \
  -H "Authorization: Bearer <teacher_jwt>"

GET /classrooms/student/mine

Get all courses the authenticated student is actively enrolled in. Auth: JWT (STUDENT)

Response

Returns an array of Course objects for active enrollments. Returns an empty array ([]) if the student profile does not exist rather than a 404.
[].id
string
Course UUID.
[].name
string
Course display name.
Example request
curl https://api.example.com/classrooms/student/mine \
  -H "Authorization: Bearer <student_jwt>"
Route order matters: /classrooms/student/mine is registered before /classrooms/:id, so it is matched first and never interpreted as an :id lookup.

GET /classrooms/:id

Fetch a single classroom by its UUID. Accessible to any authenticated user. Auth: JWT

Path parameters

id
string
required
UUID of the classroom to retrieve.

Response

Returns the Course Prisma record, or null if not found.
Example request
curl https://api.example.com/classrooms/course_abc123 \
  -H "Authorization: Bearer <jwt>"

POST /classrooms/:id/invite

Generate a new invitation for a classroom. The server creates a ClassroomInvite record and returns both the raw code and a fully-qualified join URL built from the PUBLIC_APP_URL environment variable. Auth: JWT (TEACHER)

Path parameters

id
string
required
UUID of the classroom to invite students into. The authenticated teacher must own this course.

Response

code
string
Short alphanumeric invite code (stored as ClassroomInvite.code).
url
string
Fully-qualified join URL in the format {PUBLIC_APP_URL}/join?code={code}. Share this link directly with students.
Example request
curl -X POST https://api.example.com/classrooms/course_abc123/invite \
  -H "Authorization: Bearer <teacher_jwt>"
Example response
{
  "code": "X7K9QM",
  "url": "https://app.innova.cl/join?code=X7K9QM"
}
Invite codes may be configured with an expiresAt and a maxUses cap at the database level. When either limit is reached, POST /classrooms/join returns 400 Bad Request with a descriptive message.

POST /classrooms/join

Enroll the authenticated student in a classroom using an invitation code. The operation is idempotent — if the student was previously enrolled and later removed, the status is reset to ACTIVE via an upsert. The invite useCount is incremented atomically in the same transaction. Auth: JWT (STUDENT)

Request body

code
string
required
The invitation code obtained from the teacher (e.g. "X7K9QM").

Response

Returns the Course record of the classroom that was joined.
id
string
UUID of the classroom the student just joined.
name
string
Display name of the classroom.
Example request
curl -X POST https://api.example.com/classrooms/join \
  -H "Authorization: Bearer <student_jwt>" \
  -H "Content-Type: application/json" \
  -d '{"code": "X7K9QM"}'
Returns 400 Bad Request if the code has expired or exceeded its maxUses limit. Returns 404 Not Found if the code does not exist.

DELETE /classrooms/:id

Soft-delete (archive) a course owned by the authenticated teacher. The course record is not removed from the database — archivedAt is set to the current timestamp instead. Archived courses are excluded from GET /classrooms/mine automatically. Auth: JWT (TEACHER)

Path parameters

id
string
required
UUID of the classroom to archive. The authenticated teacher must be the owner.

Response

Returns 200 OK with { "id": "<courseId>" } on success. The course is not deleted from the database — archivedAt is set to the current timestamp, and the course is excluded from future GET /classrooms/mine responses.
Example request
curl -X DELETE https://api.example.com/classrooms/course_abc123 \
  -H "Authorization: Bearer <teacher_jwt>"
Example response
{
  "id": "course_abc123"
}

Enrollment flow

1

Teacher creates a classroom

Call POST /classrooms with grade level, letter, and subject. The classroom is immediately active and appears in the teacher’s roster.
curl -X POST https://api.example.com/classrooms \
  -H "Authorization: Bearer <teacher_jwt>" \
  -d '{"gradeLevel": 7, "letter": "B", "subjectCode": "MATH"}'
2

Teacher generates an invite link

Call POST /classrooms/:id/invite to create an invitation. Copy the returned url.
curl -X POST https://api.example.com/classrooms/course_abc123/invite \
  -H "Authorization: Bearer <teacher_jwt>"
# → { "code": "X7K9QM", "url": "https://app.innova.cl/join?code=X7K9QM" }
3

Teacher shares the invite URL

Send url to students via your preferred channel (chat, email, printed QR code, etc.).
4

Students register and join

Each student registers an account (STUDENT role), then calls POST /classrooms/join with the code. Existing accounts simply call join directly.
curl -X POST https://api.example.com/classrooms/join \
  -H "Authorization: Bearer <student_jwt>" \
  -d '{"code": "X7K9QM"}'
5

Students appear in the roster

The teacher can verify enrollment by checking GET /classrooms/:id. Enrolled students are now eligible to receive guides, assignments, and practice recommendations scoped to this course.

Build docs developers (and LLMs) love