The Products resource (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Eleazarguitar18/kantuta_pos_back/llms.txt
Use this file to discover all available pages before exploring further.
/inventario/producto) is the core of the Kantuta POS inventory system. Each Producto represents a saleable item with its own pricing, cost, barcode, and live stock counters. Products belong to a Categoria — the category relation is eagerly loaded on every query so you always receive the full category object alongside the product. Stock levels are managed automatically: stock_actual is decremented when a sale (venta) includes the product and incremented when a purchase (compra) is registered, keeping your counts in sync without manual intervention.
All endpoints in this section require a valid JWT access token. Include it as
Authorization: Bearer <access_token> on every request.The Producto object
Auto-incremented primary key.
Full display name of the product.
Optional barcode string (e.g. EAN-13). Enables fast product lookup at point of sale.
null when not provided.Selling price charged to the customer. Stored as a decimal with up to 12 digits and 2 decimal places.
Acquisition cost of the product. Stored as a decimal with up to 12 digits and 2 decimal places. Used for margin calculations.
Current physical quantity available. Automatically decremented on each sale and incremented on each purchase.
Minimum stock threshold. When
stock_actual drops to or below this value, a low-stock alert should be shown in your frontend.The full
Categoria object this product belongs to. Always included (eager relation).true while the product is active. Set to false by a soft delete.ID of the user who created this record.
ID of the user who last updated this record.
ISO 8601 timestamp of record creation.
ISO 8601 timestamp of the last update.
Endpoints
Create a product
POST /inventario/producto
Creates a new product in the inventory. The linked id_categoria must reference an existing, active category. All price and stock fields must be zero or positive — negative values are rejected by validation.
Request body
Full product name. Must be a non-empty string.
Optional barcode (e.g. EAN-13, UPC-A). Omit or pass
null if the product has no barcode.Selling price. Must be a number ≥ 0. Stored with 2 decimal places.
Purchase cost. Must be a number ≥ 0. Stored with 2 decimal places.
Initial stock on hand. Must be an integer ≥ 0.
Minimum stock threshold for low-stock alerts. Must be an integer ≥ 0.
Numeric ID of the category this product belongs to. The referenced category must exist.
Numeric ID of the authenticated user performing the creation. Stored for audit purposes.
Example
Response 200 OK
List all products
GET /inventario/producto
Returns an array of all products in the inventory with their nested categoria relation preloaded. Because categoria is an eager relation on the Producto entity, the category object is always included — no extra query parameters are needed.
Example
Response 200 OK
Get a product by ID
GET /inventario/producto/:id
Retrieves a single product by its numeric primary key. The categoria relation is always included in the response.
Path parameters
The numeric primary key of the product.
Example
Response 200 OK
Update a product
PATCH /inventario/producto/:id
Partially updates an existing product. All body fields are optional — send only what you need to change. The updated_at timestamp is refreshed automatically on every successful update.
Path parameters
The numeric primary key of the product to update.
Request body
Updated product name.
Updated barcode. Pass
null to clear an existing barcode.Updated selling price. Must be ≥ 0.
Updated purchase cost. Must be ≥ 0.
Updated stock count. Must be an integer ≥ 0. Prefer letting sales and purchases adjust this automatically; only use this field for manual corrections.
Updated minimum stock threshold. Must be an integer ≥ 0.
Reassign the product to a different category by providing its ID.
Numeric ID of the authenticated user performing the update. Stored for audit purposes.
Example
Response 200 OK
Delete a product (soft delete)
DELETE /inventario/producto/:id
Soft-deletes a product by setting its estado field to false. The record is not physically removed from the database. Historical sales and purchase lines that reference this product continue to resolve correctly.
stock_actual is automatically decremented when a sale (venta) includes this product, and automatically incremented when a purchase (compra) registers it. Manual adjustments via PATCH should only be used for inventory corrections.Path parameters
The numeric primary key of the product to soft-delete.
Example
Response 200 OK
Returns an empty body with HTTP status 200.