cantidad) and a minimum threshold (cantidad_minima) used to trigger low-stock alerts in the dashboard.
Soft delete is used throughout. Deleting an ingredient sets
borrado_en to the current timestamp. The record is never physically removed from the database and will no longer appear in any list or detail response.Ingredient stock (
cantidad) is automatically deducted when a plato that uses the ingredient is added to a transaction. You can also adjust stock directly via the update endpoint.POST /api/ingredientes
Create a new ingredient.
Authentication: Bearer JWT requiredRequired role:
admin
Request body
Ingredient name. Max 100 characters.
Unit of measure (e.g.
kg, litro, unidad). Max 20 characters.Current available quantity. Float, must be
>= 0.Minimum required quantity for low-stock alerts. Float, must be
>= 0. When cantidad falls below this value the dashboard flags the ingredient.Response
Returns the created ingredient object (201 Created).
Unique identifier generated with nanoid (10 characters).
Ingredient name.
Unit of measure.
Current quantity (float).
Minimum quantity threshold (float).
Creation timestamp.
Last update timestamp.
Soft-delete timestamp.
null for active ingredients.Example
GET /api/ingredientes
Return all active ingredients.
Authentication: Bearer JWT requiredRequired role: any authenticated user
Request parameters
No parameters.Response
Returns an array of ingredient objects (200 OK). Only records where borrado_en IS NULL are included.
Example
GET /api/ingredientes/:id
Return a single active ingredient by ID.
Authentication: Bearer JWT requiredRequired role: any authenticated user
Request parameters
The nanoid of the ingredient.
Response
Returns the ingredient object (200 OK), or 404 Not Found if the ingredient does not exist or has been soft-deleted.
Example
PATCH /api/ingredientes/:id
Partially update an ingredient. All body fields are optional; only the fields you send are updated.
Authentication: Bearer JWT requiredRequired role:
admin
Request parameters
The nanoid of the ingredient to update.
New ingredient name. Max 100 characters.
New unit of measure. Max 20 characters.
Updated quantity. Float, must be
>= 0. Use this field to manually adjust stock.Updated minimum threshold. Float, must be
>= 0.Response
Returns the updated ingredient object (200 OK). actualizado_en is always refreshed.
Example
DELETE /api/ingredientes/:id
Soft-delete an ingredient.
Authentication: Bearer JWT requiredRequired role:
admin
This operation sets
borrado_en and actualizado_en to the current timestamp. The ingredient record is retained in the database and will no longer appear in list or detail responses.Request parameters
The nanoid of the ingredient to delete.
Response
Returns a confirmation message (200 OK).
Confirmation string, e.g.
"Ingrediente con ID cK9mN2pQrS eliminado exitosamente (soft delete)".