Update Food Item
const url = 'https://example.com/users/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/food-items/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0';const options = { method: 'PATCH', headers: {'Content-Type': 'application/json'}, body: '{"added_sugar_g":1,"calcium_mg":1,"calories":1,"carbohydrates_g":1,"cholesterol_mg":1,"fat_g":1,"fiber_g":1,"iron_mg":1,"is_drink":true,"name":"example","place":"example","potassium_mg":1,"protein_g":1,"saturated_fat_g":1,"serving_description":"example","sodium_mg":1,"sugar_g":1,"trans_fat_g":1,"vitamin_a_mcg":1,"vitamin_c_mg":1,"vitamin_d_mcg":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://example.com/users/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/food-items/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \ --header 'Content-Type: application/json' \ --data '{ "added_sugar_g": 1, "calcium_mg": 1, "calories": 1, "carbohydrates_g": 1, "cholesterol_mg": 1, "fat_g": 1, "fiber_g": 1, "iron_mg": 1, "is_drink": true, "name": "example", "place": "example", "potassium_mg": 1, "protein_g": 1, "saturated_fat_g": 1, "serving_description": "example", "sodium_mg": 1, "sugar_g": 1, "trans_fat_g": 1, "vitamin_a_mcg": 1, "vitamin_c_mg": 1, "vitamin_d_mcg": 1 }'Edit a food item — “changes apply everywhere this item is used”, with history frozen.
Nutrient fields partial-merge into the per-serving nutrition (null clears); any nutrient or
serving change sets source="user_edited" (clears the “estimated” badge). Propagation:
- Template meal_items (the library’s saved meals) re-snapshot and their parent meals’
aggregates recompute — unless a parent meal is user-edited (
_meta.source == "user"). - Event-scoped meal_items (logged history) keep their frozen snapshots, EXCEPT the event
named by
refresh_event_id— the tray currently being edited — which re-snapshots so the user sees their correction take effect.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Query Parameters
Section titled “Query Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”Partial edit of a food item (“changes apply everywhere this item is used”).
Identity fields (name/place/is_drink/serving_description) and per-serving nutrient values
share one flat payload — the edit sheet saves them together. Nutrient semantics mirror the
saved-meal nutrition PATCH: omitted = untouched, explicit null = clear. Any nutrient or
serving change marks the item user_edited (clears the “estimated” badge and protects it
from the AI job’s values winning a future dedup).
object
Examplegenerated
{ "added_sugar_g": 1, "calcium_mg": 1, "calories": 1, "carbohydrates_g": 1, "cholesterol_mg": 1, "fat_g": 1, "fiber_g": 1, "iron_mg": 1, "is_drink": true, "name": "example", "place": "example", "potassium_mg": 1, "protein_g": 1, "saturated_fat_g": 1, "serving_description": "example", "sodium_mg": 1, "sugar_g": 1, "trans_fat_g": 1, "vitamin_a_mcg": 1, "vitamin_c_mg": 1, "vitamin_d_mcg": 1}Responses
Section titled “Responses”Successful Response
object
Examplegenerated
{ "barcode": "example", "brand": "example", "confidence": "example", "created_at": "2026-04-15T12:00:00Z", "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "is_drink": true, "name": "example", "nutrition": {}, "place": "example", "serving_description": "example", "source": "example", "updated_at": "2026-04-15T12:00:00Z", "usage_count": 1}Validation Error
object
object
Examplegenerated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ]}