Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Eleazarguitar18/kantuta_pos_front/llms.txt

Use this file to discover all available pages before exploring further.

Products are the core of the Kantuta POS inventory system. Each product tracks its sale price, purchase cost, current stock, minimum stock threshold, and the category it belongs to. All routes require a valid Bearer Token JWT in the Authorization header. The list endpoint returns only active products with the categoria object pre-loaded, so you have everything you need to display a full product listing without a second request.
The stock_actual field is decremented automatically by the backend when a sale is created via POST /ventas. You should not manually subtract stock when recording a sale — only update stock_actual directly via PATCH /inventario/producto/:id for manual inventory adjustments such as corrections or writeoffs.

Interface Reference

export interface Categoria {
  id?: number;
  nombre: string;
  estado: boolean;
  id_user_create: number | null;
  id_user_update?: number | null;
  created_at: string;
  updated_at: string;
}

export interface Producto {
  id?: number;
  nombre: string;
  codigo_barras?: string | null;
  precio_venta: number;
  costo_compra: number;
  stock_actual: number;
  stock_minimo: number;
  id_categoria: number;
  categoria?: Categoria; // Pre-loaded on list and single-item responses
  id_user_create?: number;
  id_user_update?: number;
  created_at?: string;
  updated_at?: string;
}

GET /inventario/producto

Returns all active products. Each item in the array includes the full categoria object, so you can display category information without additional requests. Authentication: Required — Authorization: Bearer <access_token>

Response Fields

id
number
required
Unique identifier for the product.
nombre
string
required
Display name of the product.
codigo_barras
string | null
Barcode string for the product, or null if not assigned.
precio_venta
number
required
Retail sale price. Must be >= 0.
costo_compra
number
required
Unit purchase cost. Must be >= 0. Updated automatically when a purchase is recorded.
stock_actual
number
required
Current units in stock. Decremented on each sale; incremented on each purchase.
stock_minimo
number
required
Minimum stock threshold. Use this to trigger low-stock alerts in the UI.
id_categoria
number
required
Foreign key referencing the parent category.
categoria
Categoria
required
The full category object associated with this product.
estado
boolean
required
Active flag. Only true records are returned by this endpoint.
created_at
string
required
ISO 8601 creation timestamp.
updated_at
string
required
ISO 8601 last-update timestamp.
curl --request GET \
  --url http://localhost:3000/inventario/producto \
  --header "Authorization: Bearer <access_token>"

POST /inventario/producto

Creates a new product in the inventory and returns the saved object with the categoria relation populated. Authentication: Required — Authorization: Bearer <access_token>

Request Body

nombre
string
required
Display name of the product.
codigo_barras
string
Optional barcode string. Omit or pass null if the product has no barcode.
precio_venta
number
required
Retail sale price per unit. Must be >= 0.
costo_compra
number
required
Unit purchase cost. Must be >= 0.
stock_actual
number
required
Starting stock quantity. Must be >= 0.
stock_minimo
number
required
Minimum stock level before a low-stock alert is triggered. Must be >= 0.
id_categoria
number
required
ID of an existing active category to associate with this product.

Response Fields

id
number
required
Auto-generated unique identifier.
nombre
string
required
Name of the newly created product.
categoria
Categoria
required
The populated category object matching id_categoria.
estado
boolean
required
Defaults to true on creation.
created_at
string
required
ISO 8601 creation timestamp.
curl --request POST \
  --url http://localhost:3000/inventario/producto \
  --header "Authorization: Bearer <access_token>" \
  --header "Content-Type: application/json" \
  --data '{
    "nombre": "Coca-Cola 500ml",
    "codigo_barras": "7750414101219",
    "precio_venta": 5.50,
    "costo_compra": 3.20,
    "stock_actual": 100,
    "stock_minimo": 10,
    "id_categoria": 2
  }'

GET /inventario/producto/:id

Fetches a single product by its numeric ID, including the categoria relation. Authentication: Required — Authorization: Bearer <access_token>

Path Parameters

id
number
required
The unique identifier of the product to retrieve.

Response Fields

id
number
required
Unique identifier of the product.
nombre
string
required
Display name of the product.
codigo_barras
string | null
Barcode value or null.
precio_venta
number
required
Current retail price.
costo_compra
number
required
Current unit cost.
stock_actual
number
required
Units currently in stock.
stock_minimo
number
required
Minimum stock threshold.
categoria
Categoria
required
The full parent category object.
estado
boolean
required
Active status of the product.
curl --request GET \
  --url http://localhost:3000/inventario/producto/7 \
  --header "Authorization: Bearer <access_token>"

PATCH /inventario/producto/:id

Partially updates a product. All fields are optional — only the fields you include will be modified. Useful for correcting pricing, adjusting stock, or reassigning a category. Authentication: Required — Authorization: Bearer <access_token>

Path Parameters

id
number
required
The unique identifier of the product to update.

Request Body

nombre
string
Updated display name for the product.
codigo_barras
string
Updated barcode string.
precio_venta
number
Updated retail price. Must be >= 0.
costo_compra
number
Updated unit purchase cost. Must be >= 0.
stock_actual
number
Manually override the current stock level. Must be >= 0.
stock_minimo
number
Updated minimum stock threshold. Must be >= 0.
id_categoria
number
ID of the new category to assign to this product.
id_user_update
number
ID of the authenticated user performing this update. Used for audit tracking.

Response Fields

id
number
required
Unique identifier of the updated product.
nombre
string
required
Current name after the update.
precio_venta
number
required
Current sale price after the update.
stock_actual
number
required
Current stock level after the update.
updated_at
string
required
ISO 8601 timestamp of this update.
curl --request PATCH \
  --url http://localhost:3000/inventario/producto/7 \
  --header "Authorization: Bearer <access_token>" \
  --header "Content-Type: application/json" \
  --data '{
    "precio_venta": 6.00,
    "stock_minimo": 15,
    "id_user_update": 1
  }'

DELETE /inventario/producto/:id

Deactivates a product by setting its estado field to false. The record is not permanently removed from the database. Authentication: Required — Authorization: Bearer <access_token>
This is a soft delete. The product record is kept in the database with estado set to false. It will no longer appear in the GET /inventario/producto list, but existing sale and purchase records that reference this product are unaffected.

Path Parameters

id
number
required
The unique identifier of the product to deactivate.
curl --request DELETE \
  --url http://localhost:3000/inventario/producto/7 \
  --header "Authorization: Bearer <access_token>"

Build docs developers (and LLMs) love