---
title: "Log a meal"
method: POST
path: "/api/meals"
tags: ["Meals"]
---

# Log a meal

`POST /api/meals`

## Request

- Base URL: `https://api.hiyd.ai`
- URL: `https://api.hiyd.ai/api/meals`
- Auth: HTTP bearer

## Request body `multipart/form-data`

- object
  - `meal_type` 'breakfast' | 'lunch' | 'dinner' | 'snack', required
  - `meal_name` string
  - `meal_date` string, date
  - `meal_time` string, time
  - `food_item_id` string, uuid: Canonical food_items row to log. When sent with `quantity`, the backend recomputes all nutrition totals server-side and ignores client-sent totals.
  - `quantity` number: Amount consumed, in the food's serving_size_unit
  - `quantity_unit` string: Unit for quantity (defaults to the food's serving_size_unit)
  - `image` string, binary: Food image file (max 5MB) - will be attached to the `food` object as `image_url`
  - `food` object, required: Food item details (from create food or search)
    - `id` string, uuid
    - `name` string
    - `brand` string
    - `category` string
    - `food_type` string
    - `serving_size_g` number
    - `serving_size_unit` string
    - `calories` number
    - `protein_g` number
    - `carbs_g` number
    - `fat_g` number
    - `saturated_fat_g` number, nullable
    - `fiber_g` number
    - `sugar_g` number
    - `sodium_mg` number
    - `cholesterol_mg` number
    - `vitamin_a_mcg` number
    - `vitamin_c_mg` number
    - `vitamin_d_mcg` number
    - `calcium_mg` number
    - `iron_mg` number
    - `potassium_mg` number
    - `barcode` string
    - `image_url` string
    - `verified` boolean
    - `source` string
    - `is_active` boolean
    - `created_at` string, date-time
    - `updated_at` string, date-time
    - `ingredients` string[]
    - `prep_time_minutes` number

## Response `201`

Meal logged successfully

- Meal
  - `id` string, uuid
  - `user_id` string, uuid
  - `meal_type` 'breakfast' | 'lunch' | 'dinner' | 'snack'
  - `meal_name` string
  - `meal_date` string, date
  - `meal_time` string, time
  - `total_calories` number
  - `total_protein_g` number
  - `total_carbs_g` number
  - `total_fat_g` number
  - `items` object[]

---

[API](https://skmtc.dev/hiyd/apis/hiyd-backend-api.md) - [All operations](https://skmtc.dev/hiyd/apis/hiyd-backend-api/llms.txt) - [OpenAPI document](https://skmtc.dev/hiyd/apis/hiyd-backend-api/revisions/23598d347e1b?raw)
