Get Diet Settings
Endpoint
Authentication
This endpoint requires authentication. Include a valid JWT token in the Authorization header.Request
Headers
Bearer token for authenticationExample:
Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...Response
Indicates if the request was successful
Diet settings object
Whether diet tracking is enabled
Diet preset configurationAllowed values:
custom- User-defined limitsmaintenance- Maintain current weightcutting- Weight loss phasebulking- Muscle gain phaselowcarb- Low carbohydrate dietbalanced- Balanced macronutrients
Show remaining nutrients instead of consumed
Display progress bars in diary
Percentage threshold for warnings (0-100)
Diary display modeAllowed values:
quick- Simple view with essential informationdetailed- Comprehensive view with all nutritional data
Example
Response
Update Diet Settings
Endpoint
Authentication
This endpoint requires authentication. Include a valid JWT token in the Authorization header.Request
Headers
Bearer token for authenticationExample:
Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...Must be
application/jsonBody Parameters
Enable or disable diet tracking
Diet preset configurationAllowed values:
custom- User-defined limitsmaintenance- Maintain current weight (2000 kcal base)cutting- Weight loss phase (reduced calories)bulking- Muscle gain phase (increased calories and protein)lowcarb- Low carbohydrate diet (high fat, low carbs)balanced- Balanced macronutrients (default)
Daily nutritional limits (all values optional)
Daily calorie limit (must be >= 0)
Daily carbohydrates limit in grams (must be >= 0)
Daily protein limit in grams (must be >= 0)
Daily fat limit in grams (must be >= 0)
Daily sugar limit in grams (must be >= 0)
Daily fiber limit in grams (must be >= 0)
Daily sodium limit in mg (must be >= 0)
Show remaining nutrients instead of consumed
true- Display remaining values (e.g., “500 kcal left”)false- Display consumed values (e.g., “1500 kcal eaten”)
Display progress bars in diary view
Percentage threshold for warnings
- Range: 0-100
- When consumption reaches this percentage, a warning is displayed
- Example: 80 means warn when 80% of daily limit is reached
Diary display modeAllowed values:
quick- Simple view with essential informationdetailed- Comprehensive view with all nutritional data
Response
Indicates if the request was successful
Updated diet settings object (same structure as GET response)
Success message: “Configurações de dieta atualizadas!”
Examples
Enable Diet Tracking with Balanced Preset
Update Custom Limits
Change Display Preferences
Set Low-Carb Preset
Response
Error Responses
400 Bad Request - Invalid Values
401 Unauthorized
404 Not Found
Diet Presets
The following presets provide common diet configurations:Balanced (Default)
- Calories: 2000 kcal
- Carbs: 225g (45%)
- Protein: 75g (15%)
- Fat: 65g (30%)
- Use case: General healthy eating
Maintenance
- Calories: 2000 kcal
- Carbs: 225g (45%)
- Protein: 75g (15%)
- Fat: 65g (30%)
- Use case: Maintain current weight
Cutting
- Calories: Reduced from maintenance
- Protein: Higher to preserve muscle
- Carbs: Moderate
- Fat: Lower
- Use case: Fat loss while preserving muscle
Bulking
- Calories: Increased from maintenance
- Protein: High for muscle growth
- Carbs: High for energy
- Fat: Moderate
- Use case: Muscle gain and strength
Low Carb
- Calories: 2000 kcal
- Carbs: Very low (5-10%)
- Protein: Moderate (25-30%)
- Fat: High (60-70%)
- Use case: Ketogenic or low-carb diets
Custom
- All limits: User-defined
- Use case: Personalized nutrition requirements
Notes
- All fields are optional when updating - send only what you want to change
- Limits are merged with existing limits, not replaced entirely
- Setting a preset will update the default limits, but you can customize them after
- The
warningThresholdhelps users stay within their limits by showing alerts - Diet settings changes are logged in the activity log