Courses are the central resource in the LMS Backend. Each course has a title, optional subtitle and description, a category, a difficulty level, a price, and a Cloudinary-hosted thumbnail. Only the authenticated instructor who created a course can update it. Students browse published courses and enroll via the payments flow.Documentation 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.
All endpoints are prefixed with
/api/v1/courses. Protected endpoints require the HTTP-only token cookie set during sign-in.POST /api/v1/courses
Create a new course. The thumbnail image is uploaded to Cloudinary and its secure URL is stored in the document. You must be authenticated — the server reads the instructor ID from the verified JWT cookie. Auth required: YesContent-Type:
multipart/form-data
Request body
Course title. Maximum 100 characters.
Course category (free text, e.g.
"Web Development", "Data Science").Course price in USD. Must be a non-negative number.
Thumbnail image file. The field name must be
thumbnail. Uploaded to Cloudinary; the returned secure URL is stored on the course document.Short one-line subtitle. Maximum 200 characters. Defaults to an empty string if omitted.
Full course description. No length limit enforced by the model.
Difficulty level. Accepted values:
beginner, intermediate, advanced.Response — 201
true on successful creation."Course created successfully"The newly created course document.
Errors
| Status | Condition |
|---|---|
400 | Thumbnail file is missing from the request |
401 | Missing or invalid auth cookie |
GET /api/v1/courses/search
Search for courses using one or more text filters. At least one query parameter must be provided. Results are sorted by most recently created and paginated. Auth required: NoQuery parameters
Case-insensitive partial match on the course title.
Case-insensitive partial match on the subtitle.
Case-insensitive partial match on the description text.
Case-insensitive partial match on the category.
Exact match on difficulty level:
beginner, intermediate, or advanced.Maximum price. Returns courses with
price <= this value.Page number (1-indexed).
Number of results per page.
Response — 200
true on success.Errors
| Status | Condition |
|---|---|
400 | No search parameters provided |
GET /api/v1/courses/published
Retrieve a paginated list of all published courses. Theinstructor field on each course is populated with name and email.
Auth required: No
Query parameters
Page number (1-indexed).
Results per page.
Response — 200
true on success.GET /api/v1/courses/my-courses
Retrieve all courses created by the authenticated user. Results are sorted by most recently created. Theinstructor field is populated.
Auth required: Yes
Query parameters
Page number.
Results per page.
Response — 200
true on success.Errors
| Status | Condition |
|---|---|
401 | Missing or invalid auth cookie |
GET /api/v1/courses/:courseId
Retrieve full details for a single course. Theinstructor field is populated with name and email. The lectures array is populated with each lecture’s title, description, and videoUrl.
Auth required: No
Path parameters
The MongoDB ObjectId of the course to retrieve.
Response — 200
true on success.Full course document with instructor and lectures populated.
Errors
| Status | Condition |
|---|---|
400 | courseId is missing |
PATCH /api/v1/courses/:courseId
Update an existing course. Only the instructor who created the course can perform updates. If a new thumbnail is uploaded, the old Cloudinary asset is deleted before the new one is stored. All body fields are optional — send only the fields you want to change. Auth required: Yes — must be the course instructorContent-Type:
multipart/form-data (when uploading a new thumbnail), or application/json (text-only updates)
Path parameters
The MongoDB ObjectId of the course to update.
Request body
Updated course title.
Updated subtitle.
Updated full description.
Updated category.
Updated difficulty level:
beginner, intermediate, or advanced.Updated price in USD.
Replacement thumbnail image. The field name must be
thumbnail. The old Cloudinary asset is deleted automatically.Response — 200
true on success."Course updated successfully"The updated course document.
Errors
| Status | Condition |
|---|---|
400 | courseId is missing |
401 | Missing or invalid auth cookie |
403 | Authenticated user is not the course instructor |
404 | Course not found |
500 | Database update failed |