Skip to main content
POST
Log a meal

Authorizations

Authorization
string
header
default:Bearer sandbox_any_token_works
required

A 15-minute token bound to one patient and one enrollment, issued by POST /v1/oauth/token with the token-exchange grant. Treat it as opaque. When it expires, exchange a fresh assertion; there is no refresh token.

Headers

Idempotency-Key
string
required

A unique key per logical request, for example a UUID. Retrying with the same key and the same body within 24 hours returns the first response (with Idempotent-Replayed: true) instead of creating a duplicate. The same key with a different body is refused with 422 idempotency_key_reused.

Required string length: 8 - 255

Body

application/json
eaten_at
string<date-time>
required

ISO 8601 in UTC.

Example:

"2026-10-26T14:05:00Z"

meal_type
enum<string>
Available options:
breakfast,
lunch,
dinner,
snack
Example:

"lunch"

meal_plan_item_id
string<uuid>

Set when the patient ate a meal from their plan.

Example:

"3c1e8f20-5b7a-4d9c-8e61-0a2b4c6d8e01"

description
string
Maximum string length: 1000
Example:

"Greek yogurt with berries and almonds"

photo_upload_id
string<uuid>
write-only

From POST /v1/patient/meal-photos, after the photo was uploaded. Not returned; read photo_url instead.

Example:

"8e2c4a60-1f3b-4d5e-9a7c-0b2d4f6a8c1e"

entry_method
enum<string>

How it was entered. photo_ai when the form was pre-filled by POST /v1/patient/meal-photos/{upload_id}/analysis (send the same photo_upload_id); TeraRx then compares what was saved with the estimate.

Available options:
manual,
photo,
photo_ai,
text_ai,
barcode,
plan
Example:

"manual"

protein_g
number
Required range: 0 <= x <= 500
Example:

24

calories_kcal
integer
Required range: 0 <= x <= 10000
Example:

310

carbs_g
number
Required range: x >= 0
Example:

28

fat_g
number
Required range: x >= 0
Example:

11

fiber_g
number
Required range: x >= 0
Example:

6

sugar_g
number
Required range: x >= 0
Example:

14

sodium_mg
integer
Required range: x >= 0
Example:

95

nutrients
object

Vitamins, minerals and anything else, keyed by nutrient code.

Example:
ingredients
object[]
Maximum array length: 50
external_id
string

Your id for this log. A second log with the same id returns the first one instead of a duplicate.

Required string length: 1 - 128
Pattern: ^[\x21-\x7E]+$
Example:

"meal-77120"

Response

Logged.

eaten_at
string<date-time>
required

ISO 8601 in UTC.

Example:

"2026-10-26T14:05:00Z"

id
string<uuid>
required
Example:

"0190f5c9-5d6e-7f70-8a92-1b2c3d4e5f60"

log_date
string<date>
required

A calendar date in the patient's time zone.

Example:

"2026-10-26"

source
enum<string>
required
read-only

Set by the API from the caller. brand_api for brand servers, brand_app for patient tokens issued to a brand.

Available options:
app,
brand_app,
brand_api,
wearable,
coach,
ai,
system
Example:

"brand_app"

created_at
string<date-time>
required

ISO 8601 in UTC.

Example:

"2026-10-26T14:05:00Z"

updated_at
string<date-time>
required

When the log was last corrected; the same as created_at until then.

Example:

"2026-10-26T14:05:00Z"

meal_type
enum<string>
Available options:
breakfast,
lunch,
dinner,
snack
Example:

"lunch"

meal_plan_item_id
string<uuid>

Set when the patient ate a meal from their plan.

Example:

"3c1e8f20-5b7a-4d9c-8e61-0a2b4c6d8e01"

description
string
Maximum string length: 1000
Example:

"Greek yogurt with berries and almonds"

entry_method
enum<string>

How it was entered. photo_ai when the form was pre-filled by POST /v1/patient/meal-photos/{upload_id}/analysis (send the same photo_upload_id); TeraRx then compares what was saved with the estimate.

Available options:
manual,
photo,
photo_ai,
text_ai,
barcode,
plan
Example:

"manual"

protein_g
number
Required range: 0 <= x <= 500
Example:

24

calories_kcal
integer
Required range: 0 <= x <= 10000
Example:

310

carbs_g
number
Required range: x >= 0
Example:

28

fat_g
number
Required range: x >= 0
Example:

11

fiber_g
number
Required range: x >= 0
Example:

6

sugar_g
number
Required range: x >= 0
Example:

14

sodium_mg
integer
Required range: x >= 0
Example:

95

nutrients
object

Vitamins, minerals and anything else, keyed by nutrient code.

Example:
ingredients
object[]
Maximum array length: 50
external_id
string

Your id for this log. A second log with the same id returns the first one instead of a duplicate.

Required string length: 1 - 128
Pattern: ^[\x21-\x7E]+$
Example:

"meal-77120"

photo_url
string<uri> | null
read-only

Short-lived link to the photo (expires within minutes). Do not store it.

Example:

null