API Reference
Complete REST API documentation for the Seoul Dak Training Portal. Base URL: https://support.eatseouldak.com/api
🔑 Authentication
All Auth endpoints require a JWT token in the header:
Authorization: Bearer <your-jwt-token>
Master endpoints additionally require the logged-in user to have role: "master".
Token expires in 8 hours. Use in the Authorization header for API requests.
🔐 Authentication /api/auth
POST/api/auth/loginPublic Login with email & password. Returns JWT token + admin info.
POST/api/auth/registerMaster Create new staff account. Sends welcome email with credentials.
POST/api/auth/forgotPublic Request password reset. Sends email with reset link (1hr expiry).
POST/api/auth/resetPublic Set new password using reset token from email link.
GET/api/auth/meAuth Get current logged-in admin profile (id, name, email, role).
PUT/api/auth/meAuth Update own profile (name, email).
PUT/api/auth/me/passwordAuth Change own password. Requires current_password + new_password.
GET/api/auth/adminsAuth List all admin accounts with roles.
GET/api/auth/admins/:idAuth Get single admin by ID.
PUT/api/auth/admins/:idMaster Update another admin's name/email.
PUT/api/auth/admins/:id/passwordMaster Reset another admin's password.
DELETE/api/auth/admins/:idMaster Remove a staff account. Cannot delete master or self.
📁 Categories /api/categories
GET/api/categoriesPublic List all categories with icon, sort_order.
POST/api/categoriesAuth Create new category. Body: { name, icon, sort_order }.
PUT/api/categories/:idAuth Update category name/icon/sort_order.
PATCH/api/categories/reorderAuth Reorder categories. Body: { order: [id1, id2, ...] }.
DELETE/api/categories/:idAuth Delete a category.
🎬 Videos /api/videos
GET/api/videosPublic List published videos with category info & step count.
GET/api/videos/admin/allAuth List all videos (including drafts) for admin.
GET/api/videos/:idPublic Get single video detail.
GET/api/videos/admin/:idAuth Get video detail for admin (includes draft info).
POST/api/videosAuth Create video. Body: { title, description, category_id }.
PUT/api/videos/:idAuth Update video title/description/category.
PATCH/api/videos/:id/publishAuth Toggle publish/draft status.
DELETE/api/videos/:idAuth Delete video and all its steps.
POST/api/videos/upload/screenshotAuth Upload screenshot image. Multipart form: screenshot file.
📋 Steps /api/steps
GET/api/steps/:videoIdPublic Get all steps for a video, ordered by step_order.
POST/api/steps/bulk/:videoIdAuth Bulk create/update steps. Body: { steps: [...] }.
POST/api/steps/single/:videoIdAuth Add a single step to a video.
PATCH/api/steps/reorder/:videoIdAuth Reorder steps. Body: { order: [id1, id2, ...] }.
PATCH/api/steps/:id/highlightAuth Update highlight box position (hl_x, hl_y, hl_w, hl_h).
PATCH/api/steps/:id/updateAuth Update step fields (label, tooltip, audio_text, etc.).
DELETE/api/steps/:videoIdAuth Delete all steps for a video.
🤖 AI (Claude) /api/ai
POST/api/ai/generate-stepAuth Generate step data from screenshot. Body: { screenshot_base64, step_description, step_number, total_steps }.
POST/api/ai/generate-videoAuth Generate full video steps from description. Body: { title, description, num_steps, category_name }.
POST/api/ai/improve-stepAuth Improve existing step text with AI. Body: { step, instruction }.
POST/api/ai/chatPublic AI chat assistant. Body: { messages, system }.
🔊 Text-to-Speech /api/tts
POST/api/tts/speakPublic Generate MP3 audio. Body: { text, lang: "en"|"hi" }. Auto-translates to Hindi if lang=hi. Returns audio/mpeg. Cached server-side.
📊 Dashboard /api/dashboard
GET/api/dashboardAuth Get dashboard statistics (videos, categories, steps counts).
📦 Export /api/export
GET/api/export/video/:idAuth Export video data for MP4 generation.