Skip to main content
POST
/
problematic-foods
curl --request POST \
  --url https://api.ceboelha.com/problematic-foods \
  --header 'Authorization: Bearer YOUR_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "foodId": 1234,
    "foodName": "Onion",
    "symptomTypes": ["bloating", "gas", "cramps"],
    "intensity": 4,
    "notes": "Ate raw onion in salad, symptoms within 2 hours"
  }'
{
  "success": true,
  "message": "Alimento adicionado à lista de problemáticos",
  "data": {
    "_id": "507f1f77bcf86cd799439011",
    "userId": "507f191e810c19729de860ea",
    "foodId": 1234,
    "foodName": "Onion",
    "totalIncidents": 1,
    "lastIncident": "2024-03-15",
    "status": "suspected",
    "incidents": [
      {
        "diaryEntryId": "507f1f77bcf86cd799439012",
        "date": "2024-03-15",
        "symptomTypes": ["bloating", "gas", "cramps"],
        "intensity": 4,
        "notes": "Ate raw onion in salad, symptoms within 2 hours"
      }
    ],
    "createdAt": "2024-03-15T14:20:00.000Z",
    "updatedAt": "2024-03-15T14:20:00.000Z"
  }
}
Adds a food to the problematic foods list or records a new incident for an already marked food. Returns status 201 for new records and 200 for new incidents on existing records.
If the food is already marked as problematic, this endpoint adds a new incident to the existing record. After 3 or more incidents, the status automatically changes to confirmed.

Authentication

header.Authorization
string
required
Bearer token for authentication. Format: Bearer YOUR_TOKEN

Request Body

body.foodId
number
required
The ID of the food to mark as problematic. Must be a positive integer.
body.symptomTypes
string[]
required
Array of symptom types experienced (minimum 1 required). Valid values: bloating, gas, cramps, nausea, diarrhea, constipation, reflux, fatigue, headache, brain_fog, other.
body.intensity
number
required
Severity of symptoms on a scale of 1-5, where 1 is mild and 5 is severe.
body.diaryEntryId
string
Optional reference to a diary entry. If not provided, a direct incident ID will be generated.
body.foodName
string
Optional food name. If not provided, it will be fetched from the foods database.
body.notes
string
Optional notes about the incident. Maximum 500 characters.

Response

success
boolean
required
Indicates whether the request was successful.
message
string
required
Descriptive message: “Alimento adicionado à lista de problemáticos” for new records or “Novo incidente registrado” for additional incidents.
data
object
required
The created or updated problematic food record.
curl --request POST \
  --url https://api.ceboelha.com/problematic-foods \
  --header 'Authorization: Bearer YOUR_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "foodId": 1234,
    "foodName": "Onion",
    "symptomTypes": ["bloating", "gas", "cramps"],
    "intensity": 4,
    "notes": "Ate raw onion in salad, symptoms within 2 hours"
  }'
{
  "success": true,
  "message": "Alimento adicionado à lista de problemáticos",
  "data": {
    "_id": "507f1f77bcf86cd799439011",
    "userId": "507f191e810c19729de860ea",
    "foodId": 1234,
    "foodName": "Onion",
    "totalIncidents": 1,
    "lastIncident": "2024-03-15",
    "status": "suspected",
    "incidents": [
      {
        "diaryEntryId": "507f1f77bcf86cd799439012",
        "date": "2024-03-15",
        "symptomTypes": ["bloating", "gas", "cramps"],
        "intensity": 4,
        "notes": "Ate raw onion in salad, symptoms within 2 hours"
      }
    ],
    "createdAt": "2024-03-15T14:20:00.000Z",
    "updatedAt": "2024-03-15T14:20:00.000Z"
  }
}

Notes

  • The date field for the incident is automatically set to today’s date
  • Status changes from suspected to confirmed automatically after the 3rd incident
  • If foodName is not provided, it will be fetched from the foods database
  • If the food doesn’t exist in the database, a fallback name will be generated
  • This action triggers achievement recalculation and activity logging in the background
  • User stats (triggersIdentified) are updated when a food reaches confirmed status

Build docs developers (and LLMs) love