Food Log

PATCH /api/food-logs/{id}/edit

Request

  • Base URL
    https://api.rewritelifestyle.ai (the document declares no server; this is the origin it was published from)
  • URL
    https://api.rewritelifestyle.ai/api/food-logs/{id}/edit
  • Auth
    HTTP bearer

Path parameters

idnumber required

Headers

x-timezonestring required

Request body

foodNamestring required
descriptionstring
servingSizestring
food_idstring

FatSecret food_id

serving_idstring

FatSecret serving_id

quantitynumber

Quantity in the chosen unit

unitstring

Unit label the user chose

entry_mode'serving' | 'advanced'

Entry mode used in the log sheet: "serving" = native FatSecret serving picker, "advanced" = manual/advanced editor.

caloriesnumber
proteinnumber
carbsnumber
fatnumber
fibernumber
sugarnumber
sodiumnumber
meal_numbernumber
logDatestring
logTimestring
nutritionstring[]

Detailed nutrition breakdown

my_food_idnumber

Reference to a saved "My Foods" entry. When set, missing fields are hydrated from the saved food and last_logged_at is bumped on the source row.

notestring

Optional meal note to attach to this food log entry at create time. Premium-gated (enrolled or paid subscription). Ignored on PATCH.

manual_macrosboolean

Opt-out flag. When true, the server will NOT recompute macros from FatSecret and will trust client-supplied calories/protein/carbs/fat/fiber as-is. Use this for user-overridden portions where the client has authoritative numbers (e.g. label-scan, photo analysis with explicit nutrition_facts override). Default false.

image_refsstring[]

Existing S3 keys to attach to this log (from a previously logged food). Used when logging from the recently-logged list where an image ref already exists. In FormData requests, send as a JSON-encoded string: '["key1","key2"]'. Max 3.

Example request

{
  "foodName": "Chicken Breast",
  "description": "1/4 pizza",
  "servingSize": "4 oz",
  "food_id": "33691",
  "serving_id": "57972",
  "quantity": 3,
  "unit": "oz",
  "entry_mode": "serving",
  "calories": 180,
  "protein": 35,
  "fat": 3.5,
  "sodium": 75,
  "meal_number": 1,
  "logDate": "2024-01-15",
  "logTime": "07:30:00",
  "nutrition": [
    {
      "name": "Sugar",
      "value": 4,
      "unit": "g"
    },
    {
      "name": "Sodium",
      "value": 170,
      "unit": "mg"
    }
  ],
  "my_food_id": 42,
  "note": "Ate out, estimated portions.",
  "image_refs": [
    "food-log-images/42/1234567890.jpg"
  ]
}

Changes

No recorded changes to this operation across all 34 revisions of this API.