Occasion Detection
See also: Custom Occasions to define personalized occasions your users.
Plan & Token Requirements
Feature available in the following LogMeal Plans:
Accessible by the following User Types:
⚫ APICompany | 🔴 APIUser | 🔵 APIUserManager
What It Does
Occasion Detection labels each intake with an occasion according to the time of food registration (e.g., Breakfast, Lunch, Dinner, Snack). Default time windows are provided out‑of‑the‑box and you can customize occasions to fit your product. Users (or your app) can also manually change the occasion of an existing intake.


When to Use It / Outcomes
- You want to group meals by time of day (breakfast/lunch/dinner/snack) in calendars and diaries.
- You need occasion‑aware analytics (e.g., Nutri‑Score by meal, variety by occasion).
- You want to trigger reminders or coaching based on missing/intense intake at certain times.
- Output: Each intake stores an occasion label; it is visible in history endpoints and can be modified later.
Feature-Specific Details
-
Default mapping (server‑side):
- 06:00–10:00 → Breakfast
- 12:00–15:00 → Lunch
- 18:00–23:00 → Dinner
- Outside these windows → Snack
-
Customization: Define custom occasion groups and translations for your app.
-
Manual override: You can modify the occasion of a previously uploaded intake.
-
Timezone aware: Detection takes the user's assigned timezone into account.
-
Downstream use: Occasions can be used to group daily intakes and power per‑occasion scores.
Related Endpoints
-
POST /intake/modifyOccasion → ⚫ 🔴 🔵 Modify the occasion of an uploaded intake.
-
GET /history/getIntakesList → ⚫ 🔴 🔵 List intakes (with their occasion) between two dates.
-
Optional (Custom Occasions):
- GET /intake/getOccasionGroups → ⚫ 🔴 🔵 Get existing occasion groups.
- POST /intake/createOccasionGroup → ⚫ 🔵 Create a new occasion group.
- POST /intake/createOccasionTranslation → ⚫ 🔵 Create a new occasion translation.
-
Optional (Per‑occasion scores):
- GET /score/{date}/meal/{occasion}/nutriScore → 🔴 Nutri‑Score for a specific date and occasion.
- GET /score/variety → 🔴 Variety Score over a period (optionally filtered by occasion).
Remember to check applicable request limitations inside each of the endpoints.
Typical Workflow
- Create an intake using your preferred intake input flow (image, barcode, manual).
- The system assigns an occasion automatically from the registration time (considering timezone and custom groups).
- Optionally override the detected occasion via POST /intake/modifyOccasion.
- Query history with GET /history/getIntakesList to display meals grouped by occasion.
- Compute per‑occasion insights (e.g., Nutri‑Score) using the related scoring endpoints if desired.
Updated about 10 hours ago