Open Food Log v0
Three documents. Nutrients are per 100 g on a food and as eaten on a meal item, each key in the unit it names. Every value a server did not get from the person or a source is listed in estimates. The rules are in the specification.
Open Food Log v0: meal
One meal or snack: what the person said they ate, the food each item was matched to, how much, what it held, and where the record came from. Draft; may change until v1. Schema: https://openfoodlog.org/schema/v0/meal.json.
| Field | Type | Meaning |
|---|---|---|
$schema | the constant https://openfoodlog.org/schema/v0/meal.json | |
date | string (date) | The person's local day, for a meal logged without a time. With eaten_at as well, it must be eaten_at's day in the person's time zone. |
eaten_at | string (date-time) | When it was eaten, with an offset. |
estimates | array of string | JSON pointers (RFC 6901) to values that were inferred or assumed rather than given: a size the person didn't say, a weight read from a photo, a food's numbers a model guessed. |
id | string | Assigned by the server that stores the meal. |
items required | array of item | |
meal_type | one of breakfast, lunch, dinner, snack | |
notes | string | |
source required | source | |
title | string | |
updated_at | string (date-time) | When the stored record last changed, by the server's clock. For mirroring; absent from a document that was never stored. |
amount
How much, in the measure the person used.
| Field | Type | Meaning |
|---|---|---|
portion | string | With unit portion: the id of one of the food's portions. |
unit required | one of g, kg, oz, lb, ml, l, fl_oz, portion | |
value required | number |
food
The food an item was matched to. catalogue and custom are confirmed; close and unmatched need the person to confirm; none means there is nothing to match, because the person gave the numbers themselves ('about 600 calories').
| Field | Type | Meaning |
|---|---|---|
id required | string or null | A food ID (ofc:, gtin:, usr: or another namespace); null when nothing matched. |
match required | one of catalogue, close, custom, unmatched, none | |
name required | string |
item
One thing eaten.
| Field | Type | Meaning |
|---|---|---|
amount | amount | |
food | food | |
grams | number | The amount as a weight, worked out from amount and the food's portions or density (section 6 of the spec). |
id | string | Assigned by the server; used to edit the item. |
notes | string | |
nutrients | nutrients | What this item held, as counted when it was logged. It does not change when the food's record later does. A key left out is unknown, never zero. |
text required | string | What the person called it, in their words. |
source
Provenance: where the record came from. The same shape as an Open Workout Schema workout's.
| Field | Type | Meaning |
|---|---|---|
client | string | The client or app, e.g. claude, myfitnesspal, cronometer. |
external_id | string or null | The meal's ID in the app it came from. |
kind required | one of app, mcp, api, import |
Open Food Log v0: food
One food: what it is, what 100 g of it holds, and the portions people measure it in. Draft; may change until v1. Schema: https://openfoodlog.org/schema/v0/food.json.
| Field | Type | Meaning |
|---|---|---|
$schema | the constant https://openfoodlog.org/schema/v0/food.json | |
aliases | array of object | |
brand | string | |
density_g_per_ml | number | Grams per millilitre, so an amount in ml or fl oz can be weighed. Leave it out when it isn't known. |
gtin | array of string | Barcodes the product is sold under, as 14 digits (shorter codes zero-padded on the left). |
id required | string | namespace:slug. ofc: is the Open Food Catalogue; gtin: is a packaged product by its GTIN as 14 digits; usr: is one person's own food, meaningful only where it was made. |
identifiers | object | The food's IDs in other databases. |
kind required | one of generic, branded, restaurant, custom | generic: a food as such (a raw egg). branded: a packaged product. restaurant: a dish as one restaurant serves it. custom: a person's own food. |
name required | string | The canonical name, in English for the catalogue. |
nutrients_per_100g required | nutrients | What 100 g of the food holds, as eaten in the state the name says (raw, cooked, dry). A nutrient left out is unknown, never zero. |
portions | array of portion | Named measures with their weight: '1 large' egg is 50 g, '1 cup' of oats 81 g. Cups and spoons are portions, because what they weigh depends on the food. |
previous_ids | array of string | |
provenance | provenance | |
replaced_by | string | |
status | one of active, deprecated, replaced |
nutrients
Amounts keyed by nutrient, each in the unit its key names (nutrients.json). A key left out is unknown, never zero. x- keys are a producer's own.
| Field | Type | Meaning |
|---|---|---|
added_sugars_g | number | |
alcohol_g | number | |
caffeine_mg | number | |
calcium_mg | number | |
carbohydrate_g | number | |
cholesterol_mg | number | |
energy_kcal | number | |
fat_g | number | |
fiber_g | number | |
iron_mg | number | |
magnesium_mg | number | |
monounsaturated_fat_g | number | |
polyunsaturated_fat_g | number | |
potassium_mg | number | |
protein_g | number | |
saturated_fat_g | number | |
sodium_mg | number | |
sugars_g | number | |
trans_fat_g | number | |
vitamin_a_rae_ug | number | |
vitamin_c_mg | number | |
vitamin_d_ug | number | |
water_g | number | |
zinc_mg | number |
portion
| Field | Type | Meaning |
|---|---|---|
grams required | number | |
id required | string | Unique within the food; a meal item names it. |
is_default | boolean | The portion to assume when a person names the food without a size. At most one per food. |
label required | string | What one of it is called: '1 large', '1 cup, sliced'. |
provenance
| Field | Type | Meaning |
|---|---|---|
generated | array of string | JSON pointers to values a model produced rather than a source or a person. |
license | string | The record's own licence, as an SPDX identifier. |
review | one of unreviewed, reviewed | |
sources | array of object |
Open Food Log v0: log
A person's whole food log as one file: what an export holds and an import can read. A server may add more of the person's record beside these keys; readers ignore keys they don't know. Draft; may change until v1. Schema: https://openfoodlog.org/schema/v0/log.json.
| Field | Type | Meaning |
|---|---|---|
$schema | the constant https://openfoodlog.org/schema/v0/log.json | |
deleted_meals | array of object | Meals the person deleted, newest first, for a server that keeps them until the account is deleted. |
exported_at required | string (date-time) | |
foods | array of food.json | The person's own foods (usr:) that the meals name, so a reader elsewhere can resolve them. Catalogue and gtin: foods may be included too. |
meals required | array of meal.json | Every meal in the log, newest first. |