openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 0.1.0 description: FLEXXUP AI API specification servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: users description: User profile operations - name: workouts description: Workout operations - name: progress description: Progress tracking operations - name: body-metrics description: Body measurement tracking - name: diet description: Diet recommendations - name: nutrition description: Nutrition logging and food analysis paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /users/profile: get: operationId: getUserProfile tags: [users] summary: Get user profile responses: "200": description: User profile content: application/json: schema: $ref: "#/components/schemas/UserProfile" "404": description: Profile not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" post: operationId: createUserProfile tags: [users] summary: Create or update user profile requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateUserProfileBody" responses: "200": description: Created/updated profile content: application/json: schema: $ref: "#/components/schemas/UserProfile" /workouts: get: operationId: listWorkouts tags: [workouts] summary: List all workouts responses: "200": description: List of workouts content: application/json: schema: type: array items: $ref: "#/components/schemas/Workout" post: operationId: createWorkout tags: [workouts] summary: Create a new workout session requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateWorkoutBody" responses: "201": description: Created workout content: application/json: schema: $ref: "#/components/schemas/Workout" /workouts/{id}: get: operationId: getWorkout tags: [workouts] summary: Get a specific workout parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Workout content: application/json: schema: $ref: "#/components/schemas/Workout" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" patch: operationId: updateWorkout tags: [workouts] summary: Update workout parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateWorkoutBody" responses: "200": description: Updated workout content: application/json: schema: $ref: "#/components/schemas/Workout" /progress/summary: get: operationId: getProgressSummary tags: [progress] summary: Get overall progress summary responses: "200": description: Progress summary content: application/json: schema: $ref: "#/components/schemas/ProgressSummary" /body-metrics: get: operationId: listBodyMetrics tags: [body-metrics] summary: List all body metric entries responses: "200": description: List of body metrics content: application/json: schema: type: array items: $ref: "#/components/schemas/BodyMetric" post: operationId: createBodyMetric tags: [body-metrics] summary: Log a new body measurement requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateBodyMetricBody" responses: "201": description: Created body metric content: application/json: schema: $ref: "#/components/schemas/BodyMetric" /body-metrics/weight-history: get: operationId: getWeightHistory tags: [body-metrics] summary: Get weight log entries ordered by date ascending responses: "200": description: Weight history content: application/json: schema: type: array items: $ref: "#/components/schemas/WeightLogEntry" /body-metrics/weight: post: operationId: logWeight tags: [body-metrics] summary: Log a body weight entry requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/LogWeightBody" responses: "201": description: Created weight entry content: application/json: schema: $ref: "#/components/schemas/WeightLogEntry" /diet-plan: get: operationId: getDietPlan tags: [diet] summary: Get personalized diet plan based on user profile responses: "200": description: Diet plan content: application/json: schema: $ref: "#/components/schemas/DietPlan" "404": description: Profile not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /nutrition/entries: get: operationId: listNutritionEntries tags: [nutrition] summary: List nutrition entries for a date parameters: - name: date in: query required: false schema: type: string description: "Date in YYYY-MM-DD format (defaults to today)" responses: "200": description: List of nutrition entries content: application/json: schema: type: array items: $ref: "#/components/schemas/NutritionEntry" post: operationId: createNutritionEntry tags: [nutrition] summary: Add a food entry to a meal requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateNutritionEntryBody" responses: "201": description: Created nutrition entry content: application/json: schema: $ref: "#/components/schemas/NutritionEntry" /nutrition/entries/{id}: delete: operationId: deleteNutritionEntry tags: [nutrition] summary: Delete a nutrition entry parameters: - name: id in: path required: true schema: type: integer responses: "204": description: Deleted successfully "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /nutrition/weekly: get: operationId: getNutritionWeekly tags: [nutrition] summary: Get daily nutrition totals for the past 7 days responses: "200": description: Weekly nutrition summary content: application/json: schema: type: array items: $ref: "#/components/schemas/DailyNutritionSummary" /nutrition/analyze: post: operationId: analyzeFood tags: [nutrition] summary: Analyze food text and return macros using AI requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AnalyzeFoodBody" responses: "200": description: Food analysis result content: application/json: schema: $ref: "#/components/schemas/FoodAnalysis" /body-scan/analyze: post: operationId: analyzeBodyScan tags: [body-scan] summary: Analyze a body photo and estimate body fat percentage using AI requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AnalyzeBodyScanBody" responses: "200": description: Body scan analysis result content: application/json: schema: $ref: "#/components/schemas/BodyScanResult" "400": description: Bad request content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /body-scan/history: get: operationId: getBodyScanHistory tags: [body-scan] summary: Get all past body scan results responses: "200": description: List of body scans ordered by date descending content: application/json: schema: type: array items: $ref: "#/components/schemas/BodyScanHistoryItem" components: schemas: HealthStatus: type: object properties: status: type: string required: - status ErrorResponse: type: object properties: error: type: string required: - error UserProfile: type: object properties: id: type: integer heightCm: type: number weightKg: type: number age: type: integer goal: type: string enum: [fat_loss, muscle_gain, general] bmi: type: number activityLevel: type: string enum: [low, medium, high] sleepHours: type: number hungerLevel: type: string enum: [low, medium, high] experienceLevel: type: string enum: [beginner, intermediate] metabolism: type: string enum: [fast, slow] createdAt: type: string format: date-time updatedAt: type: string format: date-time required: - id - heightCm - weightKg - age - goal - bmi - activityLevel - sleepHours - hungerLevel - experienceLevel - metabolism - createdAt - updatedAt CreateUserProfileBody: type: object properties: heightCm: type: number weightKg: type: number age: type: integer goal: type: string enum: [fat_loss, muscle_gain, general] activityLevel: type: string enum: [low, medium, high] sleepHours: type: number hungerLevel: type: string enum: [low, medium, high] experienceLevel: type: string enum: [beginner, intermediate] required: - heightCm - weightKg - age - goal - activityLevel - sleepHours - hungerLevel - experienceLevel Workout: type: object properties: id: type: integer goal: type: string enum: [fat_loss, muscle_gain, general] workoutType: type: string enum: [full_body, lower_body, upper_body] exercises: type: array items: $ref: "#/components/schemas/Exercise" totalReps: type: integer durationSeconds: type: integer nullable: true completed: type: boolean success: type: boolean nullable: true completedAt: type: string format: date-time nullable: true createdAt: type: string format: date-time required: - id - goal - workoutType - exercises - totalReps - durationSeconds - completed - success - completedAt - createdAt Exercise: type: object properties: name: type: string type: type: string enum: [squat, pushup, plank, lunge, bicep_curl, shoulder_press, high_knees, jumping_jack, mountain_climber, glute_bridge] sets: type: integer repsPerSet: type: integer completedSets: type: integer completedReps: type: integer required: - name - sets - repsPerSet - completedSets - completedReps CreateWorkoutBody: type: object properties: goal: type: string enum: [fat_loss, muscle_gain, general] workoutType: type: string enum: [full_body, lower_body, upper_body] required: - goal - workoutType UpdateWorkoutBody: type: object properties: exercises: type: array items: $ref: "#/components/schemas/Exercise" totalReps: type: integer durationSeconds: type: integer completed: type: boolean success: type: boolean required: [] ProgressSummary: type: object properties: totalWorkouts: type: integer totalReps: type: integer completedWorkouts: type: integer recentWorkouts: type: array items: $ref: "#/components/schemas/Workout" weeklyReps: type: integer currentStreak: type: integer weightHistory: type: array items: $ref: "#/components/schemas/WeightEntry" required: - totalWorkouts - totalReps - completedWorkouts - recentWorkouts - weeklyReps - currentStreak - weightHistory WeightEntry: type: object properties: date: type: string weightKg: type: number required: - date - weightKg BodyMetric: type: object properties: id: type: integer weightKg: type: number nullable: true waistCm: type: number nullable: true chestCm: type: number nullable: true armsCm: type: number nullable: true recordedAt: type: string format: date-time required: - id - weightKg - waistCm - chestCm - armsCm - recordedAt CreateBodyMetricBody: type: object properties: weightKg: type: number nullable: true waistCm: type: number nullable: true chestCm: type: number nullable: true armsCm: type: number nullable: true required: [] WeightLogEntry: type: object properties: id: type: integer weightKg: type: number recordedAt: type: string format: date-time required: - id - weightKg - recordedAt LogWeightBody: type: object properties: weightKg: type: number required: - weightKg DietPlan: type: object properties: calories: type: integer proteinG: type: integer carbsG: type: integer fatG: type: integer goal: type: string metabolism: type: string mealSuggestions: type: array items: type: string required: - calories - proteinG - carbsG - fatG - goal - metabolism - mealSuggestions NutritionEntry: type: object properties: id: type: integer date: type: string mealType: type: string enum: [breakfast, lunch, snacks, dinner] foodName: type: string quantity: type: string calories: type: integer proteinG: type: number carbsG: type: number fatG: type: number createdAt: type: string format: date-time required: - id - date - mealType - foodName - quantity - calories - proteinG - carbsG - fatG - createdAt CreateNutritionEntryBody: type: object properties: date: type: string mealType: type: string enum: [breakfast, lunch, snacks, dinner] foodName: type: string quantity: type: string calories: type: integer proteinG: type: number carbsG: type: number fatG: type: number required: - date - mealType - foodName - quantity - calories - proteinG - carbsG - fatG DailyNutritionSummary: type: object properties: date: type: string calories: type: integer proteinG: type: number carbsG: type: number fatG: type: number required: - date - calories - proteinG - carbsG - fatG AnalyzeFoodBody: type: object properties: text: type: string description: "Free-text food input e.g. '2 idly' or '200g chicken breast'" required: - text FoodAnalysis: type: object properties: foodName: type: string quantity: type: string calories: type: integer proteinG: type: number carbsG: type: number fatG: type: number required: - foodName - quantity - calories - proteinG - carbsG - fatG AnalyzeBodyScanBody: type: object properties: imageBase64: type: string description: Base64-encoded image data (without data URL prefix) mimeType: type: string description: Image MIME type e.g. image/jpeg default: image/jpeg required: - imageBase64 BodyScanResult: type: object properties: id: type: integer bodyFatPercent: type: number confidence: type: integer category: type: string enum: [lean, athletic, average, overweight, obese] leanMassKg: type: number fatMassKg: type: number bmi: type: number nullable: true ffmi: type: number nullable: true notes: type: string nullable: true recordedAt: type: string format: date-time required: - id - bodyFatPercent - confidence - category - leanMassKg - fatMassKg - recordedAt BodyScanHistoryItem: type: object properties: id: type: integer bodyFatPercent: type: number confidence: type: integer category: type: string enum: [lean, athletic, average, overweight, obese] leanMassKg: type: number fatMassKg: type: number bmi: type: number nullable: true ffmi: type: number nullable: true notes: type: string nullable: true recordedAt: type: string format: date-time required: - id - bodyFatPercent - confidence - category - leanMassKg - fatMassKg - recordedAt