API Documentation
Complete API reference for SmartDesk. All endpoints require authentication via HTTP-only cookies unless otherwise specified. Base URL: http://localhost:4000
Authentication
Most endpoints require authentication. Include credentials in your requests:
fetch('http://localhost:4000/api/users', {
credentials: 'include',
headers: { 'Content-Type': 'application/json' }
})Authentication
POST
/loginUser login
GET
/logoutUser logout
GET
/api/auth/meAuth RequiredGet current user
Admin
GET
/api/admin/analyticsAuth RequiredGet analytics data
GET
/api/admin/insightsAuth RequiredGet AI insights
Users
GET
/api/usersAuth RequiredGet all users
POST
/api/usersAuth RequiredCreate user
PUT
/api/users/:idAuth RequiredUpdate user
DELETE
/api/users/:idAuth RequiredDelete user
Academic
GET
/api/departmentsAuth RequiredGet all departments
POST
/api/departmentsAuth RequiredCreate department
GET
/api/coursesAuth RequiredGet all courses
POST
/api/coursesAuth RequiredCreate course
GET
/api/enrollmentsAuth RequiredGet all enrollments
Student
GET
/api/student/top-topicsAuth RequiredGet top feedback topics
POST
/student/feedbackAuth RequiredSubmit feedback
GET
/api/student/coursesAuth RequiredGet student courses
GET
/api/student/attendanceAuth RequiredGet student attendance
Configuration
GET
/api/configAuth RequiredGet system configuration
PUT
/api/configAuth RequiredUpdate configuration
Error Responses
All errors follow this format:
{
"error": "Error message",
"status": 400
}400 - Bad Request
401 - Unauthorized
403 - Forbidden
404 - Not Found
500 - Internal Server Error