KiAcademy / Docs
KiAcademy API Reference

Model Context & API Reference

Welcome to the official KiAcademy API documentation. Our REST services manage authentication tokens, course curriculums, student progression logs, BigBlueButton live video rooms, dynamic PDF certification, and ERPNext synchronization.

JSON REST Standard CORS Enabled Automatic DESC Sorting
Security

Filters & Authentication

All dev-api/* endpoints are protected by two global filters: cors (preflight) and auth (static bearer token). Authentication endpoints live under dev-api/auth/ and handle credential flows, OTP, social login, and session management.

1. CORS Filter

Applied automatically to every dev-api/* request. Handles pre-flight OPTIONS requests and sets cross-origin headers for all allowed origins.

Allowed Headers
Content-Type, Authorization, X-Requested-With, Cookie
Allowed Methods
GET, POST, PUT, DELETE, OPTIONS
2. Bearer Token (Static Auth Filter)

Every request to dev-api/* must carry a static secure token in the Authorization header. The token value is set by the SECURE_TOKEN environment variable.

Authorization: Bearer YOUR_SECURE_TOKEN
Replace YOUR_SECURE_TOKEN with the value in your .envSECURE_TOKEN.
cURL Example
curl -X GET "https://api.kiacademy.in/dev-api/courses" \
  -H "Authorization: Bearer YOUR_SECURE_TOKEN" \
  -H "Content-Type: application/json"
POST 4. Login — /dev-api/auth/login

Authenticates a user with email and password. Returns a session token and sets the auth_token cookie.

Request Body
{
  "email": "[email protected]",
  "password": "YourPassword@123"
}
Success Response (200)
{
  "status": 200,
  "message": "Login successful",
  "data": {
    "user_id": 20,
    "first_name": "John",
    "last_name": "Doe",
    "email": "[email protected]",
    "role_id": 3,
    "token": "eyJhbGci..."
  }
}
Error Response (401)
{
  "status": 401,
  "message": "Invalid email or password."
}
POST 5. Forgot Password — /dev-api/auth/forgot-password

Sends a 6-digit OTP to the registered email address for password recovery.

Request Body
{
  "email": "[email protected]"
}
Success Response (200)
{
  "status": 200,
  "message": "OTP sent to your email."
}
POST 6. Verify OTP — /dev-api/auth/verify-otp
Request Body
{
  "email": "[email protected]",
  "otp": "839201"
}
Success Response (200)
{
  "status": 200,
  "message": "OTP verified successfully."
}
POST 7. Reset Password — /dev-api/auth/reset-password
Request Body
{
  "email": "[email protected]",
  "new_password": "NewPass@123",
  "confirm_password": "NewPass@123"
}
Success Response (200)
{
  "status": 200,
  "message": "Password reset successfully."
}
GET 8. Logout — /dev-api/auth/logout

Clears the auth_token cookie and invalidates the current session.

Success Response (200)
{
  "status": 200,
  "message": "Logged out successfully."
}
POST 9. Google OAuth Login — /dev-api/auth/login/google

Authenticates using a Google OAuth2 ID token from client-side Google Sign-In SDK.

Request Body
{
  "id_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6Ijg..."
}
Success Response (200)
{
  "status": 200,
  "message": "Google login successful",
  "data": {
    "user_id": 25,
    "email": "[email protected]",
    "role_id": 3,
    "is_new_user": false
  }
}
GET 9b. Google OAuth Redirect Callback — /dev-api/auth/callback/google

Server-side redirect callback handler for Google OAuth2 server-flow. Automatically called by Google after the user grants authorization. Processes the authorization code, fetches user info, creates/updates the account, and returns a session token.

Query Parameters (set by Google)
ParameterTypeDescription
codestringAuthorization code from Google
statestringCSRF state token
This endpoint is called by Google's servers, not directly by clients. The server redirects the user to the frontend with the session after successful exchange.
GET 10. Facebook OAuth Login — /dev-api/auth/login/facebook

Initiates the Facebook OAuth2 redirect flow. The server redirects the user to Facebook login, then handles the callback at /dev-api/auth/callback/facebook.

Callback Route
GET https://api.kiacademy.in/dev-api/auth/callback/facebook
POST 11. Switch User Role — /dev-api/user/switch-role

Allows a user to switch their active role between Student (3) and Instructor (2). Creates an empty instructor/student profile if one does not already exist.

Request Body
{
  "user_id": 20,
  "new_role_id": 2
}
Role ID Reference
Role IDRole Name
1Global Administrator
2Instructor / Tutor
3Student
4Institution (Tenant Admin)
5Sub-Administrator
Success Response (200)
{
  "status": 200,
  "message": "Role switched successfully. Now acting as Instructor"
}
POST 12. Register FCM Push Token — /dev-api/user/register-token

Registers a Firebase Cloud Messaging device token for push notification delivery.

Request Body
{
  "user_id": 20,
  "token": "fCMregistrationTokenString...",
  "device_type": "android"
}
device_type accepted values: android, ios, web. Defaults to android.
Success Response (200)
{
  "status": 200,
  "message": "Firebase device token registered successfully."
}
GET 13. Check Subdomain — /dev-api/check-subdomain

CORS-only endpoint (no auth filter). Resolves the current request's HTTP Host header to an institution record, used by tenant frontends on startup.

Success Response (200)
{
  "status": 200,
  "data": {
    "institute_id": 4,
    "name": "Science Academy",
    "subdomain_name": "science-academy",
    "logo_url": "https://cdn.kiacademy.in/logos/science-academy.png"
  }
}
14. Standard Error Responses
HTTP CodeScenarioResponse Body
401Missing / invalid Bearer token{"status":401,"message":"Unauthorized"}
404Record not found{"status":404,"message":"Record not found."}
405Wrong HTTP method used{"status":405,"message":"Only POST requests are allowed."}
422Validation failure{"status":422,"message":"Validation failed","errors":{...}}
500Internal server error{"status":500,"message":"An unexpected error occurred."}
Student

Student Account Module

Endpoints covering student profile management, course discovery, cart & wishlist, payment checkout, lecture progress tracking, quiz assessments, enrollment history, certificates, and virtual classroom access.

1. User Profile
GET List All Users / Get User by ID
GET https://api.kiacademy.in/dev-api/users               # all users
GET https://api.kiacademy.in/dev-api/users/{user_id}      # single user
Response
{
  "status": 200,
  "data": {
    "user_id": 20,
    "first_name": "Mary",
    "last_name": "Jane",
    "email": "[email protected]",
    "role_id": 3,
    "user_status": "active",
    "profile_image": "uploads/avatars/mary.jpg"
  }
}

POST Create User Account — /dev-api/users/create
{
  "first_name": "Mary",
  "last_name": "Jane",
  "email": "[email protected]",
  "password": "SecurePass@1",
  "role_id": 3
}

POST Update Profile — /dev-api/users/update/{user_id}
Multipart form-data. Omit any fields you don't want to change.
{
  "first_name": "Mary",
  "last_name": "Jane",
  "bio": "Passionate learner",
  "date_of_birth": "2000-01-15",
  "mobile_number": "9876543210",
  "address": "Hyderabad, India",
  "profile_image": "<file>"
}

POST Change Password — /dev-api/users/changePassword
{
  "user_id": 20,
  "current_password": "OldPass@1",
  "new_password": "NewPass@2",
  "confirm_password": "NewPass@2"
}

POST Request Password Reset — /dev-api/users/request-password-reset
{ "email": "[email protected]" }

POST Confirm Password Reset — /dev-api/users/reset-password/{user_id}
{
  "token": "reset-token-from-email",
  "new_password": "NewPass@3",
  "confirm_password": "NewPass@3"
}

DELETE Delete User — /dev-api/users/delete/{user_id}
{ "status": 200, "message": "User deleted successfully." }
2. Student Extended Profile
GET Get Student Profile — /dev-api/students/{student_id}
{
  "status": 200,
  "data": {
    "student_id": 10,
    "user_id": 20,
    "date_of_birth": "2000-01-15",
    "bio": "Passionate learner",
    "student_mobile_number": "9876543210",
    "address": "Hyderabad"
  }
}

POST Update Student Extended Profile — /dev-api/students/update/{student_id}
{
  "date_of_birth": "2000-01-15",
  "bio": "Passionate learner",
  "student_mobile_number": "9876543210",
  "address": "Hyderabad, India"
}
2b. Students — Full CRUD (Admin)
GET List All Students — /dev-api/students
{
  "status": 200,
  "data": [
    { "student_id": 1, "user_id": 20, "bio": "Learner", "student_mobile_number": "9876543210" }
  ]
}

POST Create Student Profile (Admin) — /dev-api/students/create
{
  "user_id": 45,
  "bio": "New student profile",
  "student_mobile_number": "9876543210",
  "date_of_birth": "2001-05-20",
  "address": "Mumbai, India"
}

DELETE Delete Student Profile — /dev-api/students/delete/{student_id}
{ "status": 200, "message": "Student profile deleted." }
3. Course Discovery & Browsing
GET All Courses — /dev-api/courses
GET All Courses with Full Details — /dev-api/courses/all-courses
GET Single Course — /dev-api/courses/{course_id}
GET Latest Courses — /dev-api/courses/latest
GET Popular Courses — /dev-api/courses/popular
GET Live Courses — /dev-api/courses/livecourses
GET Webinars — /dev-api/webinars
GET Recommended Courses for User — /dev-api/courses/recomended/{user_id}
GET Recommended Courses (Alternative) — /dev-api/courses/recomended-course/{user_id}
Two distinct recommendation endpoints exist. recomended returns a general list; recomended-course returns personalized course cards based on enrollment history.
GET Course by ID + User/Institute Context — /dev-api/courses/{course_id}/{user_or_institute_id}

Fetches course details relative to a second identifier (user enrollment status or institute context).

GET Search Courses — /dev-api/courses/search-course/{query}
GET https://api.kiacademy.in/dev-api/courses/search-course/python
GET Search Courses inside Institute — /dev-api/courses/search-course-institute/{institute_id}/{query}
GET Course by Category inside Institute — /dev-api/courses/courseBycategoryInstitute/{institute_id}/{category_id}
GET Courses by Institute — /dev-api/courses/by-institute/{institute_id}
GET Course Total Duration — /dev-api/courses/course-duration/{course_id}
{
  "status": 200,
  "data": {
    "course_id": 1,
    "course_title": "Introduction to Python",
    "total_duration_seconds": 14400
  }
}
4. Course Categories
GET List All Categories — /dev-api/course-categories
GET Category by ID/Slug — /dev-api/course-categories/{id_or_slug}
GET Categories linked to a Course — /dev-api/course-categories/category-by-course/{course_id}
Response
{
  "status": 200,
  "data": [
    { "category_id": 1, "name": "Programming", "slug": "programming", "courses_count": 24 },
    { "category_id": 2, "name": "Design", "slug": "design", "courses_count": 11 }
  ]
}
5. Enrollments
GET All Enrollments (Admin) — /dev-api/enrollments
GET My Enrollments — /dev-api/enrollments/student/{student_id}
GET My Live Course Enrollments — /dev-api/enrollments/student-live-courses/{student_id}
GET Enrollments (Mobile) — /dev-api/enrollments/studentMobile/{student_id}
GET Enrollments by Institute — /dev-api/enrollments/studentByInstitute/{student_id}/{institute_id}
GET Enrollments by Course — /dev-api/enrollments/course/{course_id}

POST Enroll in a Course — /dev-api/enrollment/enroll
{
  "student_id": 20,
  "course_id": 5,
  "payment_id": 102
}
Success Response
{
  "status": 200,
  "message": "Enrolled successfully.",
  "enrollment_id": 87
}
6. Shopping Cart & Wishlist
POST Add to Cart — /dev-api/cart/add
{
  "user_id": 20,
  "course_id": 5,
  "quantity": 1
}

GET View Cart — /dev-api/cart/view/{user_id}
GET View Cart (Mobile) — /dev-api/cart/viewMobile/{user_id}
{
  "status": 200,
  "data": [
    { "cart_id": 3, "course_id": 5, "course_title": "Python Basics", "price": 49.99, "quantity": 1 }
  ],
  "total": 49.99
}

DELETE Remove Item from Cart — /dev-api/cart/remove/{user_id}/{course_id}
DELETE Clear Entire Cart — /dev-api/cart/clear/{user_id}

POST Add to Wishlist — /dev-api/wishlist/add
{
  "user_id": 20,
  "course_id": 7
}
GET View Wishlist — /dev-api/wishlist/view/{user_id}
GET View Wishlist (Mobile) — /dev-api/wishlist/viewMobile/{user_id}
DELETE Remove from Wishlist — /dev-api/wishlist/remove/{user_id}/{course_id}
DELETE Clear Wishlist — /dev-api/wishlist/clear/{user_id}
7. Payments & Coupons
POST Checkout (Stripe) — /dev-api/payment/checkout
{
  "user_id": 20,
  "course_ids": [5, 8],
  "coupon_code": "WELCOME20",
  "currency": "INR"
}
Response
{
  "status": 200,
  "checkout_url": "https://checkout.stripe.com/pay/cs_test_abc123...",
  "session_id": "cs_test_abc123..."
}

POST Process Payment (Direct) — /dev-api/payment/process
{
  "user_id": 20,
  "course_id": 5,
  "payment_method_id": "pm_1PaBC...",
  "amount": 4999,
  "currency": "INR",
  "payment_comes_from": "kiacademy"
}
payment_comes_from accepts strictly "kiacademy" or "ebook" (defaults to "kiacademy" if omitted).

POST Donation Payment — /dev-api/payment/donation
{
  "user_id": 20,
  "amount": 500,
  "currency": "INR",
  "message": "Keep up the great work!"
}

GET Payment Success Callback — /dev-api/payment/success
GET Payment Cancel Callback — /dev-api/payment/cancel
GET Payment History for User — /dev-api/payment/history/{user_id}
GET Courses in a Payment — /dev-api/payment/courses/{payment_id}
GET All Donations — /dev-api/payment/donations
GET Get Currency — /dev-api/payment/get-currency
GET Price Matrix by Region — /dev-api/payment/get-priceMatrix/{region}

POST Apply Coupon — /dev-api/payment/coupon-apply
{
  "coupon_code": "WELCOME20",
  "course_id": 5,
  "user_id": 20
}
Success Response
{
  "status": 200,
  "discount_type": "percentage",
  "discount_value": 20,
  "original_price": 4999,
  "final_price": 3999
}
POST Check Coupon Validity — /dev-api/payment/coupon-check/{coupon_code}
8. Lecture Progress Tracking
POST Record View Duration — /dev-api/lecture-view-status
{
  "user_id": 20,
  "course_id": 1,
  "section_id": 2,
  "lecture_id": 5,
  "total_duration": 900,
  "view_duration": 450,
  "is_completed": 0
}

POST Get Lecture View History — /dev-api/get-lecture-view-status
{
  "user_id": 20,
  "course_id": 1
}

POST Mark Lecture Complete/Incomplete — /dev-api/lecture-status
{
  "user_id": 20,
  "course_id": 1,
  "section_id": 2,
  "lecture_id": 5,
  "is_completed": 1
}

GET Last Viewed Lecture — /dev-api/last-viewed-lecture/{user_id}
{
  "status": 200,
  "data": {
    "course_id": 1,
    "section_id": 2,
    "lecture_id": 5,
    "view_duration": 450,
    "last_viewed_at": "2026-07-12 18:30:00"
  }
}
9. Quizzes & Assessments
GET All Quizzes — /dev-api/quizzes
GET Quizzes by Section — /dev-api/quizzes/{section_id}
GET Single Quiz — /dev-api/quizzes/quiz/{quiz_id}
GET Questions for Quiz — /dev-api/questions/{quiz_id}
{
  "status": 200,
  "data": [
    {
      "question_id": 6,
      "question_text": "What is OOP?",
      "answers": [
        { "answer_id": 9, "answer_text": "A programming paradigm", "is_correct": 1 },
        { "answer_id": 10, "answer_text": "A database system", "is_correct": 0 }
      ]
    }
  ]
}

GET Quiz Results — /dev-api/quiz-results
GET Quiz Result by Quiz & Student — /dev-api/quiz-results/{quiz_id}/{student_id}

POST Update Quiz Result — /dev-api/quiz-results/update/{result_id}
{
  "quiz_resources": "{\"score\":90,\"total_questions\":10,\"correct_answers\":9}"
}

POST Submit Quiz — /dev-api/quiz-results/create
{
  "course_id": 1,
  "student_id": 20,
  "quiz_id": 2,
  "quiz_resources": "{\"score\":80,\"total_questions\":10,\"correct_answers\":8}"
}
Success Response
{
  "status": 200,
  "message": "Quiz result saved.",
  "score": 80,
  "passed": true
}
10. Course Reviews
GET Reviews by Course — /dev-api/course-reviews/{course_id}
POST Submit Review — /dev-api/course-reviews/create
{
  "course_id": 5,
  "user_id": 20,
  "rating": 5,
  "review_text": "Excellent course! Very well structured."
}
POST Update Review — /dev-api/course-reviews/update/{review_id}
{
  "rating": 4,
  "review_text": "Updated: Good course overall."
}
DELETE Delete Review — /dev-api/course-reviews/delete/{review_id}
11. Certificates
GET Certificates Issued to Student — /dev-api/certificates/issuedto/{student_id}
GET Certificate by Course & User — /dev-api/certificates/bycourseuser/{course_id}/{user_id}
GET Validate Certificate Code — /dev-api/certificates/validate/{certificate_code}
{
  "status": 200,
  "valid": true,
  "data": {
    "certificate_id": 15,
    "student_name": "Mary Jane",
    "course_name": "Introduction to Python",
    "issue_date": "2026-07-02",
    "certificate_code": "KIAC-2026-0015"
  }
}
GET Certificate by ID — /dev-api/certificates/{cert_id}
12. Notifications
GET Received Notifications — /dev-api/notifications/received_notification/{user_id}
{
  "status": 200,
  "data": [
    {
      "notification_id": 10,
      "title": "Course Published",
      "message": "Your enrolled course 'Python Basics' has a new lesson.",
      "type": "info",
      "is_read": 0,
      "created_at": "2026-07-12 10:00:00"
    }
  ]
}
GET Notification by ID — /dev-api/notifications/{notification_id}
POST Mark as Read — /dev-api/notifications/update/{notification_id}
{ "is_read": 1 }
13. Live Classes & BigBlueButton
GET Upcoming Classes for Student — /dev-api/live-classes/upcoming-classes-for-student/{student_id}
{
  "status": 200,
  "data": [
    {
      "class_id": 3,
      "title": "Live: Python Data Structures",
      "meeting_id": "python-live-001",
      "scheduled_at": "2026-07-15 10:00:00",
      "instructor": "Dr. Smith"
    }
  ]
}

POST Join Live Class — /dev-api/live-classes/joinClass
{
  "student_id": 20,
  "class_id": 3
}

GET Join BBB Meeting as Attendee — /dev-api/bbb/join/{meeting_id}/{display_name}/ap
The third path segment ap is the attendee password key. The server constructs a signed SHA-1 URL and redirects or returns the join link.
GET https://api.kiacademy.in/dev-api/bbb/join/python-live-001/MaryJane/ap
Response
{
  "status": 200,
  "join_url": "https://class.kiacademy.in/api/join?meetingID=python-live-001&fullName=MaryJane&password=ap&checksum=..."
}
13b. Mobile Live Course Enrollments
GET Live Course Enrollments (Mobile) — /dev-api/enrollments/studentMobileLiveCourses/{student_id}

Returns live course enrollment data formatted for mobile clients. Includes streaming-optimised response payloads.

{
  "status": 200,
  "data": [
    {
      "enrollment_id": 55,
      "course_id": 12,
      "course_title": "Live: Machine Learning Masterclass",
      "course_type": "live",
      "next_class_at": "2026-07-20 09:00:00",
      "instructor": "Dr. Priya Sharma"
    }
  ]
}
14. Contact Us & SAP Enquiry
POST Submit Contact Form — /dev-api/contact_us/create
{
  "name": "Mary Jane",
  "email": "[email protected]",
  "subject": "Billing issue",
  "message": "I was charged twice for the same course."
}

GET List All Contact Submissions (Admin) — /dev-api/contact_us
{
  "status": 200,
  "data": [
    { "id": 1, "name": "John", "email": "[email protected]", "subject": "Billing", "message": "...", "created_at": "2026-07-10" }
  ]
}

POST SAP Course Enquiry — /dev-api/sap-enquiry
{
  "name": "Ravi Kumar",
  "email": "[email protected]",
  "phone": "9876543210",
  "course_interest": "SAP FICO",
  "message": "Please send me a brochure."
}

GET List All SAP Enquiries (Admin) — /dev-api/sap-enquiry
{
  "status": 200,
  "data": [
    { "id": 1, "name": "Ravi Kumar", "course_interest": "SAP FICO", "email": "[email protected]", "created_at": "2026-07-11" }
  ]
}
15. Digital E-Book & Student Subscriptions
GET Fetch E-Book Subscription Plans — /dev-api/subscription-plans/ebook
{
  "status": 200,
  "data": [
    {
      "id": 1,
      "plan_name": "Monthly Scholar Pass",
      "plan_description": "Full access to 50,000+ EPUB & PDF ebooks",
      "plan_price": 299.00,
      "plan_type": "ebook",
      "plan_medium": "month",
      "plan_duration": 1
    }
  ]
}

GET Fetch Student E-Book Subscription — /dev-api/subscriptions/student/{user_id}/ebook
{
  "status": 200,
  "data": [
    {
      "id": 12,
      "user_id": 15,
      "plan_id": 1,
      "plan_name": "Monthly Scholar Pass",
      "plan_type": "ebook",
      "start_date": "2026-07-25",
      "end_date": "2026-08-25",
      "status": "active"
    }
  ]
}

POST Create Student Subscription — /dev-api/subscriptions/student/create
{
  "user_id": 15,
  "plan_id": 1,
  "is_trial": 0,
  "payment_id": 102
}

POST Update Student Subscription — /dev-api/subscriptions/student/update/{subscription_id}
DELETE Cancel Student Subscription — /dev-api/subscriptions/student/delete/{subscription_id}
16. E-Book Categories & E-Book Catalog CRUD
GET List E-Book Categories — /dev-api/ebook-categories
POST Create E-Book Category — /dev-api/ebook-categories/create
{
  "name": "Computer Science & Engineering",
  "description": "Programming, Algorithms, Data Science and AI textbooks",
  "status": "active"
}

GET List All E-Books — /dev-api/ebooks
Supports query filters: ?category_id=1&is_free=0&is_approved=1&status=active&featured=1&search=python
GET Single E-Book Details — /dev-api/ebooks/{id}

POST Create E-Book — /dev-api/ebooks/create
{
  "category_id": 1,
  "title": "Mastering Python Architecture",
  "slug": "mastering-python-architecture",
  "description": "Comprehensive guide to building scalable backend systems.",
  "author": "Dr. Alex Rivera",
  "cover_image": "https://cdn.kiacademy.in/covers/python-arch.jpg",
  "file_url": "https://cdn.kiacademy.in/books/python-arch.pdf",
  "file_type": "pdf",
  "file_size": "14.2 MB",
  "language": "en",
  "pages": 420,
  "publisher": "KIAcademy Publishing",
  "publication_date": "2026-01-15",
  "price": 349.00,
  "currency": "INR",
  "is_free": 0,
  "featured": 1,
  "status": "active",
  "is_approved": 1,
  "seo_title": "Mastering Python Architecture Ebook",
  "seo_description": "Learn scalable backend design patterns.",
  "metadata": "{\"edition\":\"2nd Edition\",\"isbn\":\"978-3-16-148410-0\"}"
}

POST Update E-Book — /dev-api/ebooks/update/{id}
POST Approve E-Book (Admin) — /dev-api/ebooks/approve/{id}
DELETE Delete E-Book — /dev-api/ebooks/delete/{id}
POST Increment View Count — /dev-api/ebooks/view/{id}
POST Increment Download Count — /dev-api/ebooks/download/{id}
17. Reading History, Progress, Bookmarks & Wishlist
POST Save / Update Reading History — /dev-api/user/reading-history
{
  "user_id": 273,
  "book_id": "gutenberg-78009",
  "source_id": "78009",
  "source": "gutenberg",
  "source_label": "Project Gutenberg",
  "title": "A guide to the history of physical education",
  "author": "Leonard, Fred Eugene",
  "cover": "https://www.gutenberg.org/cache/epub/78009/pg78009.cover.medium.jpg",
  "epub_url": "https://www.gutenberg.org/cache/epub/78009/pg78009.epub",
  "read_url": "https://www.gutenberg.org/cache/epub/78009/pg78009.epub",
  "subjects": ["Physical education and training"],
  "description": "A guide to physical education...",
  "opened_at": "2026-07-27T10:48:20.264Z"
}
GET Fetch Reading History — /dev-api/user/reading-history/{user_id}

POST Save Reading Progress — /dev-api/user/reading-progress
{
  "user_id": 273,
  "book_id": "gutenberg-78009",
  "cfi": "epubcfi(/6/14!/4/2/4[pgepubid00000]/1:0)",
  "percent": 35.50
}
GET Fetch Reading Progress — /dev-api/user/reading-progress/{user_id}/{book_id}

POST Add Bookmark — /dev-api/user/bookmarks
{
  "user_id": 273,
  "book_id": "gutenberg-78009",
  "cfi": "epubcfi(/6/14!/4/2/4[pgepubid00000]/1:0)",
  "label": "Chapter 2 - Page 35%",
  "percent": 35.50
}
POST Delete Bookmark — /dev-api/user/bookmarks/delete
GET Fetch Bookmarks — /dev-api/user/bookmarks/{user_id}/{book_id}

POST Toggle Wishlist — /dev-api/user/wishlist/toggle
{
  "user_id": 273,
  "book_id": "gutenberg-78009",
  "title": "A guide to physical education",
  "author": "Leonard, Fred Eugene",
  "cover": "https://www.gutenberg.org/cache/epub/78009/pg78009.cover.medium.jpg"
}
GET Fetch Wishlist — /dev-api/user/wishlist/{user_id}
Instructor

Instructor Account Module

Endpoints for instructor onboarding (KYC), payout configuration, course & curriculum creation (sections, lectures, resources, quizzes), video chunked upload, virtual classroom scheduling, and analytics.

1. Instructor Profile & KYC
GET Instructor Profile — /dev-api/instructor/{user_id}
GET All Tutors — /dev-api/tutor
GET Tutors by Segment — /dev-api/tutor/{segment}
GET Tutor with Course Creator Details — /dev-api/course-tutor/{segment}

POST Submit / Update KYC — /dev-api/users/updateKyc/{user_id}
Send as multipart/form-data.
FieldTypeRequiredDescription
id_document_typestringYespassport, aadhaar, pan, driving_license
id_document_numberstringYesDocument ID number
biostringYesProfessional biography
job_titlestringYesTeaching subject/title
document_imagefileYesPDF/JPG/PNG of ID document
Success Response
{
  "status": 200,
  "message": "KYC submitted. Pending admin review."
}
2. Instructor Sub-Resources
GET Skills — /dev-api/instructor/skills/{user_id}
GET Analytics — /dev-api/instructor/analytics/{user_id}
{
  "status": 200,
  "data": {
    "total_students": 142,
    "total_courses": 8,
    "average_rating": 4.7,
    "total_revenue": 52800.00
  }
}
GET Settings — /dev-api/instructor/settings/{user_id}
GET Payments (Instructor) — /dev-api/instructor/payments/{user_id}
GET Reviews (Instructor) — /dev-api/instructor/reviews/{user_id}
3. Bank Details & Payout Configuration
GET My Bank Details — /dev-api/bank-details/show/{user_id}
GET All Bank Details (Admin) — /dev-api/bank-details/showAll
POST Create Bank Details — /dev-api/bank-details/create
{
  "user_id": 2,
  "account_holder_name": "Dr. John Doe",
  "account_number": "1234567890",
  "bank_name": "HDFC Bank",
  "ifsc_code": "HDFC0001234",
  "routing_number": "Optional-for-international",
  "upi_id": "johndoe@upi"
}
POST Update Bank Details — /dev-api/bank-details/update/{id}
POST Update Payout Status — /dev-api/bank-details/updatePayout/{id}
4. Earnings & Payout History
GET All Transactions for Instructor's Courses — /dev-api/transactions/{instructor_id}
GET Total Earnings — /dev-api/earnings/{instructor_id}
{
  "status": 200,
  "data": {
    "total_earnings": 52800.00,
    "pending_payout": 12500.00,
    "paid_out": 40300.00
  }
}
GET Payout History — /dev-api/payouts/{instructor_id}
{
  "status": 200,
  "data": [
    {
      "payout_id": 1,
      "amount": 12500.00,
      "status": "paid",
      "payment_method": "Bank Transfer",
      "transaction_ref": "TXN_78945612",
      "paid_at": "2026-07-01 14:00:00"
    }
  ]
}
GET All Global Payments (Admin) — /dev-api/payments
GET Payments by Institute — /dev-api/payments/{institute_id}
5. Course Management
GET Courses by Instructor — /dev-api/courses/by-instructor/{user_id}
GET Instructor Courses — /dev-api/instructor/courses/{user_id}
GET Live Courses by Instructor — /dev-api/live-courses/live-courses-by-instructor/{user_id}
GET Webinars by Instructor — /dev-api/webinars/webinars-by-instructor/{user_id}

POST Create Course Draft — /dev-api/courses/create
Send as multipart/form-data.
FieldTypeRequiredNotes
course_titlestringYes
course_descriptionstringYesRich text / plain text
course_levelenumYesbeginner, intermediate, advanced
course_priceintegerNoPrice tier index (0 = free)
category_idintegerNo
course_thumbnailfileNoJPG/PNG, max 2MB
course_intro_videofile/stringNoMP4 file or Vimeo ID
languagestringNoe.g. English

POST Update Course — /dev-api/courses/update/{course_id}
Same fields as create; only send fields to update.

POST Request Admin Approval to Publish — /dev-api/courses/course-approval-request/{course_id}
DELETE Delete Course — /dev-api/courses/delete/{course_id}

Course Assignment (Institution–Instructor)
GET Assigned Courses for Instructor in Institute — /dev-api/courses/get-assigned-course/{course_id}/{instructor_id}
GET Instructors Assigned to Course — /dev-api/courses/get-instructors-assigned-to-course/{course_id}/{institute_id}
POST Assign Course to Instructor — /dev-api/courses/assign-course
{
  "course_id": 5,
  "institute_id": 4,
  "assigned_to": 12,
  "assigned_by": 4
}
POST Unassign Course — /dev-api/courses/unassign-course
{
  "course_id": 5,
  "institute_id": 4,
  "assigned_to": 12
}
6. Course Additional Information
GET All Additional Info for Course — /dev-api/courses/{course_id}/additional
POST Create Additional Info — /dev-api/courses/{course_id}/additional/create
{
  "type": "requirement",
  "content": "Basic knowledge of Python 2"
}

type can be: requirement, what_you_will_learn, who_is_this_for, etc.

POST Update Additional Info — /dev-api/courses/{course_id}/additional/update/{info_id}
DELETE Delete Additional Info — /dev-api/courses/{course_id}/additional/delete/{info_id}
7. Course Sections
GET All Sections — /dev-api/course-sections
GET Section by ID — /dev-api/course-sections/{section_id}
GET Sections by Course — /dev-api/course-sections/by-course/{course_id}
POST Create Section — /dev-api/course-sections/create
{
  "course_id": 5,
  "title": "Module 1: Python Foundations",
  "order": 1
}
POST Update Section — /dev-api/course-sections/update/{section_id}
{
  "title": "Module 1: Python Foundations (Updated)",
  "order": 1
}
DELETE Delete Section — /dev-api/course-sections/delete/{section_id}
8. Lectures
GET Lecture by ID — /dev-api/lectures/{lecture_id}
GET Lectures by Section — /dev-api/lectures/by-section/{section_id}
POST Create Lecture — /dev-api/lectures/create
{
  "section_id": 3,
  "lecture_title": "Lesson 1: Variables & Data Types",
  "lecture_video_url": "172368971_7cdee4fd.mp4",
  "is_preview": 0,
  "order": 1
}
POST Update Lecture — /dev-api/lectures/update/{lecture_id}
{
  "lecture_title": "Lesson 1: Variables & Data Types (v2)",
  "is_preview": 1
}
DELETE Delete Lecture — /dev-api/lectures/delete/{lecture_id}
9. Lecture Resources (Downloadable)
GET Resources for Lecture — /dev-api/lecture-resources/{lecture_id}
GET Specific Resource — /dev-api/lecture-resources/resource/{resource_id}
GET Resources by Type — /dev-api/lecture-resources/type/{type}
type values: document, video, url, image, audio

POST Upload Lecture Resource — /dev-api/lecture-resources/create
Send as multipart/form-data.
FieldTypeRequired
lecture_idintegerYes
resource_titlestringYes
resource_typeenumYes
resource_filefileYes (if type=document/image)
resource_urlstringYes (if type=url)
POST Update Resource — /dev-api/lecture-resources/update/{resource_id}
DELETE Delete Resource — /dev-api/lecture-resources/delete/{resource_id}
10. Recorded Lecture Resources
GET Resources by Lecture — /dev-api/recorded-lecture-resources/{lecture_id}
GET Single Recorded Resource — /dev-api/recorded-lecture-resources/resource/{resource_id}
GET By Type — /dev-api/recorded-lecture-resources/type/{type}
POST Create Recorded Resource — /dev-api/recorded-lecture-resources/create
{
  "lecture_id": 5,
  "resource_title": "Session Recording - Day 1",
  "resource_type": "video",
  "resource_url": "https://cdn.kiacademy.in/recordings/session-day1.mp4"
}
POST Update — /dev-api/recorded-lecture-resources/update/{resource_id}
DELETE Delete — /dev-api/recorded-lecture-resources/delete/{resource_id}
11. Resumable Video Upload

Lecture videos are uploaded in chunks for reliability. The client checks upload status first, uploads chunks in sequence, then triggers a server-side merge.

GET Check Upload Status — /dev-api/videos/upload-status
GET https://api.kiacademy.in/dev-api/videos/upload-status?filename=lecture_video.mp4&upload_id=abc123
{
  "status": 200,
  "uploaded_chunks": [1, 2, 3],
  "total_chunks": 10
}

POST Upload Single Chunk — /dev-api/videos/upload-chunk
Send as multipart/form-data.
FieldTypeDescription
upload_idstringUnique upload session identifier
chunk_indexintegerZero-based chunk sequence number
total_chunksintegerTotal number of chunks
filenamestringOriginal filename
chunkfileBinary chunk data

POST Merge Chunks — /dev-api/videos/merge-chunks
{
  "upload_id": "abc123",
  "filename": "lecture_video.mp4",
  "total_chunks": 10
}
Success Response
{
  "status": 200,
  "message": "Video merged successfully.",
  "file_path": "uploads/videos/lecture_video.mp4"
}

GET Stream Video — /dev-api/videos/stream/{filename}/{path}
Supports HTTP Range headers for seeking. Used by the video player.
12. Quiz & Question Authoring
POST Create Quiz — /dev-api/quizzes/create
{
  "section_id": 3,
  "title": "Module 1 Assessment",
  "description": "Test your understanding of Python basics.",
  "time_limit": 15
}
POST Update Quiz — /dev-api/quizzes/update/{quiz_id}
DELETE Delete Quiz — /dev-api/quizzes/delete/{quiz_id}

POST Create Question with Answers — /dev-api/questions/create
{
  "quiz_id": 2,
  "question_text": "Which keyword defines a function in Python?",
  "answers": [
    { "answer_text": "def", "is_correct": 1 },
    { "answer_text": "function", "is_correct": 0 },
    { "answer_text": "func", "is_correct": 0 },
    { "answer_text": "define", "is_correct": 0 }
  ]
}
POST Update Question — /dev-api/questions/update/{question_id}
{
  "question_text": "Which keyword is used to define a function in Python?",
  "answers": [
    { "answer_id": 9, "answer_text": "def", "is_correct": 1 },
    { "answer_id": 10, "answer_text": "function", "is_correct": 0 }
  ]
}
DELETE Delete Question — /dev-api/questions/delete/{question_id}
13. Virtual Classroom — BigBlueButton
POST Create BBB Meeting — /dev-api/bbb/create
{
  "meeting_id": "python-class-001",
  "name": "Python Live Session - Variables",
  "attendee_pw": "attendee_password",
  "moderator_pw": "moderator_password",
  "welcome_msg": "Welcome to Python Live!",
  "record": 1,
  "duration": 60
}
Response
{
  "status": 200,
  "meeting_id": "python-class-001",
  "message": "Meeting created successfully."
}

GET Join as Moderator — /dev-api/bbb/join/{meeting_id}/{display_name}/mp
GET https://api.kiacademy.in/dev-api/bbb/join/python-class-001/DrSmith/mp

POST End Meeting — /dev-api/bbb/end/{meeting_id}
GET Meeting Info — /dev-api/bbb/info/{meeting_id}
GET List All Meetings — /dev-api/bbb/list
GET Get Recordings — /dev-api/bbb/recordings
14. Live Class Scheduler
GET All Live Classes — /dev-api/live-classes
GET Live Class by ID — /dev-api/live-classes/{class_id}
GET Classes by Section — /dev-api/live-classes/by-section/{section_id}
GET Upcoming Classes (Instructor) — /dev-api/live-classes/upcoming-classes-for-instructor/{instructor_id}
GET Class Recordings — /dev-api/live-classes/getRecordings/{meeting_id}

POST Schedule Live Class — /dev-api/live-classes/create
{
  "section_id": 3,
  "title": "Live: Python Data Structures",
  "meeting_id": "python-ds-live-001",
  "scheduled_at": "2026-07-20 10:00:00",
  "duration_minutes": 90,
  "attendee_pw": "student123",
  "moderator_pw": "tutor456"
}
POST Update Live Class — /dev-api/live-classes/update/{class_id}
DELETE Delete Live Class — /dev-api/live-classes/delete/{class_id}
15. Platform Analytics
GET Total Counts — /dev-api/analytics/total-counts
GET Total Counts by Institution — /dev-api/analytics/total-counts-by-institution/{institute_id}
GET Students Enrolled in Instructor Courses — /dev-api/analytics/students-enrolled-in-instructor-courses/{instructor_id}
GET Total Revenue — /dev-api/analytics/total-revenue/{currency}
GET https://api.kiacademy.in/dev-api/analytics/total-revenue/INR
GET Average Course Ratings — /dev-api/analytics/average-course-ratings
GET Monthly Enrollment Trends — /dev-api/analytics/monthly-enrollment-trends
GET Course Enrollment Status — /dev-api/analytics/course-enrollment-status
16. E-Book Categories & E-Book Catalog CRUD
GET List E-Book Categories — /dev-api/ebook-categories
GET List E-Books — /dev-api/ebooks
Query filters: ?category_id=1&is_free=0&is_approved=1&status=active&featured=1&search=python
GET E-Book Details — /dev-api/ebooks/{id}
POST Create E-Book — /dev-api/ebooks/create
POST Update E-Book — /dev-api/ebooks/update/{id}
DELETE Delete E-Book — /dev-api/ebooks/delete/{id}
Institution

Institution Account Module

Endpoints for managing institution profiles, subdomain tenant configurations, registered staff & student lookup, course mapping to instructors, online class scheduling within the tenant, and service subscription billing.

1. Institution Registration & Profile
GET All Institutions — /dev-api/institutions
GET Institution by ID — /dev-api/institutions/{institute_id}
{
  "status": 200,
  "data": {
    "institute_id": 4,
    "name": "Science Academy India",
    "email": "[email protected]",
    "subdomain_name": "science-academy",
    "contact_number": "+91-9876543210",
    "registration_number": "REG2024001",
    "status": "active",
    "logo_url": "https://cdn.kiacademy.in/logos/science-academy.png"
  }
}

GET Institutions linked to User — /dev-api/institutions/getInstitutesByUser/{user_id}
{
  "status": 200,
  "data": [
    { "institute_id": 4, "name": "Science Academy India" },
    { "institute_id": 7, "name": "Tech Hub Institute" }
  ]
}

POST Register New Institution — /dev-api/institutions/create
Send as multipart/form-data.
FieldTypeRequiredDescription
namestringYesFull institution name
emailstringYesOfficial contact email
subdomain_namestringYesUnique subdomain slug (lowercase, hyphens only)
contact_numberstringYesPrimary contact phone
registration_numberstringYesGovernment registration ID
tin_numberstringYesTax Identification Number
logofileNoJPG/PNG institution logo
supporting_documentfileYesRegistration certificate PDF
tax_documentfileYesGST / Tax cert PDF
Success Response
{
  "status": 200,
  "message": "Institution registered. Pending admin verification.",
  "institute_id": 11
}

POST Update Institution — /dev-api/institutions/update/{institute_id}
Same fields as create; omit any fields you don't want to update.

DELETE Delete Institution — /dev-api/institutions/delete/{institute_id}
{
  "status": 200,
  "message": "Institution deleted successfully."
}
2. Subdomain Mapping & Tenant Resolution
GET Subdomain Details by Institution — /dev-api/institutions/getSubdomainByInstituteId/{institute_id}
{
  "status": 200,
  "data": {
    "subdomain_name": "science-academy",
    "domain_url": "https://science-academy.kiacademy.in",
    "institute_id": 4,
    "name": "Science Academy India",
    "status": "active",
    "theme_color": "#1a73e8"
  }
}

GET Check Subdomain (no auth required) — /dev-api/check-subdomain

Called by frontend on load to resolve the current Host header to an institution. This route only has the CORS filter (no auth filter).

{
  "status": 200,
  "data": {
    "institute_id": 4,
    "name": "Science Academy India",
    "subdomain_name": "science-academy",
    "logo_url": "https://cdn.kiacademy.in/logos/science-academy.png",
    "primary_color": "#1a73e8"
  }
}
3. Staff & Student Management
GET All Users under Institution — /dev-api/institutions/getUsersByInstitutes/{institute_id}
{
  "status": 200,
  "data": [
    {
      "user_id": 91,
      "first_name": "Amir",
      "last_name": "Ahmed",
      "email": "[email protected]",
      "role_id": 2,
      "role_name": "Instructor",
      "user_status": "active"
    },
    {
      "user_id": 97,
      "first_name": "Ahmed",
      "last_name": "Raza",
      "email": "[email protected]",
      "role_id": 3,
      "role_name": "Student",
      "user_status": "active"
    }
  ]
}

GET Enrollments for Student in Institution — /dev-api/enrollments/studentByInstitute/{student_id}/{institute_id}
{
  "status": 200,
  "data": [
    {
      "enrollment_id": 42,
      "course_id": 5,
      "course_title": "Python Basics",
      "enrolled_at": "2026-06-01",
      "completion_percentage": 68
    }
  ]
}

GET Get List of All Institutes (for User) — /dev-api/users/institutes
4. Online Classes within Institution
GET Online Classes for Institution — /dev-api/institutions/getOnlineClasses/{institute_id}
{
  "status": 200,
  "data": [
    {
      "class_id": 3,
      "title": "Live: Science Lab Session",
      "meeting_id": "science-lab-001",
      "instructor_name": "Dr. Amir Ahmed",
      "scheduled_at": "2026-07-20 09:00:00",
      "duration_minutes": 60
    }
  ]
}
5. Course Assignment to Instructors
GET Assigned Courses for Institute — /dev-api/courses/assigned-institute/{institute_id}
{
  "status": 200,
  "data": [
    {
      "course_id": 5,
      "course_title": "Python Basics",
      "assigned_to_user_id": 91,
      "assigned_to_name": "Amir Ahmed",
      "assigned_at": "2026-06-15"
    }
  ]
}

GET Courses by Institute — /dev-api/courses/by-institute/{institute_id}
GET Assigned Instructors for Course — /dev-api/courses/get-instructors-assigned-to-course/{course_id}/{institute_id}

POST Assign Course to Instructor — /dev-api/courses/assign-course
{
  "course_id": 5,
  "institute_id": 4,
  "assigned_to": 91,
  "assigned_by": 4
}
Success Response
{
  "status": 200,
  "message": "Course assigned to instructor successfully."
}

POST Unassign Course — /dev-api/courses/unassign-course
{
  "course_id": 5,
  "institute_id": 4,
  "assigned_to": 91
}
6. Subscription Plans
GET All Plans — /dev-api/subscription-plans
GET Plans by Type — /dev-api/subscription-plans/type/{plan_type} (e.g. ebook or kiacademy)
{
  "status": 200,
  "data": [
    {
      "id": 1,
      "plan_name": "Basic Ebook Plan",
      "plan_description": "Unlimited access to foundational ebooks.",
      "plan_price": 9.99,
      "plan_type": "ebook",
      "plan_medium": "month",
      "plan_duration": 1,
      "tutors_allowed": 0,
      "courses_allowed": 0,
      "storage_allowed": 10
    }
  ]
}

GET Plan by ID — /dev-api/subscription-plans/{plan_id}
POST Create Plan (Admin) — /dev-api/subscription-plans/create
{
  "plan_name": "Ebook Premium",
  "plan_description": "Full access to all ebooks and downloads",
  "plan_price": 14.99,
  "plan_type": "ebook",
  "plan_medium": "month",
  "plan_duration": 1
}
POST Update Plan — /dev-api/subscription-plans/update/{plan_id}
DELETE Delete Plan — /dev-api/subscription-plans/delete/{plan_id}
7. Active Subscriptions
GET All Subscriptions (Admin) — /dev-api/subscriptions
GET Subscriptions by Plan Type — /dev-api/subscriptions/type/{plan_type} (e.g. ebook)
GET Subscription by ID — /dev-api/subscriptions/{subscription_id}
GET Subscription by Institute — /dev-api/subscriptions/institute/{institute_id}

Student & Ebook Subscription Endpoints
GET All Student Subscriptions — /dev-api/subscriptions/student
GET Student Subscriptions by User ID — /dev-api/subscriptions/student/{user_id}
GET Student Ebook Subscriptions — /dev-api/subscriptions/student/{user_id}/ebook
{
  "status": 200,
  "data": [
    {
      "id": 1,
      "user_id": 15,
      "plan_id": 5,
      "plan_name": "Monthly Ebook Pass",
      "plan_type": "ebook",
      "start_date": "2026-07-25",
      "end_date": "2026-08-25",
      "status": "active"
    }
  ]
}
POST Subscribe Student — /dev-api/subscriptions/student/create
{
  "user_id": 15,
  "plan_id": 5,
  "is_trial": 0,
  "payment_id": 102
}
POST Update Student Subscription — /dev-api/subscriptions/student/update/{id}
DELETE Cancel Student Subscription — /dev-api/subscriptions/student/delete/{id}

POST Subscribe Institute to a Plan — /dev-api/subscriptions/create
{
  "institute_id": 4,
  "plan_id": 2,
  "payment_id": 99
}
POST Update Institute Subscription — /dev-api/subscriptions/update/{subscription_id}
DELETE Cancel / Delete Institute Subscription — /dev-api/subscriptions/delete/{subscription_id}
8. E-Book Categories & Catalog Management
GET All E-Book Categories — /dev-api/ebook-categories
POST Create E-Book Category — /dev-api/ebook-categories/create

GET List All E-Books — /dev-api/ebooks
Query filters: ?category_id=1&is_free=0&is_approved=1&status=active&featured=1&search=python
GET Get E-Book Details — /dev-api/ebooks/{id}
POST Create E-Book — /dev-api/ebooks/create
POST Update E-Book — /dev-api/ebooks/update/{id}
DELETE Delete E-Book — /dev-api/ebooks/delete/{id}
Administrator

Administrator Module

Restricted endpoints for global system managers: multi-role dashboard metrics, course approval pipelines, user account lifecycle, certificate lifecycle, coupon management, broadcast notifications, email triggers, and financial auditing.

1. Role-Specific Dashboards
GET Global Admin Dashboard — /dev-api/dashboard
{
  "status": 200,
  "data": {
    "total_users": 342,
    "total_admins": 4,
    "total_students": 200,
    "total_instructors": 85,
    "total_institutes": 18,
    "total_sub_admins": 10,
    "total_courses": 91,
    "total_published_courses": 62,
    "total_pending_courses": 29,
    "total_pending_tutors": 7,
    "total_active_users": 280,
    "total_payouts": 24
  }
}

GET Institute Dashboard — /dev-api/dashboard/institute/{institute_id}
{
  "status": 200,
  "data": {
    "total_instructors": 12,
    "total_students": 85,
    "total_courses": 18,
    "active_subscriptions": 1,
    "total_revenue": 42500.00
  }
}

GET Sub-Admin Dashboard — /dev-api/dashboard/subadmin/{user_id}
{
  "status": 200,
  "data": {
    "managed_courses": 10,
    "pending_course_reviews": 4,
    "flagged_users": 2
  }
}

GET Individual Tutor Dashboard — /dev-api/dashboard/individual-tutor/{user_id}
{
  "status": 200,
  "data": {
    "total_courses": 6,
    "total_students": 142,
    "total_earnings": 52800.00,
    "pending_payout": 12500.00,
    "average_rating": 4.7
  }
}

GET Institute-Tutor Dashboard — /dev-api/dashboard/institute-tutor/{user_id}
{
  "status": 200,
  "data": {
    "institute_name": "Science Academy India",
    "assigned_courses": 4,
    "total_students_in_courses": 60,
    "upcoming_live_classes": 2
  }
}
2b. Enrollments by Instructor
GET All Enrollments by Instructor — /dev-api/enrollments/instructor/{instructor_id}
{
  "status": 200,
  "data": [
    { "enrollment_id": 42, "student_id": 20, "course_id": 5, "course_title": "Python Basics", "enrolled_at": "2026-06-01" },
    { "enrollment_id": 87, "student_id": 33, "course_id": 5, "course_title": "Python Basics", "enrolled_at": "2026-06-15" }
  ],
  "total": 2
}
2. User Account Management
GET All Users — /dev-api/users
GET User by ID — /dev-api/users/{user_id}

POST Create User Account — /dev-api/users/create
{
  "first_name": "Admin",
  "last_name": "User",
  "email": "[email protected]",
  "password": "SecureAdmin@123",
  "role_id": 1
}

POST Update User Status — /dev-api/users/update-status/{user_id}
{
  "user_status": "active"
}
Accepted user_status values: active, inactive, pending, suspended.
Success Response
{
  "status": 200,
  "message": "User status updated to active."
}

Note on Duplicate Route: POST /dev-api/users/switchRole is a second alias for role switching (same handler as /dev-api/user/switch-role). Prefer /dev-api/user/switch-role for new integrations.

DELETE Delete User — /dev-api/users/delete/{user_id}
⚠️ Permanently removes user and all associated records. Cannot be undone.

POST Update User Profile — /dev-api/users/update/{user_id}
Can update any field including role_id when performed by an admin.
3. Course Review & Publishing Lifecycle
GET Courses Pending Admin Review — /dev-api/courses/tutor/requested
{
  "status": 200,
  "data": [
    {
      "course_id": 45,
      "course_title": "Advanced React Patterns",
      "instructor_name": "Jane Doe",
      "submitted_at": "2026-07-10 12:00:00",
      "approval_status": "pending"
    }
  ]
}

POST Publish Course — /dev-api/courses/publish/{course_id}
{
  "status": 200,
  "message": "Course published successfully."
}

POST Unpublish / Suspend Course — /dev-api/courses/unpublish/{course_id}
{
  "status": 200,
  "message": "Course unpublished. Students cannot enroll until re-published."
}

DELETE Delete Course — /dev-api/courses/delete/{course_id}
4. Certificate Management
GET All Certificates — /dev-api/certificates
GET Certificate by ID — /dev-api/certificates/{cert_id}
GET Certificates Issued to Student — /dev-api/certificates/issuedto/{student_id}
GET Certificate by Course & User — /dev-api/certificates/bycourseuser/{course_id}/{user_id}
GET Validate Certificate Code — /dev-api/certificates/validate/{certificate_code}

POST Issue Certificate — /dev-api/certificates
The system generates an SVG certificate using the template, converts it to PDF using Inkscape/rsvg-convert/Imagick in order of availability.
{
  "student_id": 20,
  "course_id": 5,
  "issue_date": "2026-07-13",
  "template_id": 2
}
Success Response
{
  "status": 200,
  "message": "Certificate issued successfully.",
  "certificate_code": "KIAC-2026-0085",
  "certificate_url": "https://cdn.kiacademy.in/certificates/KIAC-2026-0085.pdf"
}

POST Update Certificate — /dev-api/certificates/update/{cert_id}
DELETE Revoke / Delete Certificate — /dev-api/certificates/delete/{cert_id}
⚠️ Revoking a certificate invalidates its public verification link.
5. Course Categories (Admin CRUD)
GET All Categories — /dev-api/course-categories
GET Category by ID or Slug — /dev-api/course-categories/{id_or_slug}
GET Categories for Course — /dev-api/course-categories/category-by-course/{course_id}

POST Create Category — /dev-api/course-categories/create
{
  "name": "Cloud Computing",
  "slug": "cloud-computing",
  "description": "Cloud infrastructure and services",
  "icon": "fa-cloud"
}
Success Response
{ "status": 200, "message": "Category created.", "category_id": 12 }

POST Update Category — /dev-api/course-categories/update/{id_or_slug}
{
  "name": "Cloud Computing & DevOps",
  "description": "Updated description"
}

DELETE Delete Category — /dev-api/course-categories/delete/{id_or_slug}
⚠️ Deleting a category unlinks all courses assigned to it.
5. Coupon Management
GET All Coupons — /dev-api/coupons
GET Coupon by ID — /dev-api/coupons/{coupon_id}
{
  "status": 200,
  "data": {
    "coupon_id": 3,
    "code": "WELCOME20",
    "discount_type": "percentage",
    "discount_value": 20,
    "max_uses": 500,
    "used_count": 142,
    "valid_from": "2026-01-01",
    "valid_until": "2026-12-31",
    "is_active": 1
  }
}

POST Create Coupon — /dev-api/coupons/create
{
  "code": "SUMMER30",
  "discount_type": "percentage",
  "discount_value": 30,
  "max_uses": 1000,
  "valid_from": "2026-06-01",
  "valid_until": "2026-08-31",
  "applicable_courses": [5, 8, 12],
  "is_active": 1
}
Success Response
{
  "status": 200,
  "message": "Coupon SUMMER30 created successfully.",
  "coupon_id": 8
}

POST Update Coupon — /dev-api/coupons/update/{coupon_id}
{
  "discount_value": 25,
  "valid_until": "2026-09-30",
  "is_active": 0
}
DELETE Delete Coupon — /dev-api/coupons/delete/{coupon_id}
6. Notification Broadcasting
GET All Notifications — /dev-api/notifications
GET Notification by ID — /dev-api/notifications/{notification_id}
GET Notifications Sent by User — /dev-api/notifications/sent_notification/{sender_id}
GET Notifications Received by User — /dev-api/notifications/received_notification/{user_id}

POST Create & Broadcast Notification — /dev-api/notifications/create
{
  "sender_id": 1,
  "receiver_id": null,
  "role_id": 3,
  "title": "Scheduled Maintenance",
  "message": "The platform will undergo maintenance on July 20 from 12AM-2AM UTC.",
  "type": "alert",
  "sent_to": "all_students"
}
Set receiver_id to a specific user ID, or set sent_to to all, all_students, all_instructors, or all_institutions for mass broadcast.
Success Response
{
  "status": 200,
  "message": "Notification sent to 200 users.",
  "notification_id": 45
}

POST Tutor Specific Notification — /dev-api/notifications/toturcreate
{
  "sender_id": 1,
  "tutor_id": 12,
  "title": "KYC Approved",
  "message": "Your KYC documents have been verified. You can now publish courses.",
  "type": "success"
}

POST Update Notification — /dev-api/notifications/update/{notification_id}
{ "is_read": 1 }
DELETE Delete Notification — /dev-api/notifications/delete/{notification_id}
7. Transactional Email Triggers
These routes do not require the auth filter. They are called server-to-server.
GET Verify Email via Link — /verify-email/{token}

Confirms a new user's email address. Sent automatically after registration.


POST Send Verification Email — /send-verification-email
{
  "user_id": 20,
  "email": "[email protected]"
}

POST Send KYC Verification Email — /send-kyc-verification-email
{
  "user_id": 12,
  "email": "[email protected]",
  "status": "approved"
}

POST Send Promotional Email — /send-promotional-email
{
  "email": "[email protected]",
  "subject": "🎉 New Courses Available!",
  "html_body": "<h1>Check out our latest courses</h1>"
}

POST Send Course Update Email — /send-course-update-email
{
  "course_id": 5,
  "subject": "New lesson added to Python Basics",
  "message": "A new lesson on List Comprehensions has been added."
}

POST Send New Device Login Alert — /send-new-device-login-email
{
  "user_id": 20,
  "email": "[email protected]",
  "device": "Chrome on Windows 11",
  "ip": "203.0.113.42",
  "location": "Hyderabad, India",
  "login_at": "2026-07-13 14:30:00"
}
8. Financial Audit & Transactions
GET Admin All Transactions & Analytics — /dev-api/admin/transactions
Query Parameters: category (all | courses | ebook | subscription | donations), buyer_type (student | institute), search, start_date, end_date, page, per_page
{
  "status": 200,
  "summary": {
    "total_gross_amount": 150000,
    "total_tax_amount": 18000,
    "total_donation_amount": 5000,
    "total_subscription_amount": 45000,
    "total_ebook_amount": 20000,
    "total_course_amount": 80000,
    "total_transactions_count": 45
  },
  "total_records": 45,
  "page": 1,
  "per_page": 20,
  "total_pages": 3,
  "data": [
    {
      "payment_id": 102,
      "transaction_id": "TXN_987654",
      "amount": 4999,
      "currency": "INR",
      "tax": 900,
      "donation": 0,
      "buyer": {
        "user_id": 20,
        "buyer_type": "student",
        "buyer_name": "John Doe",
        "email": "[email protected]"
      },
      "item_type": "course",
      "item_details": {
        "courses": [
          { "course_id": 5, "course_title": "Fullstack Web Dev", "instructor_name": "Dr. Smith" }
        ]
      }
    }
  ]
}

GET Single Transaction Detail — /dev-api/payment/detail/{payment_id} or /dev-api/admin/transactions/{payment_id}
{
  "status": 200,
  "data": {
    "payment_id": 102,
    "transaction_id": "TXN_987654",
    "amount": 4999,
    "currency": "INR",
    "payment_method": "Razorpay",
    "payment_type": "enrollment",
    "payment_comes_from": "kiacademy",
    "status": "active",
    "tax": 900,
    "donation": 0,
    "coupon_code": "WELCOME20",
    "coupon_amount": 500,
    "payment_date": "2026-08-01 12:00:00",
    "created_at": "2026-08-01 12:00:00",
    "buyer": {
      "user_id": 20,
      "buyer_type": "student",
      "buyer_name": "John Doe",
      "email": "[email protected]",
      "phone": "+919876543210"
    },
    "billing_address": {
      "address_line_1": "123 Main Street",
      "city": "Mumbai",
      "state": "Maharashtra",
      "zip_code": "400001",
      "country": "IN"
    },
    "item_type": "course",
    "item_details": {
      "courses": [
        {
          "course_id": 5,
          "course_title": "Fullstack Web Dev",
          "course_thumbnail": "uploads/thumbnails/course5.jpg",
          "instructor_name": "Dr. Smith",
          "enrollment_date": "2026-08-01 12:00:00"
        }
      ],
      "course_count": 1
    }
  }
}

GET All Platform Payments — /dev-api/payments
{
  "status": 200,
  "data": [
    {
      "payment_id": 102,
      "user_id": 20,
      "course_id": 5,
      "amount": 4999,
      "currency": "INR",
      "payment_method": "Stripe",
      "status": "completed",
      "created_at": "2026-07-12 10:30:00"
    }
  ],
  "total_revenue": 1258000
}
GET Payments by Institute — /dev-api/payments/{institute_id}
GET All Donations — /dev-api/payment/donations
GET Transactions for Instructor Courses — /dev-api/transactions/{instructor_id}
9. Location & Miscellaneous

GET IP Geolocation — /location

Detects the client's country and region from their IP address.

{
  "status": 200,
  "country": "India",
  "region": "Telangana",
  "city": "Hyderabad",
  "currency": "INR",
  "timezone": "Asia/Kolkata"
}

GET System Health Check — /check
{
  "status": 200,
  "message": "System operational.",
  "db_connected": true,
  "version": "2.1.0"
}

GET BigBlueButton End Meeting Redirect — /endMeeting

Called by BigBlueButton server after a meeting ends. Redirects participants back to the platform home page. No auth required.

GET https://api.kiacademy.in/endMeeting

# Response: 302 Redirect → https://api.kiacademy.in/

GET Download Company Profile — /company/download-profile

Returns a downloadable PDF of the KIAcademy company profile.

10. E-Book Categories & Catalog Management (Admin)
E-Book Categories CRUD
GET List All Categories — /dev-api/ebook-categories
GET Get Category by ID — /dev-api/ebook-categories/{id}

POST Create E-Book Category — /dev-api/ebook-categories/create
{
  "name": "Data Science & Artificial Intelligence",
  "slug": "data-science-ai",
  "description": "Machine learning, neural networks, and data analytics textbooks",
  "status": "active"
}
Success Response (201 Created)
{
  "status": 201,
  "message": "EBook category created successfully",
  "data": {
    "id": 4,
    "name": "Data Science & Artificial Intelligence",
    "slug": "data-science-ai",
    "description": "Machine learning, neural networks, and data analytics textbooks",
    "status": "active",
    "created_at": "2026-07-27 15:40:00"
  }
}

POST Update E-Book Category — /dev-api/ebook-categories/update/{id}
{
  "name": "AI & Machine Learning",
  "status": "active"
}
DELETE Delete E-Book Category — /dev-api/ebook-categories/delete/{id}

E-Books Catalog & Approval
GET List E-Books — /dev-api/ebooks
Query filters: ?category_id=1&is_free=0&is_approved=0&status=active&featured=1&search=python (Pass is_approved=0 to list pending e-books for admin review).
GET Single E-Book — /dev-api/ebooks/{id}
POST Create E-Book — /dev-api/ebooks/create
POST Update E-Book — /dev-api/ebooks/update/{id}

POST Approve E-Book — /dev-api/ebooks/approve/{id}

Sets is_approved = 1 and updates approved_at timestamp for the specified e-book.

{
  "status": 200,
  "message": "EBook approved successfully",
  "data": {
    "id": 5,
    "title": "Mastering Python Architecture",
    "is_approved": 1,
    "approved_at": "2026-07-27 15:35:00"
  }
}
DELETE Delete E-Book — /dev-api/ebooks/delete/{id}
11. Price Matrix Management (Admin)
Course Price Matrix CRUD & Multi-Currency Tiers

Endpoints to manage global course pricing tiers across 45+ currencies (USD, EUR, GBP, INR, CAD, AUD, JPY, etc.).

GET List All Price Matrix Tiers — /dev-api/price-matrix
Query filter: ?currency=USD (Optional parameter to fetch tiers formatted specifically for a selected currency).
{
  "status": 200,
  "data": [
    {
      "ID": 1,
      "Title": "Tier 1",
      "USD": 19.99,
      "EUR": 18.99,
      "GBP": 16.99,
      "INR": 1499.00
    }
  ]
}

GET List Supported Currencies — /dev-api/price-matrix/currencies
{
  "status": 200,
  "data": [
    "USD", "EUR", "GBP", "CAD", "AUD", "JPY", "CNY", "INR", "MXN", "BRL",
    "ZAR", "RUB", "KRW", "TRY", "NZD", "SGD", "CHF", "SEK", "NOK", "DKK"
  ]
}

GET Get Single Price Tier by ID — /dev-api/price-matrix/{id}

GET Get Price Tiers by Currency — /dev-api/price-matrix/currency/{currency_code}
{
  "status": 200,
  "currency": "INR",
  "data": [
    {
      "ID": 1,
      "Title": "Tier 1",
      "price": 1499,
      "tier_price": "1499 (Tier 1)"
    }
  ]
}

POST Create Price Matrix Tier — /dev-api/price-matrix/create
{
  "Title": "Tier 21",
  "USD": 119.99,
  "EUR": 109.99,
  "INR": 8999.00
}
Success Response (201 Created)
{
  "status": 201,
  "message": "Price Matrix tier created successfully",
  "data": {
    "ID": 21,
    "Title": "Tier 21",
    "USD": 119.99,
    "EUR": 109.99,
    "INR": 8999
  }
}

POST Update Price Matrix Tier — /dev-api/price-matrix/update/{id}
{
  "Title": "Tier 21 - Premium",
  "USD": 129.99,
  "INR": 9999.00
}
DELETE Delete Price Matrix Tier — /dev-api/price-matrix/delete/{id}