Skip to content

The food object

Where a food lives, its versions, and how its nutrition and portions are described.

Foods come from four libraries, and every food is pointed at by its library and key.

{
"library": "off",
"key": "3017620422003",
"version": 1,
"name": "Nutella",
"brand": "Ferrero",
"barcode": "3017620422003",
"data": {
"base": "g",
"nutrition": {
"basisAmount": 100,
"values": { "kcal": 539, "protein": 6.3, "carbs": 57.5, "fat": 30.9, "saturatedFat": 10.6, "sugars": 56.3, "salt": 0.11 }
},
"measures": [{ "label": "tablespoon", "size": 15 }],
"defaultPortion": { "amount": 15, "unit": "g" }
}
}
Library Holds
mine Your own foods and recipes. Only you see them.
composition Generic ingredients such as eggs or rice.
splot Packaged products in the Splot database.
off Packaged products from Open Food Facts.
FieldTypeDescription
librarystringThe library the food lives in. One of off, splot, mine or composition.
keystringIts key in that library. Send library and key as food to log it.
versionintegerFoods change over time; meals and recipes keep the version they were saved with.
namestringThe food's name.
brandstring or nullThe brand, for packaged products.
barcodestring or nullThe barcode, for packaged products.
dataobjectNutrition, portions and recipe details.
FieldTypeDescription
basestringThe unit nutrition is given in. One of g, ml or serving.
nutritionobjectNutrients for basisAmount of the base unit, such as per 100 g. A nutrient left out is unknown, not zero.
measuresarrayOther portions by name, each { "label", "size" } in the base unit, such as a tablespoon of 15 g. Up to 30 items.
defaultPortionobjectThe usual portion, as { "amount", "unit" }.
compositionstringIngredients as printed on the label. Up to 10,000 characters.
notestringAnything else worth knowing. Up to 10,000 characters.
imagesarrayPhotos, as public links or saved Splot photos. Up to 20 items.
recipeobjectFor a recipe: its servings, optional minutes, and steps.
sourceobjectWhere the values come from, such as { "origin": "label" }, or estimate with a description.
ingredientsarrayFor a recipe: its foods, each with a portion.
thumbnailstringOptional public Storage path for a small food image. Read-only; omit when saving a food.

A recipe’s nutrition is added up from its ingredients, per serving. Each nutrient counts the ingredients that list it; one that none of them list is left out.

Last updated