Ingredients List Retrieval

Retrieve standardized recipe ingredients and quantities for confirmed dishes from a food intake.

What You’ll Build

You’ll implement an image-to-ingredients flow: your app uploads a meal photo (or any other manually submitted intake), confirms the detected dishes, and then retrieves the list of ingredients and their quantities for each confirmed dish. The result is a ready-to-use, standardized ingredient breakdown suitable for nutrition and recipe analytics.

This use case solves the pain of manual ingredient entry by deriving a recipe’s most common/standard composition automatically, with the option to let users edit or confirm quantities afterward.


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, Node axios, Java OkHttp)
  • 1–2 sample food images for testing (JPEG/PNG). For best results, confirm dishes before requesting ingredients.

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 (ingredients with quantities)
  App-->>User: Display ingredients & amounts

Extended Flow (ingredients & quantities edition)

sequenceDiagram
  participant User
  participant App
  participant LogMeal API

  Note over User,App: Extension after "Display ingredients & amounts"
  User->>App: Review ingredients & quantities
  alt Needs changes
    loop Edit until OK
      User->>App: Add/remove/update ingredients or amounts
      App->>LogMeal API: POST /v2/nutrition/confirm/ingredients (imageId, ingredients)
      LogMeal API-->>App: 200 OK (updated ingredients with quantities)
      App-->>User: Show updated list
    end
  else Looks good
    App-->>User: Confirm ingredients
  end
  App-->>User: Save & continue
ℹ️

The ingredients list can also be obtained from any other kind of submitted intake: manual input, from favorites, from a custom recipe or from a barcode.


Implementation Guide

Implementation Examples (Recipes)

Follow these recipes to implement the previously mentioned flow:

  1. Set profile data once to improve label language and regional dishes:
  1. Send the image for segmentation to obtain regions and top dish candidates per region. Display the top 5 candidate dishes per region.
  1. Ask the user to confirm or correct the dishes appearing on the image:
  1. Retrieve the list of ingredients and quantities associated to the submitted intake.
  1. Confirm and adjust the ingredients and their amounts.

Downloadable Code Examples

These recipes show the core steps in a few languages. For more language options (and complete runnable projects), see Ready-to-Use Code.

User Interaction Recommendations

  • After confirmation, display an ingredients table (name, unit, amount).
  • Allow quick edits (increase/decrease, remove, add from search).
  • Provide a one-tap “Confirm ingredients” step before saving.
  • Integrate the Easy Ingredients Modulation feature to allow the user to easily modify salt/sugar/oil.
Example ingredients edition UI

Illustrative ingredients edition interface

Related Endpoints


Common Pitfalls & Tips

  • Confirm dishes first to maximize ingredient accuracy.
  • Ingredients reflect the most standard/common recipe; real plates may vary—offer user edits.
  • Localize labels/units by setting user language/country in user profile when applicable.

Optional Enhancements

  • Chain with Nutrition endpoints to compute macros/micros from the retrieved ingredients.
  • Support cooking measures (e.g., tbsp, slices) and portions in your UI.
  • Suggest ingredient substitutions or variants after retrieval.
  • Export to shopping lists or meal-planning flows.

Next Steps

Pick your path based on what you want to build next: