Skip to main content

Endpoint

GET /diary

Authentication

This endpoint requires authentication via Bearer token.
Authorization: Bearer <token>

Query Parameters

date
string
Filter entries by specific date in YYYY-MM-DD format (e.g., “2024-03-15”)
startDate
string
Start date for date range filter in YYYY-MM-DD format
endDate
string
End date for date range filter in YYYY-MM-DD format
type
string
Filter by entry type. Options: meal, symptom, all

Response

success
boolean
Indicates if the request was successful
data
array
Array of diary entries
_id
string
Entry ID (MongoDB ObjectId)
userId
string
User ID who created the entry
date
string
Entry date in YYYY-MM-DD format
type
string
Entry type: meal or symptom
meal
object
Meal data (only present when type is “meal”)
type
string
Meal type: breakfast, lunch, dinner, or snack
time
string
Time in HH:MM format
foods
array
Array of foods consumed
foodId
number
Food database ID
foodName
string
Name of the food
portion
string
Portion description
quantity_g
number
Quantity in grams
markedAsBad
boolean
Whether this food was marked as problematic
calculatedNutrition
object
Calculated nutritional values
calories
number
Calories (kcal)
carbs
number
Carbohydrates (g)
protein
number
Protein (g)
fat
number
Fat (g)
sugar
number
Sugar (g)
fiber
number
Fiber (g)
sodium
number
Sodium (mg)
notes
string
Additional notes about the meal
symptom
object
Symptom data (only present when type is “symptom”)
type
string
Symptom type: bloating, gas, cramps, nausea, diarrhea, constipation, reflux, fatigue, headache, brain_fog, or other
intensity
number
Intensity level from 1 (mild) to 5 (severe)
time
string
Time in HH:MM format
duration
number
Duration in minutes
notes
string
Additional notes about the symptom
createdAt
string
Timestamp when the entry was created
updatedAt
string
Timestamp when the entry was last updated

Examples

Get all entries for a specific date

curl -X GET "https://api.ceboelha.com/diary?date=2024-03-15" \
  -H "Authorization: Bearer YOUR_TOKEN"

Get all meal entries in a date range

curl -X GET "https://api.ceboelha.com/diary?startDate=2024-03-01&endDate=2024-03-31&type=meal" \
  -H "Authorization: Bearer YOUR_TOKEN"

Get only symptom entries

curl -X GET "https://api.ceboelha.com/diary?type=symptom" \
  -H "Authorization: Bearer YOUR_TOKEN"
{
  "success": true,
  "data": [
    {
      "_id": "65f1a2b3c4d5e6f7a8b9c0d1",
      "userId": "65e1a2b3c4d5e6f7a8b9c0d1",
      "date": "2024-03-15",
      "type": "meal",
      "meal": {
        "type": "breakfast",
        "time": "08:30",
        "foods": [
          {
            "foodId": 1234,
            "foodName": "Aveia",
            "portion": "1 xícara",
            "quantity_g": 80,
            "calculatedNutrition": {
              "calories": 303,
              "carbs": 54.8,
              "protein": 10.7,
              "fat": 5.3,
              "sugar": 0.8,
              "fiber": 8.2,
              "sodium": 2
            }
          },
          {
            "foodId": 5678,
            "foodName": "Banana",
            "portion": "1 média",
            "quantity_g": 120,
            "markedAsBad": false,
            "calculatedNutrition": {
              "calories": 105,
              "carbs": 27,
              "protein": 1.3,
              "fat": 0.4,
              "sugar": 14.4,
              "fiber": 3.1,
              "sodium": 1
            }
          }
        ],
        "notes": "Primeira refeição após jejum"
      },
      "createdAt": "2024-03-15T08:35:22.000Z",
      "updatedAt": "2024-03-15T08:35:22.000Z"
    },
    {
      "_id": "65f1a2b3c4d5e6f7a8b9c0d2",
      "userId": "65e1a2b3c4d5e6f7a8b9c0d1",
      "date": "2024-03-15",
      "type": "symptom",
      "symptom": {
        "type": "bloating",
        "intensity": 3,
        "time": "14:30",
        "duration": 45,
        "notes": "Começou após o almoço"
      },
      "createdAt": "2024-03-15T14:32:10.000Z",
      "updatedAt": "2024-03-15T14:32:10.000Z"
    }
  ]
}

Build docs developers (and LLMs) love