Skip to main content
PATCH
/
users
/
{user_id}
/
nutrition
/
meals
/
{meal_id}
Update meal (PATCH)
curl --request PATCH \
  --url https://production.api.onvy.health/users/{user_id}/nutrition/meals/{meal_id} \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "meal_time": "2024-10-28T12:00:00Z",
  "description": "Grilled chicken breast with quinoa and steamed broccoli",
  "image_base64": "data:image/jpeg;base64,/9j/4AAQSkZJRg...",
  "portion_multiplier": 1.5,
  "comment": "Homemade healthy lunch"
}
'
{
  "id": "meal_01JCXVK5N3P4Q2R7S8T9U0V1W2",
  "user_id": "<string>",
  "project_id": "<string>",
  "meal_time": "2024-10-28T12:00:00Z",
  "analysis_status": "complete",
  "created_at": "2024-10-28T12:05:00Z",
  "updated_at": "2024-10-28T12:10:00Z",
  "description": "Grilled chicken breast with quinoa and steamed broccoli",
  "image_url": "https://s3.amazonaws.com/bucket/meals/image.jpg?X-Amz-...",
  "portion_multiplier": 1.5,
  "comment": "Homemade healthy lunch",
  "analysis_error": "Failed to analyze meal: Image is not food-related",
  "summary_id": "aisummary_01JCXVK5N3P4Q2R7S8T9U0V1W2",
  "ai_generated": true,
  "title": "Meal Summary",
  "text": "Great balanced meal! This chicken with broccoli and brown rice provides excellent protein (35g) with moderate carbs.",
  "name": "Grilled Chicken with Vegetables",
  "ingredients": "chicken breast, broccoli, brown rice, olive oil",
  "calories": 450,
  "protein_grams": 35,
  "fat_grams": 12,
  "carbohydrate_grams": 45,
  "sugar_grams": 5,
  "fiber_grams": 6,
  "glucose_spike_mg_dl": 25,
  "healthiness_score": "A"
}

Authorizations

X-API-Key
string
header
required

API key for authentication

Path Parameters

user_id
string
required

User ID (e.g., google_104940819145861640201)

meal_id
string
required

Meal ID

Body

application/json

Partial meal data

Input schema for creating or updating a meal

meal_time
string<date-time>
required

ISO 8601 timestamp of when the meal was consumed

Example:

"2024-10-28T12:00:00Z"

description
string
required

Text description of the meal/food consumed. Required if image_base64 is not provided.

Maximum string length: 2000
Example:

"Grilled chicken breast with quinoa and steamed broccoli"

image_base64
string

Base64-encoded image data with data URI prefix. Required if description is not provided.

Pattern: ^data:image/(jpeg|png|jpg);base64,[A-Za-z0-9+/=]+$
Example:

"data:image/jpeg;base64,/9j/4AAQSkZJRg..."

portion_multiplier
number
default:1

Multiplier for portion size (default 1.0)

Required range: 0.1 <= x <= 10
Example:

1.5

comment
string

Additional comment about the meal

Maximum string length: 500
Example:

"Homemade healthy lunch"

Response

Meal updated successfully

A meal record with nutrition analysis status

id
string
required

Unique meal identifier (ULID format)

Example:

"meal_01JCXVK5N3P4Q2R7S8T9U0V1W2"

user_id
string
required

User ID this meal belongs to

project_id
string
required

Project ID this meal belongs to

meal_time
string<date-time>
required

ISO 8601 timestamp of when the meal was consumed

Example:

"2024-10-28T12:00:00Z"

analysis_status
enum<string>
required

Status of nutrition analysis

Available options:
pending,
complete,
failed
Example:

"complete"

created_at
string<date-time>
required

ISO 8601 timestamp when the meal was created

Example:

"2024-10-28T12:05:00Z"

updated_at
string<date-time>
required

ISO 8601 timestamp when the meal was last updated

Example:

"2024-10-28T12:10:00Z"

description
string

Text description of the meal/food consumed

Maximum string length: 2000
Example:

"Grilled chicken breast with quinoa and steamed broccoli"

image_url
string<uri>

Presigned URL to access the meal image (expires in 24 hours)

Example:

"https://s3.amazonaws.com/bucket/meals/image.jpg?X-Amz-..."

portion_multiplier
number
default:1

Multiplier for portion size

Required range: 0.1 <= x <= 10
Example:

1.5

comment
string

Additional comment about the meal

Maximum string length: 500
Example:

"Homemade healthy lunch"

analysis_error
string

Error message when analysis_status is 'failed' (max 500 characters, truncated if longer)

Maximum string length: 500
Example:

"Failed to analyze meal: Image is not food-related"

summary_id
string

Reference to the AI-generated MealSummary (set when analysis completes)

Example:

"aisummary_01JCXVK5N3P4Q2R7S8T9U0V1W2"

ai_generated
boolean

True if this meal has been analyzed by AI

Example:

true

title
string

AI-generated title for the meal summary

Example:

"Meal Summary"

text
string

AI-generated analysis text

Example:

"Great balanced meal! This chicken with broccoli and brown rice provides excellent protein (35g) with moderate carbs."

name
string

AI-identified meal name

Example:

"Grilled Chicken with Vegetables"

ingredients
string

AI-identified ingredients list

Example:

"chicken breast, broccoli, brown rice, olive oil"

calories
integer

Estimated calories (kcal)

Example:

450

protein_grams
number

Estimated protein in grams

Example:

35

fat_grams
number

Estimated fat in grams

Example:

12

carbohydrate_grams
number

Estimated carbohydrates in grams

Example:

45

sugar_grams
number

Estimated sugar in grams

Example:

5

fiber_grams
number

Estimated fiber in grams

Example:

6

glucose_spike_mg_dl
integer

Estimated glucose spike in mg/dL

Example:

25

healthiness_score
string

Overall healthiness grade (A-E, where A is healthiest and E is least healthy)

Example:

"A"