Lectures belong to a specific course and are stored as independentDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Pragyat-Nikunj/Learning-Management-System-backend/llms.txt
Use this file to discover all available pages before exploring further.
Lecture documents linked to the parent course via an ObjectId array. When you add a lecture, the video file is uploaded to Cloudinary and the resulting secure URL, public ID, and duration are stored on the lecture record. The order field controls how clients sort lectures for playback.
Lecture endpoints live under the course resource path:
/api/v1/courses/:courseId/lectures. The :courseId segment is the MongoDB ObjectId of the parent course.POST /api/v1/courses/:courseId/lectures
Add a new lecture to a course. The video file is required and is uploaded to Cloudinary before the lecture document is created. Only the instructor who created the parent course may call this endpoint. Auth required: Yes — must be the course instructorContent-Type:
multipart/form-data
Path parameters
MongoDB ObjectId of the course to add the lecture to.
Request body
Lecture title. Maximum 100 characters.
Numeric position of the lecture within the course. Clients use this field to sort lectures for display and playback.
Video file to upload. The field name must be
video. After uploading, the Cloudinary secure URL is stored in videoUrl and the Cloudinary public_id is stored in publicId.Lecture description. Maximum 500 characters.
When
true, this lecture is accessible to non-enrolled users as a free preview. Defaults to false.Response — 201
true on successful creation."Lecture added successfully"The newly created lecture document.
Large video files may take several seconds to upload. The request will not respond until the Cloudinary upload completes. Consider setting an appropriate timeout on your HTTP client.
Errors
| Status | Condition |
|---|---|
400 | courseId is missing |
400 | Video file is missing from the request |
401 | Missing or invalid auth cookie |
403 | Authenticated user is not the course instructor |
404 | Course not found |
500 | Cloudinary upload failed |
GET /api/v1/courses/:courseId/lectures
Retrieve all lectures attached to a course. The full lecture documents are returned (not just IDs), populated from thelectures reference array on the course.
Auth required: No
Path parameters
MongoDB ObjectId of the course whose lectures you want to list.
Response — 200
true on success."Course lectures retrieved successfully"Array of lecture documents in the order they are stored on the course. Each element has the following fields:
Example 200 response
Errors
| Status | Condition |
|---|---|
400 | courseId is missing |
404 | Course not found |