Nutritional Information Retrieval
What You’ll Build
You’ll implement an image-to-nutrition flow: your app uploads a meal photo (or any other manually submitted intake), confirms the detected dishes, retrieves the standardized list of ingredients, and then computes the nutritional breakdown (macros & micros) for each confirmed dish. The output is ready for calorie and nutrient tracking, goal comparisons, and reports.
This use case removes the need for manual nutrient entry by chaining LogMeal’s dish confirmation → standardized ingredients → nutritional computation into a single, user-friendly flow. It’s valuable for developers building food diaries and clinical dashboards, and for end users who just want accurate nutrition from a photo.
Prerequisites
- Plan: Analyse and above (see more info about LogMeal Plans)
- User type: 🔴 APIUser (see more info about User Types)
- Client library for HTTP (e.g., Python
requests
, Nodeaxios
, JavaOkHttp
). - 1–2 sample food images for testing (JPEG/PNG). For best results, confirm dishes before requesting ingredients/nutrition.
Sequence Diagrams
Main Flow
sequenceDiagram participant User participant App participant LogMeal API User->>App: Capture/choose meal photo App->>LogMeal API: POST /v2/image/segmentation/complete <br> (Authorization: APIUser token, image) LogMeal API-->>App: 200 OK (imageId, segmentation results) App-->>User: Show top dish candidates per detected item User->>App: Confirm/adjust dish per item App->>LogMeal API: POST /v2/image/confirm/dish (imageId, confirmed items) LogMeal API-->>App: 200 OK (confirmed items) App->>LogMeal API: POST /v2/nutrition/recipe/ingredients (imageId) LogMeal API-->>App: 200 OK (standardized ingredients + quantities) App->>LogMeal API: POST /v2/nutrition/recipe/nutritionalInfo (imageId) LogMeal API-->>App: 200 OK (nutritional info for each confirmed dish) App-->>User: Display nutrients (macros & micros)
Implementation Guide
Implementation Examples (Recipes)
- Set profile data once to improve label language and regional dishes:
- Send the image for segmentation to obtain regions and top dish candidates per region. Display the top 5 candidate dishes per region.
- Ask the user to confirm or correct the dishes appearing on the image:
- Retrieve the standardized list of ingredients associated to the submitted intake:
- Retrieve the nutritional information (macro & micro nutrients) for the confirmed dishes:
User Interaction Recommendations
- After confirmation, display a nutritional summary card per dish including macros with an expand/collapse for micronutrients.
- Provide a one-tap “Confirm dishes” step before calling ingredients/nutrition.
- Automatically retrieve nutrition again whenever quantities/ingredients change.
- Localize nutrient labels/units based on the user profile (language/country).

Illustrative nutrition summary interface
Related Endpoints
- POST /image/segmentation/complete
- POST /image/confirm/dish
- POST /nutrition/recipe/ingredients
- POST /nutrition/recipe/nutritionalInfo
- POST /nutrition/recipe/compute_nutrients
Common Pitfalls & Tips
- Confirm dishes first to maximize the accuracy of both ingredients and nutrients.
- Nutrients are derived from the standardized ingredient list; if users change ingredients or amounts, recompute nutrition.
- Handle rate-limit 429 responses by retrying with backoff and respecting per-user daily image limits.
- For multi-dish images, present per-item nutrition and a total row.
- Ensure units (g, mg, kcal) are consistent in your UI and exports.
Optional Enhancements
- Combine with Daily Nutritional Goal to visualize goal attainment.
- Add Remaining Daily Intake widgets after each intake is saved.
Next Steps
Pick your path based on what you want to build next:
Ingredients List Retrieval
Retrieve standardized recipe ingredients and quantities for confirmed dishes from a food intake.
Favorite dishes
Let users reuse and curate dishes with editable standardized ingredients.
Reports and Summaries
Show day/period summaries using confirmed ingredients and intakes.
Recommendations
Suggest dishes that fit user goals and preferences.
Updated about 11 hours ago