(S) Limited amount of calls per second.
Searches and normalizes the food sources supported by the unified mixed-intake contract.
The endpoint can search:
dish: regular LogMeal dishes;ingredient: regular LogMeal ingredients;favorite: favorites owned by the target APIUser;custom_recipe: custom recipes belonging to the target APIUser's APICompany;barcode_food_item: previously resolved barcode products.
The available values and the types that require search text can also be retrieved through GET /v2/food/types.
The returned type and id must always be interpreted together.
Different food namespaces may contain the same numeric ID.
In particular:
dishIDs identify regular GeneralClass dishes;ingredientIDs identify LogMeal ingredients;favoriteIDs identify the saved favorite image;custom_recipeIDs identify custom-recipe GeneralClasses;barcode_food_itemIDs identify BarcodeClass GeneralClasses.
Query and types
types is a comma-separated list.
If it is omitted, all supported food types are selected.
Duplicate types are ignored. Unsupported values return a validation error.
A non-empty query is required whenever at least one of these types is selected:
dishingredientbarcode_food_item
Therefore, because omitting types selects all types, a request without either types or query is not valid.
favorite and custom_recipe can be requested without query. This allows all available favorites or custom recipes to be browsed directly.
A query may still be provided when searching those types in order to filter their results.
Barcode products can be searched by their stored product name or by their barcode value.
Search text comparison is case-insensitive and ignores surrounding whitespace.
Search context and private resources
APIUsers search using their own context. They may omit user_id or explicitly provide their own ID.
APIUserManagers can search in two different contexts:
- if
user_idis omitted, or it contains the authenticated APIUserManager's own ID, the manager is used as the search context; - if
user_ididentifies an APIUser accessible by the manager, that APIUser is used as the search context.
When an APIUserManager searches using manager context:
- custom recipes are resolved from the APIUserManager's APICompany;
- there is no managed APIUser favorite context. To search one APIUser's favorites, provide that APIUser's ID through
user_id.
When an APIUser context is used:
- only that APIUser's favorites are searched;
- custom recipes are restricted to that APIUser's APICompany.
Public dishes, ingredients and stored barcode products do not depend on a target APIUser and are searched normally in either context.
An APIUserManager cannot use an inaccessible APIUser as search context.
Language
Names are returned using the requested language where translations are available.
If language is omitted, the standard API language resolution is used.
Ranking and pagination
Results from all requested types compete in one shared ranking.
Text matches are ranked in this order:
- exact match;
- prefix match;
- partial match.
Within the same match tier, favorites and custom recipes receive a small priority boost over the other food types.
A stronger text match always ranks before a weaker one, regardless of food type.
The order in which values are provided in types does not define the response order.
After candidates from all requested sources have been merged and ranked, offset and limit are applied to the combined result set.
Pagination is therefore global, not performed independently for every food type.
total contains the number of matching items across all requested sources before global pagination.
Cooking measures
When cooking_measures=true, returned items additionally contain cooking_measures with their available cooking-measure IDs.
Favorites can contain several food items and therefore do not expose one aggregate cooking measure. Their cooking_measures value is an empty list.
Barcode food items currently use their stored OpenFoodFacts serving/weight and also return an empty cooking_measures list.
If cooking_measures is false or omitted, the field is not included in the returned food items.
Result metadata
All result types contain:
typeidnameimage_url
image_url can be null when no representative image is available.
Dishes, ingredients, custom recipes and barcode food items may additionally provide default_quantity and unit.
Barcode food items also include their barcode.
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests⦠| |||
429Too Many Requests. Limited by the maximum number of calls per second.
