Skip to main content
DELETE
/
problematic-foods
/
{id}
curl --request DELETE \
  --url https://api.ceboelha.com/problematic-foods/507f1f77bcf86cd799439011 \
  --header 'Authorization: Bearer YOUR_TOKEN'
{
  "success": true,
  "message": "Alimento removido da lista de problemáticos"
}
Permanently deletes a problematic food record and all associated incidents. This action cannot be undone.
This endpoint removes the entire problematic food record, including all incident history. To remove only a specific incident, use the Remove Incident endpoint instead.

Authentication

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

Path Parameters

path.id
string
required
The unique identifier of the problematic food record to delete. Must be a valid MongoDB ObjectId.

Response

success
boolean
required
Indicates whether the deletion was successful.
message
string
required
Confirmation message: “Alimento removido da lista de problemáticos”.
curl --request DELETE \
  --url https://api.ceboelha.com/problematic-foods/507f1f77bcf86cd799439011 \
  --header 'Authorization: Bearer YOUR_TOKEN'
{
  "success": true,
  "message": "Alimento removido da lista de problemáticos"
}

Alternative: Remove Individual Incident

To remove only a specific incident while keeping the food in the problematic list:
DELETE /problematic-foods/{id}/incidents/{incidentId}
When removing an incident, if it’s the last incident for that food, the entire problematic food record will be automatically deleted.

Incident Removal Response

success
boolean
required
Indicates whether the incident removal was successful.
message
string
required
Message indicating the result: “Incidente removido com sucesso” or “Último incidente removido, alimento removido da lista”.
data
object
Updated problematic food record (null if the last incident was removed and the food was deleted).

Request Example: Remove Specific Incident

curl --request DELETE \
  --url https://api.ceboelha.com/problematic-foods/507f1f77bcf86cd799439011/incidents/507f1f77bcf86cd799439012 \
  --header 'Authorization: Bearer YOUR_TOKEN'

Response Example: Incident Removed

{
  "success": true,
  "message": "Incidente removido com sucesso",
  "data": {
    "_id": "507f1f77bcf86cd799439011",
    "userId": "507f191e810c19729de860ea",
    "foodId": 1234,
    "foodName": "Onion",
    "totalIncidents": 2,
    "lastIncident": "2024-03-10",
    "status": "suspected",
    "incidents": [
      {
        "diaryEntryId": "507f1f77bcf86cd799439013",
        "date": "2024-03-10",
        "symptomTypes": ["bloating", "gas"],
        "intensity": 3
      },
      {
        "diaryEntryId": "507f1f77bcf86cd799439014",
        "date": "2024-03-05",
        "symptomTypes": ["bloating"],
        "intensity": 2
      }
    ],
    "createdAt": "2024-03-05T10:30:00.000Z",
    "updatedAt": "2024-03-15T14:25:00.000Z"
  }
}

Notes

  • Only the authenticated user who created the problematic food record can delete it
  • Invalid ObjectId formats will return a 404 error
  • User stats (triggersIdentified) are automatically updated after deletion
  • When an incident is removed and the status changes from confirmed to suspected (incidents drop below 3), user stats are recalculated
  • The incidentId parameter in the incident removal endpoint refers to the diaryEntryId field of the incident

Build docs developers (and LLMs) love