Skip to content

Update Food Item

PATCH
/users/{user_id}/food-items/{item_id}
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.
user_id
required
User Id
string format: uuid
item_id
required
Item Id
string format: uuid
refresh_event_id
Any of:
string format: uuid
Media typeapplication/json
FoodItemUpdate

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
added_sugar_g
Any of:
number
calcium_mg
Any of:
number
calories
Any of:
number
carbohydrates_g
Any of:
number
cholesterol_mg
Any of:
number
fat_g
Any of:
number
fiber_g
Any of:
number
iron_mg
Any of:
number
is_drink
Any of:
boolean
name
Any of:
string
place
Any of:
string
potassium_mg
Any of:
number
protein_g
Any of:
number
saturated_fat_g
Any of:
number
serving_description
Any of:
string
sodium_mg
Any of:
number
sugar_g
Any of:
number
trans_fat_g
Any of:
number
vitamin_a_mcg
Any of:
number
vitamin_c_mg
Any of:
number
vitamin_d_mcg
Any of:
number
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
}

Successful Response

Media typeapplication/json
FoodItemRead
object
barcode
required
Any of:
string
brand
required
Brand
string
confidence
required
Any of:
string
created_at
required
Created At
string format: date-time
id
required
Id
string format: uuid
is_drink
required
Is Drink
boolean
name
required
Name
string
nutrition
required
Any of:
object
key
additional properties
any
place
required
Any of:
string
serving_description
required
Any of:
string
source
required
Source
string
updated_at
required
Updated At
string format: date-time
usage_count
required
Usage Count
integer
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

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
Examplegenerated
{
"detail": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
]
}