---
title: "Preview server-authoritative macros for a (food_id, quantity, unit) tuple"
method: POST
path: "/api/food-log/preview-macros"
tags: ["Food Log"]
---

# Preview server-authoritative macros for a (food_id, quantity, unit) tuple

`POST /api/food-log/preview-macros`

## 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-log/preview-macros`
- Auth: HTTP bearer

## Request body

- PreviewMacrosDto
  - `food_id` string, required: FatSecret food id
  - `quantity` number, required
  - `unit` string, required: Unit label (g, oz, each, large, …)
  - `serving_id` string: FatSecret serving_id the user picked from the food's servings array. When provided, the recompute uses THAT serving's per-serving nutrition and metric reference instead of the FS default. Required for foods whose servings are not linear scalings of each other (raw vs cooked, with-skin vs without, piece vs volume) — without it, preview anchors on the wrong baseline. When the id does not match any serving the food currently exposes, falls back to the FS default and logs a warning.
  - `region` string: FatSecret region override. Currently advisory only — getFoodDetails is region-agnostic, so the value is echoed back in the response but does not affect the FS lookup. Matches createFoodLog/editFoodLog behavior. Reserved for future region-scoped lookups.

## Response `200`

- unknown

---

[API](https://skmtc.dev/rewritelifestyle/apis/rewrite-lifestyle-api.md) - [All operations](https://skmtc.dev/rewritelifestyle/apis/rewrite-lifestyle-api/llms.txt) - [OpenAPI document](https://skmtc.dev/rewritelifestyle/apis/rewrite-lifestyle-api/revisions/28695827f27a?raw)
