Categories organize products into logical groups. Every product can belong to one category, and the categories API supports filtering products by category in the products endpoint. The list endpoint includes a product count per category and falls back to the local SQLite replica when the cloud database is unreachable. Base URL:Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Carlos-Gnd/FERRED-Inventario-y-Ventas/llms.txt
Use this file to discover all available pages before exploring further.
https://server-production-3252.up.railway.app
GET /api/categorias
Returns all active categories, ordered alphabetically by name. Each entry includes the number of products assigned to it. Required role: Any authenticated user (ADMIN, CAJERO, BODEGA)
Response
Array of category objects.Unique category ID.
Category name (unique across the catalog).
Optional description of the category.
Number of active products assigned to this category.
list categories
POST /api/categorias
Creates a new category. Category names must be unique — attempting to create a duplicate name returns400.
Required role: ADMIN or BODEGA
Request body
Category name. Minimum 2 characters. Must be unique.
Optional description for the category.
Response
Confirmation message:
"Categoría creada".The newly created category.
Error responses
| Status | Condition |
|---|---|
400 | Validation failed (name too short) or a category with that name already exists. |
401 | Missing or invalid Bearer token. |
403 | Authenticated user’s role is not ADMIN or BODEGA. |
create category
PUT /api/categorias/:id
Updates an existing category. All fields are optional (partial update). Required role:ADMIN or BODEGA
Path parameters
ID of the category to update.
Request body
New category name. Minimum 2 characters.
New description.
Response
Confirmation:
"Categoría actualizada".The updated category object (same shape as create response).
DELETE /api/categorias/:id
Soft-deletes a category by settingactivo = false. The category is hidden from the list endpoint but its data is preserved so that existing product foreign key references remain valid. Products previously assigned to this category retain their categoriaId and are unaffected.
Required role: ADMIN only
Path parameters
ID of the category to deactivate. Must be a positive integer.
Response
Confirmation:
"Categoría desactivada".Error responses
| Status | Condition |
|---|---|
400 | id is not a valid positive integer. |
403 | Authenticated user’s role is not ADMIN. |
404 | No category found with the given ID (Prisma record not found). |