openapi: 3.1.0 info: title: Api version: 0.1.0 description: VidaLeve API servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: auth description: Authentication - name: profile description: User profile and onboarding - name: weight description: Weight tracking - name: water description: Water intake tracking - name: exercise description: Exercise tracking - name: meal description: Meal logging - name: mood description: Mood and energy check-in - name: gamification description: XP, missions, badges - name: friends description: Friends and leaderboard - name: ai description: AI insights and recommendations - name: whatsapp description: WhatsApp webhook and simulator paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /auth/register: post: operationId: registerUser tags: [auth] summary: Register a new user requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RegisterBody" responses: "201": description: User created content: application/json: schema: $ref: "#/components/schemas/AuthResponse" "400": description: Bad request /auth/login: post: operationId: loginUser tags: [auth] summary: Login requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/LoginBody" responses: "200": description: Logged in content: application/json: schema: $ref: "#/components/schemas/AuthResponse" "401": description: Unauthorized /auth/logout: post: operationId: logoutUser tags: [auth] summary: Logout responses: "200": description: Logged out content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /auth/me: get: operationId: getCurrentUser tags: [auth] summary: Get current user responses: "200": description: Current user content: application/json: schema: $ref: "#/components/schemas/UserWithProfile" "401": description: Unauthorized /auth/verify-email/resend: post: operationId: resendVerificationEmail tags: [auth] summary: Resend the email verification link to the current user responses: "200": description: Verification email queued content: application/json: schema: type: object properties: ok: type: boolean alreadyVerified: type: boolean "401": description: Unauthorized "429": description: Too many requests content: application/json: schema: type: object properties: error: type: string retryAfterSeconds: type: integer /profile: get: operationId: getProfile tags: [profile] summary: Get user profile responses: "200": description: Profile content: application/json: schema: $ref: "#/components/schemas/Profile" put: operationId: updateProfile tags: [profile] summary: Update user profile requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateProfileBody" responses: "200": description: Updated profile content: application/json: schema: $ref: "#/components/schemas/Profile" /profile/onboarding: post: operationId: completeOnboarding tags: [profile] summary: Complete onboarding requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/OnboardingBody" responses: "200": description: Onboarding complete content: application/json: schema: $ref: "#/components/schemas/Profile" /dashboard: get: operationId: getDashboard tags: [profile] summary: Get dashboard summary for today responses: "200": description: Dashboard data content: application/json: schema: $ref: "#/components/schemas/DashboardData" /weight: get: operationId: getWeightLogs tags: [weight] summary: List weight logs responses: "200": description: Weight logs content: application/json: schema: type: array items: $ref: "#/components/schemas/WeightLog" post: operationId: addWeightLog tags: [weight] summary: Add weight log requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AddWeightBody" responses: "201": description: Weight log created content: application/json: schema: $ref: "#/components/schemas/WeightLog" /water: get: operationId: getWaterLogs tags: [water] summary: List water logs for today responses: "200": description: Water logs content: application/json: schema: $ref: "#/components/schemas/WaterSummary" post: operationId: addWaterLog tags: [water] summary: Add water intake requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AddWaterBody" responses: "201": description: Water log created content: application/json: schema: $ref: "#/components/schemas/WaterLog" /exercise: get: operationId: getExerciseLogs tags: [exercise] summary: List exercise logs responses: "200": description: Exercise logs content: application/json: schema: type: array items: $ref: "#/components/schemas/ExerciseLog" post: operationId: addExerciseLog tags: [exercise] summary: Add exercise log requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AddExerciseBody" responses: "201": description: Exercise log created content: application/json: schema: $ref: "#/components/schemas/ExerciseLog" /meal: get: operationId: getMealLogs tags: [meal] summary: List meal logs responses: "200": description: Meal logs content: application/json: schema: type: array items: $ref: "#/components/schemas/MealLogWithAnalysis" post: operationId: addMealLog tags: [meal] summary: Add meal log requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AddMealBody" responses: "201": description: Meal log created content: application/json: schema: $ref: "#/components/schemas/MealLogWithAnalysis" /mood: get: operationId: getMoodLogs tags: [mood] summary: List mood logs responses: "200": description: Mood logs content: application/json: schema: type: array items: $ref: "#/components/schemas/MoodLog" post: operationId: addMoodLog tags: [mood] summary: Add mood log requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AddMoodBody" responses: "201": description: Mood log created content: application/json: schema: $ref: "#/components/schemas/MoodLog" /missions: get: operationId: getMissions tags: [gamification] summary: Get user missions responses: "200": description: Missions content: application/json: schema: $ref: "#/components/schemas/MissionsData" /achievements: get: operationId: getAchievements tags: [gamification] summary: Get user achievements/badges responses: "200": description: Achievements content: application/json: schema: type: array items: $ref: "#/components/schemas/AchievementWithStatus" /gamification/stats: get: operationId: getGamificationStats tags: [gamification] summary: Get XP, level, streak stats responses: "200": description: Gamification stats content: application/json: schema: $ref: "#/components/schemas/GamificationStats" /friends: get: operationId: getFriends tags: [friends] summary: Get friends list responses: "200": description: Friends list content: application/json: schema: type: array items: $ref: "#/components/schemas/FriendItem" /friends/invite: post: operationId: sendFriendInvite tags: [friends] summary: Send friend invite by email requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SendInviteBody" responses: "200": description: Invite sent content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /friends/invites: get: operationId: getPendingInvites tags: [friends] summary: Get pending friend invites responses: "200": description: Pending invites content: application/json: schema: type: array items: $ref: "#/components/schemas/FriendInvite" /friends/invites/{id}/accept: post: operationId: acceptFriendInvite tags: [friends] summary: Accept friend invite parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Invite accepted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /friends/invites/{id}/decline: post: operationId: declineFriendInvite tags: [friends] summary: Decline friend invite parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Invite declined content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /leaderboard: get: operationId: getLeaderboard tags: [friends] summary: Get leaderboard among friends responses: "200": description: Leaderboard content: application/json: schema: type: array items: $ref: "#/components/schemas/LeaderboardEntry" /leaderboard/global: get: operationId: getGlobalLeaderboard tags: [friends] summary: Get global leaderboard (opt-in users only) parameters: - name: limit in: query required: false schema: type: integer minimum: 1 maximum: 100 default: 50 - name: offset in: query required: false schema: type: integer minimum: 0 default: 0 responses: "200": description: Global leaderboard page content: application/json: schema: $ref: "#/components/schemas/GlobalLeaderboard" "403": description: Caller has not opted in to the global ranking content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /leaderboard/me/history: get: operationId: getLeaderboardHistory tags: [friends] summary: Get this week vs last week scoring history for the caller responses: "200": description: Weekly evolution content: application/json: schema: $ref: "#/components/schemas/LeaderboardHistory" /ai/insight: get: operationId: getAiInsight tags: [ai] summary: Get today's AI insight and tip responses: "200": description: AI insight content: application/json: schema: $ref: "#/components/schemas/AiInsight" /ai/weekly-summary: get: operationId: getWeeklySummary tags: [ai] summary: Get weekly summary responses: "200": description: Weekly summary content: application/json: schema: $ref: "#/components/schemas/WeeklySummary" /whatsapp/webhook: get: operationId: verifyWhatsappWebhook tags: [whatsapp] summary: Verify WhatsApp webhook parameters: - name: hub.mode in: query schema: type: string - name: hub.verify_token in: query schema: type: string - name: hub.challenge in: query schema: type: string responses: "200": description: Challenge response content: text/plain: schema: type: string post: operationId: receiveWhatsappMessage tags: [whatsapp] summary: Receive WhatsApp webhook message requestBody: required: true content: application/json: schema: type: object responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /whatsapp/simulate: post: operationId: simulateWhatsappMessage tags: [whatsapp] summary: Simulate WhatsApp message (for testing) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SimulateMessageBody" responses: "200": description: Bot response content: application/json: schema: $ref: "#/components/schemas/SimulateMessageResponse" /progress/weekly: get: operationId: getWeeklyProgress tags: [profile] summary: Get weekly progress data for charts responses: "200": description: Weekly progress content: application/json: schema: $ref: "#/components/schemas/WeeklyProgress" components: schemas: HealthStatus: type: object properties: status: type: string required: - status MessageResponse: type: object properties: message: type: string required: - message RegisterBody: type: object properties: name: type: string email: type: string password: type: string required: - name - email - password LoginBody: type: object properties: email: type: string password: type: string required: - email - password AuthResponse: type: object properties: user: $ref: "#/components/schemas/UserBasic" token: type: string onboardingCompleted: type: boolean required: - user - token - onboardingCompleted UserBasic: type: object properties: id: type: integer name: type: string email: type: string xp: type: integer level: type: integer streak: type: integer required: - id - name - email - xp - level - streak UserWithProfile: type: object properties: id: type: integer name: type: string email: type: string xp: type: integer level: type: integer streak: type: integer onboardingCompleted: type: boolean emailVerified: type: boolean profile: $ref: "#/components/schemas/Profile" required: - id - name - email - xp - level - streak - onboardingCompleted Profile: type: object properties: id: type: integer userId: type: integer currentWeight: type: ["number", "null"] targetWeight: type: ["number", "null"] mainGoal: type: string secondaryGoal: type: ["string", "null"] activityLevel: type: string weeklyAvailability: type: integer likesActivities: type: array items: type: string wantsToTryActivities: type: array items: type: string preferredInteractionFrequency: type: string dailyWaterGoalMl: type: integer participatesInRanking: type: boolean required: - id - userId - mainGoal - activityLevel - weeklyAvailability - likesActivities - wantsToTryActivities - preferredInteractionFrequency - dailyWaterGoalMl - participatesInRanking OnboardingBody: type: object properties: mainGoal: type: string secondaryGoal: type: ["string", "null"] currentWeight: type: ["number", "null"] targetWeight: type: ["number", "null"] activityLevel: type: string weeklyAvailability: type: integer likesActivities: type: array items: type: string wantsToTryActivities: type: array items: type: string preferredInteractionFrequency: type: string required: - mainGoal - activityLevel - weeklyAvailability - likesActivities - wantsToTryActivities - preferredInteractionFrequency UpdateProfileBody: type: object properties: name: type: string currentWeight: type: ["number", "null"] targetWeight: type: ["number", "null"] mainGoal: type: string secondaryGoal: type: ["string", "null"] activityLevel: type: string weeklyAvailability: type: integer likesActivities: type: array items: type: string wantsToTryActivities: type: array items: type: string preferredInteractionFrequency: type: string dailyWaterGoalMl: type: integer participatesInRanking: type: boolean DashboardData: type: object properties: todayWeight: type: ["number", "null"] targetWeight: type: ["number", "null"] mainGoal: type: string todayWaterMl: type: integer dailyWaterGoalMl: type: integer todayExercises: type: array items: $ref: "#/components/schemas/ExerciseLog" todayMeals: type: integer todayMood: type: ["string", "null"] xp: type: integer level: type: integer streak: type: integer aiTip: type: string dailyMission: $ref: "#/components/schemas/MissionItem" required: - todayWaterMl - dailyWaterGoalMl - todayExercises - todayMeals - xp - level - streak - aiTip - mainGoal WeightLog: type: object properties: id: type: integer userId: type: integer weight: type: number createdAt: type: string format: date-time required: - id - userId - weight - createdAt AddWeightBody: type: object properties: weight: type: number required: - weight WaterLog: type: object properties: id: type: integer userId: type: integer amountMl: type: integer createdAt: type: string format: date-time required: - id - userId - amountMl - createdAt WaterSummary: type: object properties: totalMl: type: integer goalMl: type: integer logs: type: array items: $ref: "#/components/schemas/WaterLog" required: - totalMl - goalMl - logs AddWaterBody: type: object properties: amountMl: type: integer required: - amountMl ExerciseLog: type: object properties: id: type: integer userId: type: integer type: type: string durationMinutes: type: integer intensity: type: string createdAt: type: string format: date-time required: - id - userId - type - durationMinutes - intensity - createdAt AddExerciseBody: type: object properties: type: type: string durationMinutes: type: integer intensity: type: string required: - type - durationMinutes - intensity MealLogWithAnalysis: type: object properties: id: type: integer userId: type: integer inputType: type: string contentText: type: ["string", "null"] createdAt: type: string format: date-time analysis: $ref: "#/components/schemas/MealAnalysis" required: - id - userId - inputType - createdAt MealAnalysis: type: object properties: id: type: integer mealLogId: type: integer qualityScore: type: integer proteinEstimate: type: string vegetablesEstimate: type: string processedFoodEstimate: type: string feedbackText: type: string required: - id - mealLogId - qualityScore - proteinEstimate - vegetablesEstimate - processedFoodEstimate - feedbackText AddMealBody: type: object properties: contentText: type: string inputType: type: string required: - contentText - inputType MoodLog: type: object properties: id: type: integer userId: type: integer mood: type: string energyLevel: type: string createdAt: type: string format: date-time required: - id - userId - mood - energyLevel - createdAt AddMoodBody: type: object properties: mood: type: string energyLevel: type: string required: - mood - energyLevel MissionItem: type: object properties: id: type: integer title: type: string description: type: string type: type: string targetValue: type: integer currentValue: type: integer xpReward: type: integer completed: type: boolean expiresAt: type: string format: date-time required: - id - title - description - type - targetValue - currentValue - xpReward - completed MissionsData: type: object properties: daily: type: array items: $ref: "#/components/schemas/MissionItem" weekly: type: array items: $ref: "#/components/schemas/MissionItem" required: - daily - weekly AchievementWithStatus: type: object properties: id: type: integer title: type: string description: type: string icon: type: string xpReward: type: integer unlocked: type: boolean unlockedAt: type: ["string", "null"] format: date-time required: - id - title - description - icon - xpReward - unlocked GamificationStats: type: object properties: xp: type: integer level: type: integer streak: type: integer nextLevelXp: type: integer progressToNextLevel: type: number required: - xp - level - streak - nextLevelXp - progressToNextLevel FriendItem: type: object properties: id: type: integer name: type: string level: type: integer streak: type: integer totalScore: type: integer friendshipId: type: integer required: - id - name - level - streak - totalScore - friendshipId SendInviteBody: type: object properties: email: type: string required: - email FriendInvite: type: object properties: id: type: integer fromUserId: type: integer fromUserName: type: string status: type: string createdAt: type: string format: date-time required: - id - fromUserId - fromUserName - status - createdAt LeaderboardEntry: type: object properties: userId: type: integer name: type: string level: type: integer streak: type: integer totalScore: type: integer consistencyScore: type: integer hydrationScore: type: integer exerciseScore: type: integer nutritionScore: type: integer missionScore: type: integer rank: type: integer isCurrentUser: type: boolean required: - userId - name - level - streak - totalScore - consistencyScore - hydrationScore - exerciseScore - nutritionScore - missionScore - rank - isCurrentUser GlobalLeaderboard: type: object properties: total: type: integer limit: type: integer offset: type: integer entries: type: array items: $ref: "#/components/schemas/LeaderboardEntry" me: oneOf: - $ref: "#/components/schemas/LeaderboardEntry" - type: "null" myRowInPage: type: boolean required: - total - limit - offset - entries - myRowInPage WeeklyScoreBreakdown: type: object properties: totalScore: type: integer consistencyScore: type: integer hydrationScore: type: integer exerciseScore: type: integer nutritionScore: type: integer missionScore: type: integer periodStart: type: string required: - totalScore - consistencyScore - hydrationScore - exerciseScore - nutritionScore - missionScore LeaderboardHistory: type: object properties: thisWeek: $ref: "#/components/schemas/WeeklyScoreBreakdown" lastWeek: oneOf: - $ref: "#/components/schemas/WeeklyScoreBreakdown" - type: "null" deltas: oneOf: - $ref: "#/components/schemas/WeeklyScoreBreakdown" - type: "null" required: - thisWeek AiInsight: type: object properties: tip: type: string motivation: type: string insight: type: string generatedAt: type: string format: date-time required: - tip - motivation - insight - generatedAt WeeklySummary: type: object properties: weightVariation: type: ["number", "null"] checkinFrequency: type: integer totalWaterMl: type: integer totalExerciseMinutes: type: integer mealsLogged: type: integer missionsCompleted: type: integer summaryText: type: string required: - checkinFrequency - totalWaterMl - totalExerciseMinutes - mealsLogged - missionsCompleted - summaryText WeeklyProgress: type: object properties: weightData: type: array items: $ref: "#/components/schemas/DataPoint" waterData: type: array items: $ref: "#/components/schemas/DataPoint" exerciseData: type: array items: $ref: "#/components/schemas/DataPoint" consistencyData: type: array items: $ref: "#/components/schemas/DataPoint" required: - weightData - waterData - exerciseData - consistencyData DataPoint: type: object properties: date: type: string value: type: number label: type: string required: - date - value SimulateMessageBody: type: object properties: message: type: string required: - message SimulateMessageResponse: type: object properties: userMessage: type: string botResponse: type: string intent: type: string required: - userMessage - botResponse - intent