Skip to content
opis.Nutrition API

Nutrients

Every nutrition result reports the same 53 nutrients, keyed by stable public keys. The dictionary below is generated from the published contract (opis.public-nutrients/v1) and is also served at GET /v1/nutrients.

How values work

Portion totals. A nutrient value on an item is the amount in that item's portion — at its grams — not per 100 g. If you need per-100 g values (for example to rescale on the device), request them with ?include=per_100g and they appear beside the totals.

JSON
"nutrients": {
  "energy_kcal": { "value": 297.7, "unit": "kcal", "derivation": "analysed" },
  "vitamin_d": null
}

Null means "not measured", never zero. When the source database has no value for a nutrient, the value is null. Do not render it as 0 — show "not available" or leave it out. Most foods have complete macronutrients; vitamins and trace minerals are sparser, especially for fallback sources.

Meal totals skip nulls and tell you so. nutrition.totals.nutrients sums only the item values that exist, and nutrition.totals.completeness tells you, per nutrient, the share of resolved items that contributed (from 0 to 1). A vitamin D total with completeness 0.5 means half the items had no vitamin D value — the true total is probably higher. A nutrient that no item has is null in totals.

JSON
"totals": {
  "nutrients": { "energy_kcal": { "value": 341.2, "unit": "kcal" }, "vitamin_d": { "value": 0.4, "unit": "ug" } },
  "completeness": { "energy_kcal": 1.0, "vitamin_d": 0.5 },
  "items_unresolved": 0
}

Units are UCUM codes: g, mg, ug (micrograms, µg), kcal, kJ. A key's unit never changes within v1.

Provenance. Each value carries derivation — how the source database obtained it:

derivationMeaning
analysedMeasured by laboratory analysis
calculatedCalculated from a recipe or from other components
imputedEstimated from a similar food
borrowedCopied from another food or database
nullThe source does not record it

and each item's match says which database and food the values come from:

match.sourceDatabase
cofidUK Composition of Foods Integrated Dataset (McCance and Widdowson's) — the primary source
usda_fndds, usda_foundation, usda_brandedUSDA FoodData Central, used when CoFID has no good match
open_food_factsOpen Food Facts, for packaged products
noneUnresolved: the item could not be matched (all nutrients null, flag item_unresolved)

match.approximate: true marks a generic stand-in for a more specific food (for example a branded ready meal matched to its generic recipe).

Stability. Keys are append-only within v1: a key is never renamed or removed, and new nutrients may be added. Ignore keys you do not know.

Dictionary

The Sources column lists the databases that can supply each nutrient today. USDA fallbacks cover a subset of the dictionary; values a source cannot supply are null.

Energy (2)

KeyUnitINFOODS tagSources
energy_kcalkcalENERCCoFID, Open Food Facts
energy_kjkJENERCCoFID, Open Food Facts

Macronutrients (8)

KeyUnitINFOODS tagSources
proteingPROCNTCoFID, Open Food Facts
total_fatgFATCoFID, Open Food Facts
total_carbohydrategCHOAVLCoFID, Open Food Facts
dietary_fibergNSPCoFID, Open Food Facts
fibre_aoacgFIBTGCoFID
starchgSTARCHCoFID
nitrogengNTCoFID
alcoholgALCCoFID

Sugars (8)

KeyUnitINFOODS tagSources
total_sugarsgSUGARCoFID, Open Food Facts
added_sugarsg—Not yet available
glucosegGLUSCoFID
fructosegFRUSCoFID
sucrosegSUCSCoFID
lactosegLACSCoFID
maltosegMALSCoFID
galactosegGALSCoFID

Fat quality (5)

KeyUnitINFOODS tagSources
saturated_fatgFASATCoFID, Open Food Facts
monounsaturated_fatgFAMSCoFID
polyunsaturated_fatgFAPUCoFID
trans_fatgFATRNCoFID, Open Food Facts
cholesterolmgCHOLECoFID, Open Food Facts

Vitamins (18)

KeyUnitINFOODS tagSources
vitamin_aug (µg)VITACoFID, Open Food Facts
retinolug (µg)RETOLCoFID
retinol_equivalentug (µg)VITACoFID
carotene_totalug (µg)CARTBEQCoFID
alpha_caroteneug (µg)CARTACoFID
beta_caroteneug (µg)CARTBCoFID
vitamin_cmgVITCCoFID, Open Food Facts
vitamin_dug (µg)VITDCoFID, Open Food Facts
vitamin_emgVITECoFID, Open Food Facts
vitamin_kug (µg)VITK1CoFID, Open Food Facts
thiaminmgTHIACoFID, Open Food Facts
riboflavinmgRIBFCoFID, Open Food Facts
niacinmgNIACoFID, Open Food Facts
vitamin_b6mgVITB6ACoFID, Open Food Facts
folateug (µg)FOLCoFID, Open Food Facts
vitamin_b12ug (µg)VITB12CoFID, Open Food Facts
pantothenatemgPANTACCoFID
biotinug (µg)BIOTCoFID

Minerals (12)

KeyUnitINFOODS tagSources
sodiummgNACoFID, Open Food Facts
potassiummgKCoFID, Open Food Facts
calciummgCACoFID, Open Food Facts
magnesiummgMGCoFID, Open Food Facts
phosphorusmgPCoFID, Open Food Facts
ironmgFECoFID, Open Food Facts
coppermgCUCoFID
zincmgZNCoFID, Open Food Facts
chloridemgCLCoFID
manganesemgMNCoFID
seleniumug (µg)SECoFID
iodineug (µg)IDCoFID