The Ventas API handles the complete sales lifecycle in Kantuta POS. When a sale is created, the system automatically calculates the order total from the provided line items, deducts stock from inventory for each product sold, and links the transaction to an active cash register session. Sales can later be edited or voided with an audit trail, and a dedicated report endpoint provides date-ranged financial summaries suitable for generating PDF reports.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.
All endpoints require a valid
Authorization: Bearer <access_token> header. A sale cannot be created unless the referenced id_sesion_caja corresponds to a currently ABIERTA session.Create a Sale
total automatically from the provided detalles (quantity × unit price) and decrements stock_actual for each product involved.
Request Body
Payment method used for the transaction. One of:
EFECTIVO, QR, TRANSFERENCIA.ID of the currently active (open) cash register session to associate this sale with.
Array of line items — each must include
id_producto, cantidad, and precio_unitario.ID of the product being sold.
Number of units sold. Minimum
1.Selling price per unit at the time of sale. Minimum
0.ID of the user creating this record (audit trail).
Example Request
Response
Returns the createdVenta object with calculated totals and all line items.
Unique identifier of the sale.
Auto-calculated sum of all line item subtotals (quantity × unit price per line).
Payment method recorded:
EFECTIVO, QR, or TRANSFERENCIA.Initial status is always
"COMPLETADA".ISO 8601 timestamp of the transaction.
ID of the session this sale belongs to.
Array of line items with calculated
subtotal per item.Populated only if the sale has been edited or voided.
List All Sales
detalles (line items). Results are ordered by creation date descending.
Get a Single Sale
Path Parameters
The numeric ID of the sale.
Update or Void a Sale
ANULADA). All changes are tracked via estado_venta and motivo_edicion.
Path Parameters
The numeric ID of the sale to update.
Request Body
All fields are optional. Provide only the fields you wish to change.Corrected payment method:
EFECTIVO, QR, or TRANSFERENCIA.Updated session reference.
New status:
COMPLETADA, ANULADA, or EDITADA.Required reason when setting
estado_venta to ANULADA or EDITADA.ID of the user making the change (audit trail).
Delete a Sale
PATCH with estado_venta: "ANULADA" for a softer audit-safe void.
Path Parameters
The numeric ID of the sale to delete.
Sales Summary Report
200 (not the default 201 for POST).
Request Body
Start date/time of the reporting period (ISO 8601, e.g.
"2024-01-01").End date/time of the reporting period (ISO 8601, e.g.
"2024-01-31").TypeScript Interfaces
Stock Auto-Deduction: Upon successful sale creation,
stock_actual is automatically decremented for each product in detalles. If any product has insufficient stock, the entire sale request is rejected. Always check current stock levels via the Inventario API before processing large transactions.