Welcome to the StudySync API! Below you'll find a summary of all available endpoints, grouped by feature/module. All endpoints (except authentication) require a valid JWT token via the Authorization: Bearer <token> header.
/auth/login{
"email": "user@example.com",
"password": "yourpassword"
}
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": "userId123",
"name": "Test User",
"email": "user@example.com"
}
}
400 Bad Request: INVALID_INPUT (e.g., missing email or password)401 Unauthorized: INVALID_CREDENTIALS (e.g., incorrect email or password)500 Internal Server Error: SERVER_ERROR/auth/signup{
"name": "New User",
"email": "newuser@example.com",
"password": "newpassword123"
}
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": "userId456",
"name": "New User",
"email": "newuser@example.com"
}
}
400 Bad Request: INVALID_INPUT (e.g., missing fields, invalid email format, password too short)409 Conflict: USER_EXISTS (e.g., email already registered)500 Internal Server Error: SERVER_ERRORAll routes require authentication.
/edubot/chat{
"message": "Explain the concept of photosynthesis.",
"sessionId": "optionalExistingSessionId123"
}
{
"reply": "Photosynthesis is a process used by plants...",
"sessionId": "newOrExistingSessionId123"
}
400 Bad Request: INVALID_PROMPT (e.g., empty message)500 Internal Server Error: AI_SERVICE_ERROR, SERVER_ERROR/edubot/flashcards{
"text": "The mitochondria is the powerhouse of the cell."
}
{
"topic": "Cellular Biology"
}
{
"flashcards": [
{ "question": "What is the powerhouse of the cell?", "answer": "The mitochondria" }
],
"flashcardSetId": "flashcardSetId789"
}
400 Bad Request: INVALID_INPUT (e.g., missing text or topic)500 Internal Server Error: AI_SERVICE_ERROR, SERVER_ERROR/edubot/quiz{
"text": "The capital of France is Paris."
}
{
"topic": "World Capitals"
}
{
"quiz": {
"_id": "quizIdABC",
"topic": "World Capitals",
"questions": [
{
"id": "q1",
"text": "What is the capital of France?",
"options": ["London", "Berlin", "Paris", "Madrid"],
"correctAnswer": 2
}
]
}
}
400 Bad Request: INVALID_INPUT (e.g., missing text or topic)500 Internal Server Error: AI_SERVICE_ERROR, SERVER_ERRORGET /edubot/chat/session/:sessionId{ "_id": "sessionId123", "title": "Photosynthesis Chat", "history": [ ... ], "createdAt": "...", "lastUpdatedAt": "..." }404 Not Found: SESSION_NOT_FOUNDGET /edubot/chat/sessions{ "sessions": [ { "_id": "sessionId123", "title": "Photosynthesis Chat", ... } ] }GET /edubot/flashcards/sets{ "flashcardSets": [ { "_id": "flashcardSetId789", "topic": "Cellular Biology", ... } ] }GET /edubot/flashcards/set/:setId{ "flashcardSet": { "_id": "flashcardSetId789", "topic": "Cellular Biology", "flashcards": [ ... ] } }404 Not Found: SET_NOT_FOUNDGET /edubot/quizzes{ "quizzes": [ { "_id": "quizIdABC", "topic": "World Capitals", ... } ] }GET /edubot/quiz/:quizId{ "quiz": { "_id": "quizIdABC", "topic": "World Capitals", "questions": [ ... ] } }404 Not Found: QUIZ_NOT_FOUNDPOST /edubot/quiz/score{
"quizId": "quizIdABC",
"score": 8,
"totalQuestions": 10,
"answers": [ { "questionId": "q1", "selectedAnswer": 2, "isCorrect": true } ]
}
{ "message": "Quiz score submitted successfully", "quizScoreId": "scoreIdXYZ", "score": { ... } }400 Bad Request: MISSING_SCORE_FIELDS, INVALID_QUIZ_IDGET /edubot/quiz/scoresquizId query parameter.quizId (optional){ "scores": [ { "_id": "scoreIdXYZ", "quizId": "quizIdABC", "score": 8, ... } ] }All routes require authentication.
/smartnotes/audio.mp3, .wav) for transcription. The file is sent as form-data.FormData with field audioFile containing the audio file.{
"success": true,
"fileId": "audioFile-1678886400000-123456789.mp3",
"message": "Audio file uploaded successfully",
"filePath": "uploads/audioFile-1678886400000-123456789.mp3"
}
400 Bad Request: NO_FILE_UPLOADED500 Internal Server Error: SERVER_ERROR/smartnotes/recording/start{
"sessionName": "My Lecture Recording"
}
{
"sessionId": "recording-1678886400000",
"websocketUrl": "wss://api.studysync.com/recordings/socket"
}
400 Bad Request: INVALID_SESSION_NAME500 Internal Server Error: SERVER_ERROR/smartnotes/transcribefileId.{
"fileId": "audioFile-1678886400000-123456789.mp3",
"language": "en" // Optional: Specify language code (e.g., "en", "es")
}
{
"transcript": "This is the transcribed text from the audio file...",
"confidence": 0.95,
"durationSeconds": 120.5
}
400 Bad Request: INVALID_FILE_ID404 Not Found: FILE_NOT_FOUND500 Internal Server Error: TRANSCRIPTION_ERROR, MISSING_API_KEY/smartnotes/summarize{
"transcript": "This is a long piece of text that needs to be summarized...",
"maxPoints": 5 // Optional: Maximum number of key points to extract
}
{
"summary": "This is a concise summary of the provided transcript content.",
"keyPoints": [
"Key point 1 from the transcript summary",
"Key point 2 from the transcript summary"
],
"topics": ["Topic A", "Topic B"]
}
400 Bad Request: INVALID_TRANSCRIPT500 Internal Server Error: AI_SERVICE_ERROR, SERVER_ERROR/smartnotes/uploads/:fileIdfileId.400 Bad Request: INVALID_FILE_ID404 Not Found: FILE_NOT_FOUND/smartnotes/transcriptions/:fileId{
"fileId": "audioFile-1678886400000-123456789.mp3",
"transcript": "This is the transcribed text...",
"confidence": 0.95,
"durationSeconds": 120.5,
"createdAt": "2023-03-15T12:00:00.000Z"
}
400 Bad Request: INVALID_FILE_ID404 Not Found: TRANSCRIPTION_NOT_FOUNDAll routes require authentication.
/learnsphere/dashboard?userId=...userId (required) - The ID of the user.{
"dashboard": {
"_id": "dashboardId123",
"userId": "userId123",
"learningStreak": 10,
"topicsStudied": 5,
"quizzesTaken": 20,
"averageScore": 85.5,
"weakTopics": ["Calculus", "Organic Chemistry"],
"strongTopics": ["Linear Algebra", "Physics Mechanics"],
"progressBySubject": [
{ "subject": "Math", "progress": 75 },
{ "subject": "Science", "progress": 60 }
]
}
}
400 Bad Request: INVALID_USER_ID404 Not Found: DASHBOARD_NOT_FOUND/learnsphere/mastery?userId=...&subject=...userId (required) - The ID of the user.subject (required) - The subject to get mastery data for.{
"mastery": {
"_id": "masteryId123",
"userId": "userId123",
"subject": "Physics",
"topics": [
{ "name": "Kinematics", "masteryLevel": 0.8, "quizCount": 5 },
{ "name": "Dynamics", "masteryLevel": 0.6, "quizCount": 3 }
]
}
}
400 Bad Request: INVALID_PARAMETERS (e.g., missing userId or subject)/learnsphere/recommendations?userId=...userId (required) - The ID of the user.{
"recommendations": [
{ "id": "rec1", "title": "Review Kinematics", "priority": "high", "type": "topic_review", "details": { "topicId": "topicKinematics" } },
{ "id": "rec2", "title": "Take a quiz on Dynamics", "priority": "medium", "type": "quiz", "details": { "subject": "Physics", "topic": "Dynamics" } }
],
"progressBySubject": [
{ "subject": "Physics", "progress": 70 },
{ "subject": "Math", "progress": 85 }
]
}
400 Bad Request: INVALID_USER_ID500 Internal Server Error: AI_SERVICE_ERROR, SERVER_ERRORAll routes require authentication.
/getAllUserData/GetAllUserData?id=...id (required) - The ID of the user.{
"user": { ... },
"files": [ ... ],
"transcriptions": [ ... ],
"dashboard": { ... },
"mastery": [ ... ],
"chatSessions": [ ... ],
"flashcardSets": [ ... ],
"quizzes": [ ... ],
"quizScores": [ ... ]
}
400 Bad Request: INVALID_USER_ID404 Not Found: USER_NOT_FOUND/getAllUserData/DeleteAllUserData?id=...id (required) - The ID of the user whose data will be deleted.{
"message": "All data for user userId123 deleted successfully."
}
400 Bad Request: INVALID_USER_ID404 Not Found: USER_NOT_FOUND500 Internal Server Error: SERVER_ERRORAll routes require authentication.
/fileuploads/uploadFormData with field file containing the file to upload.{
"success": true,
"fileId": "file-1678886400000-987654321.pdf",
"message": "File uploaded successfully",
"filePath": "uploads/file-1678886400000-987654321.pdf"
}
400 Bad Request: NO_FILE_UPLOADED500 Internal Server Error: SERVER_ERROR/fileuploads/:fileIdfileId.400 Bad Request: INVALID_FILE_ID404 Not Found: FILE_NOT_FOUND/payment/confirm{
"paymentId": "PAYID-xxxxxxxxxxxxxxx",
"email": "user@example.com"
}
{
"message": "Payment confirmed and subscription updated.",
"receiptId": "receiptId123"
}
400 Bad Request: MISSING_PAYMENT_ID_OR_EMAIL404 Not Found: ORDER_NOT_FOUND500 Internal Server Error: PAYMENT_PROCESSING_ERROR, SERVER_ERRORAll endpoints return errors in the following format on failure:
{
"error": "Error message",
"code": "ERROR_CODE"
}
/auth/*) require a valid JWT Bearer token in the Authorization header (e.g., Authorization: Bearer <token>). See middleware/auth.js.v1, as indicated in the BASE_URL (https://api.studysync.com/v1) found in config/config.js.AUTH_REQUIRED, INVALID_TOKEN, SERVER_ERROR, INVALID_INPUT, FILE_NOT_FOUND, MISSING_API_KEY) provide more context. Refer to individual endpoint descriptions and middleware/errorHandler.js for common patterns.config/config.js and environment variables.ASSEMBLYAI_API_KEY) is typically set via environment variables (see controllers/smartnotesController.js).config/paypalConfig.js.models/ directory.uploads/ directory on the server.transcriptions/ directory.controllers/fileuploadsController.js and controllers/smartnotesController.js for implementation details.config/config.js and often rely on environment variables for security and flexibility.