The Products API provides full CRUD access to individual menu items stored in theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ytabeloved/ordervista/llms.txt
Use this file to discover all available pages before exploring further.
PRODUCTOS table. All endpoints under /api/products require a valid JWT and are restricted to the Administrator role (id_rol: 1). Each product belongs to a category via id_categoria, carries a decimal precio, an integer stock count, an optional imagen URL, and an activo flag. Only active products in active categories with stock greater than zero are surfaced on the public menu via GET /api/menu.
GET /api/products
Returns all product records from thePRODUCTOS table, including inactive products and those with zero stock. Results are fetched via a JOIN with the CATEGORIAS table, so each object also includes the resolved category name.
Auth required: Yes — Administrator (id_rol: 1)
Response 200 OK
An array of product objects.
Auto-incremented primary key.
Product name (up to 150 characters).
Optional description of the product.
Unit price. Stored as
DECIMAL(10,2).Current available quantity. Defaults to
0.URL to the product image (up to 255 characters), or
null.Whether the product is active. Defaults to
true.Foreign key referencing the category this product belongs to.
Human-readable category name resolved from the
CATEGORIAS table.Error responses
| Status | mensaje | Cause |
|---|---|---|
401 | "Token no proporcionado" / "Token inválido" | Missing or invalid JWT. |
403 | "Acceso denegado" | Authenticated user does not have the Administrator role. |
500 | "Error al obtener productos" | Unexpected server-side error. |
GET /api/products/:id
Retrieves a single product by its primary key. Auth required: Yes — Administrator (id_rol: 1)
Path parameters
The
id_producto of the product to retrieve.Response 200 OK
A single product object with the same fields as described in GET /api/products.
Error responses
| Status | mensaje | Cause |
|---|---|---|
401 | "Token no proporcionado" / "Token inválido" | Missing or invalid JWT. |
403 | "Acceso denegado" | Insufficient role. |
404 | "Producto no encontrado" | No product exists with the given id. |
500 | "Error al obtener producto" | Unexpected server-side error. |
POST /api/products
Creates a new menu product.nombre, precio, and id_categoria are required; all other fields are optional.
Auth required: Yes — Administrator (id_rol: 1)
Request body
Product name (up to 150 characters).
Unit price as a decimal number (e.g.
8500.00).Foreign key of the category to assign this product to. Must reference an existing
id_categoria.Optional description of the product.
Initial available stock quantity. Defaults to
0 if omitted.Optional URL pointing to the product image (up to 255 characters).
Whether the product is active. Defaults to
true if omitted.Response 201 Created
Confirmation message:
"Producto creado correctamente".The auto-generated primary key of the new product.
Error responses
| Status | mensaje | Cause |
|---|---|---|
400 | "Nombre, precio y categoría son obligatorios" | One or more of nombre, precio, or id_categoria is missing. |
401 | "Token no proporcionado" / "Token inválido" | Missing or invalid JWT. |
403 | "Acceso denegado" | Insufficient role. |
500 | "Error al crear producto" | Unexpected server-side error. |
PUT /api/products/:id
Updates one or more fields on an existing product. Only the fields provided in the request body are changed. Auth required: Yes — Administrator (id_rol: 1)
Path parameters
The
id_producto of the product to update.Request body
All fields are optional.New product name.
New description.
New unit price.
New stock quantity.
New image URL.
New category assignment.
Set to
false to deactivate the product and hide it from the menu.Response 200 OK
Confirmation message:
"Producto actualizado correctamente".Error responses
| Status | mensaje | Cause |
|---|---|---|
401 | "Token no proporcionado" / "Token inválido" | Missing or invalid JWT. |
403 | "Acceso denegado" | Insufficient role. |
404 | "Producto no encontrado" | No product exists with the given id. |
500 | "Error al actualizar producto" | Unexpected server-side error. |
DELETE /api/products/:id
Permanently removes a product from the system. Auth required: Yes — Administrator (id_rol: 1)
Path parameters
The
id_producto of the product to delete.Response 200 OK
Confirmation message:
"Producto eliminado correctamente".Error responses
| Status | mensaje | Cause |
|---|---|---|
401 | "Token no proporcionado" / "Token inválido" | Missing or invalid JWT. |
403 | "Acceso denegado" | Insufficient role. |
404 | "Producto no encontrado" | No product exists with the given id. |
500 | "Error al eliminar producto" | Unexpected server-side error. |