Menu categories group related products together on the Ordervista menu. Every endpoint underDocumentation 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.
/api/categories is protected by verifyToken and authorizeRoles(1), meaning only users with the Administrator role (id_rol: 1) can list, create, update, or delete categories. Categories carry an activo flag; inactive categories (and their products) are excluded from the public-facing menu returned by GET /api/menu.
GET /api/categories
Returns all category records from theCATEGORIAS table, including inactive ones.
Auth required: Yes — Administrator (id_rol: 1)
Response 200 OK
An array of category objects.
Auto-incremented primary key.
Unique category name (up to 100 characters).
Optional description of the category.
Whether the category is visible on the menu. Defaults to
true.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 categorías" | Unexpected server-side error. |
GET /api/categories/:id
Retrieves a single category by its primary key. Auth required: Yes — Administrator (id_rol: 1)
Path parameters
The
id_categoria of the category to retrieve.Response 200 OK
A single category object with the same fields as described in GET /api/categories.
Error responses
| Status | mensaje | Cause |
|---|---|---|
401 | "Token no proporcionado" / "Token inválido" | Missing or invalid JWT. |
403 | "Acceso denegado" | Insufficient role. |
404 | "Categoría no encontrada" | No category exists with the given id. |
500 | "Error al obtener categoría" | Unexpected server-side error. |
POST /api/categories
Creates a new menu category. Auth required: Yes — Administrator (id_rol: 1)
Request body
Category name. Must be unique across all categories (up to 100 characters).
Optional description of the category (up to 255 characters).
Whether the category is active. Defaults to
true if omitted.Response 201 Created
Confirmation message:
"Categoría creada correctamente".The auto-generated primary key of the new category.
Error responses
| Status | mensaje | Cause |
|---|---|---|
400 | "El nombre de la categoría es obligatorio" | nombre field is missing or empty. |
401 | "Token no proporcionado" / "Token inválido" | Missing or invalid JWT. |
403 | "Acceso denegado" | Insufficient role. |
500 | "Error al crear categoría" | Unexpected server-side error. |
PUT /api/categories/:id
Updates one or more fields on an existing category. Only the fields provided in the request body are updated. Auth required: Yes — Administrator (id_rol: 1)
Path parameters
The
id_categoria of the category to update.Request body
All fields are optional.New category name. Must remain unique.
New description text.
Set to
false to hide the category (and its products) from the public menu.Response 200 OK
Confirmation message:
"Categoría actualizada correctamente".Error responses
| Status | mensaje | Cause |
|---|---|---|
401 | "Token no proporcionado" / "Token inválido" | Missing or invalid JWT. |
403 | "Acceso denegado" | Insufficient role. |
404 | "Categoría no encontrada" | No category exists with the given id. |
500 | "Error al actualizar categoría" | Unexpected server-side error. |
DELETE /api/categories/:id
Permanently removes a category from the system. Auth required: Yes — Administrator (id_rol: 1)
Path parameters
The
id_categoria of the category to delete.Response 200 OK
Confirmation message:
"Categoría eliminada correctamente".Error responses
| Status | mensaje | Cause |
|---|---|---|
401 | "Token no proporcionado" / "Token inválido" | Missing or invalid JWT. |
403 | "Acceso denegado" | Insufficient role. |
404 | "Categoría no encontrada" | No category exists with the given id. |
500 | "Error al eliminar categoría" | Unexpected server-side error. |