Introduction

Welcome to the HamroMaster Mobile API documentation.

Base URL

https://your-api-domain.com

Authentication & Profile

Student Login

POST /api/auth/login

Request Body

{ "phone": "9840842566", "password": "your-password" }

Response

{ "status": "success", "token": "eyJh...Gwi" }

Student Register

POST /api/auth/register
{ "name": "Test Student", "email": "...", "phone": "...", "password": "..." }

OTP Flow

Used for registration verification and password resets.

1. Send OTP

POST /api/auth/send-otp

2. Verify OTP

POST /api/auth/verify-otp

3. Reset Password

POST /api/auth/reset-password

Get My Profile

[AUTH] GET /api/users/profile

Returns details of the currently logged-in user.

Update My Profile

[AUTH] PUT /api/users/profile

Update name, email, password, or upload a profile picture.

Note: If uploading an image, use multipart/form-data.

Form Data Parameters

  • name (Text, Optional)
  • email (Text, Optional)
  • password (Text, Optional - to change password)
  • profileImage (File, Optional - JPG/PNG)

Success Response

{ "message": "Profile updated successfully.", "user": { ... } }

Public Content

Get Categories

GET /api/categories/public

Get Public Courses

GET /api/courses/public

Query Parameters

  • category, q, page

Get Public Course Detail

GET /api/courses/public/:id

Get Public Bundles

GET /api/bundles/public

Get Instructors

GET /api/users/public/instructors

Student (Protected)

Requires header: Authorization: Bearer <token>

Get My Enrolled Courses

[AUTH] GET /api/student/my-courses?status=active

Success Response (With Count)

{
    "success": true,
    "data": [
        {
            "course": {
                "courseTitle": "Physics 101",
                "enrolledStudents": 150 // <-- Real Count Included
            }
        }
    ]
}

Get My Enrolled Bundles

[AUTH] GET /api/student/my-bundles

Returns distinct bundle purchases separately from course list.

Success Response

{
  "success": true,
  "data": [
    {
      "bundle": {
        "bundleTitle": "Mega Pack",
        "enrolledStudents": 45 // <-- Real Count Included
      }
    }
  ]
}

Get My Enrolled Course Detail

[AUTH] GET /api/student/my-courses/:slug

Returns full content including Playable URLs.

Get My Assignments

[AUTH] GET /api/student/assignments

Submit Assignment

[AUTH] POST /api/student/assignments/:id/submit

Get My Exams

[AUTH] GET /api/student/exams

Start Exam

[AUTH] POST /api/student/exams/:id/start

Use `attemptId` query param to trigger Review Mode.

Query Params

  • attemptId: Optional. If present, no new timer is started.

Response (New Attempt)

{ "data": { "attemptId": "...", "questions": [...] } } // Answers hidden

Submit Exam

[AUTH] POST /api/student/exams/:id/submit

Returns Result Page immediately (Score + Answers + Explanations).

{ "data": { "totalMarks": 100, "answers": [ { "correctAnswer": "...", "explanation": "..." } ] } }

Get Exam Result

[AUTH] GET /api/student/exams/:id/result

Returns enriched history (Question Text + Options + Correct Answers populated).

Student Reviews

Create Review

[AUTH] POST /api/student/reviews

Get My Reviews

[AUTH] GET /api/student/my-reviews

Get My Notices

[AUTH] GET /api/student/notices

Mark Lesson Complete

[AUTH] POST /api/student/progress/lesson/:lessonId

Payment & Orders

My Orders History

[AUTH] GET /api/orders/myorders

Get a list of all orders placed by the student with their status.

Success Response

[ { "_id": "...", "totalPrice": 5000, "status": "Completed", "orderItems": [...] } ]

Create Manual Order

[AUTH] POST /api/orders/manual

Initialize eSewa Payment

[AUTH] POST /api/orders/esewa/init

Verify eSewa Payment

[AUTH] POST /api/orders/esewa/verify

Video Content

Get HLS Stream URL

[AUTH] GET /api/bunny/stream/:videoId

Download Lesson Video (MP4)

[AUTH] GET /api/bunny/video/:videoId/download