id as a path parameter.
Authentication: Bearer JWT required
If you add an ingredient that was previously removed from the dish, the system restores the soft-deleted record and updates its quantity rather than creating a duplicate entry.
POST /api/platos/:id/ingredientes
Adds an ingredient to a dish’s recipe.
Required role: admin
Request
Path parameters
The dish ID (nanoid, 10 characters)
Body
The ID of the ingredient to add (must exist and not be soft-deleted)
Required quantity of this ingredient per serving (min: 0.01)
Response
Success (201)
Dish ID
Ingredient ID
Required quantity per serving
Creation timestamp (ISO 8601)
Last update timestamp (ISO 8601)
Soft-delete timestamp —
null for active recordsError responses
| Status | Description |
|---|---|
| 400 | Ingredient is already added to this dish |
| 401 | Unauthorized |
| 403 | Forbidden — role is not admin |
| 404 | Dish or ingredient not found |
Example
GET /api/platos/:id/ingredientes
Returns the list of active ingredients in a dish’s recipe, joined with ingredient metadata.
Required role: any authenticated user
Request
Path parameters
The dish ID (nanoid, 10 characters)
Response
Success (200)
An array of ingredient entries with joined ingredient data.Ingredient ID
Required quantity per serving
Ingredient name (joined from
ingredientes table)Unit of measurement (joined from
ingredientes table), e.g. "kg", "lt", "unidad"Error responses
| Status | Description |
|---|---|
| 401 | Unauthorized |
| 404 | Dish not found |
Example
PATCH /api/platos/:id/ingredientes/:ingredienteId
Updates the quantity of a specific ingredient in a dish’s recipe.
Required role: admin
Request
Path parameters
The dish ID (nanoid, 10 characters)
The ingredient ID
Body
New required quantity per serving (min: 0.01)
Response
Success (200)
Confirmation message:
"Cantidad de ingrediente actualizada correctamente"Error responses
| Status | Description |
|---|---|
| 401 | Unauthorized |
| 403 | Forbidden — role is not admin |
| 404 | Dish not found or ingredient not in dish’s recipe |
Example
DELETE /api/platos/:id/ingredientes/:ingredienteId
Removes an ingredient from a dish’s recipe (soft delete on the plato_ingredientes record).
Required role: admin
Request
Path parameters
The dish ID (nanoid, 10 characters)
The ingredient ID to remove
Response
Success (200)
Confirmation message:
"Ingrediente removido del plato exitosamente"Error responses
| Status | Description |
|---|---|
| 401 | Unauthorized |
| 403 | Forbidden — role is not admin |
| 404 | Dish not found or ingredient not in dish’s recipe |