The Sales API records every beer crate transaction in BodegaX. A complete sale is represented by two resource types that work together: aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Edwin950821/BodegaX/llms.txt
Use this file to discover all available pages before exploring further.
venta (sale header) which captures the overall transaction metadata, and one or more producto_ventas (product line items) which record the quantity and subtotal for each beer brand included in the sale. Creating a sale always requires calling both endpoints in sequence — first POST /ventas/create to obtain the sale UUID, then POST /producto-ventas/create once per product with a quantity greater than zero.
POST /ventas/create
Creates a new sale record in the database. This is the first step in the Despachar Caja (dispatch) workflow, triggered when an admin confirms a client’s crate order. The response contains the sale’suuid, which is immediately used in the subsequent POST /producto-ventas/create calls.
Request Body
The UUID of the admin user who is processing the dispatch. Taken from the session object stored in
sessionStorage under bodegax.The UUID of the client receiving the crates. Selected from the client dropdown in the Despachar Caja dialog, which is populated via
GET /admin/all filtered to role === 'user'.The total monetary value of the sale across all products. Calculated on the frontend by summing
precio × quantity for every product with a quantity greater than zero.The date and time of the sale. The frontend passes
new Date() at the moment the admin confirms dispatch, serialized to an ISO 8601 string.Response
The newly created sale object, including the server-assigneduuid.
After a sale is created, the frontend immediately calls
POST /producto-ventas/create for each product line item and PUT /productos/edit to decrement the stock count. All three operations must succeed for the sale to be fully recorded. The Despachar Caja dialog closes only after the final stock update completes.GET /ventas/all
Returns all sale records in the system. Used by the History page to display the transaction log, and by the TerminarJornada dialog to generate end-of-day PDF reports per client. When the logged-in user hasrole === 'user', the History page filters the result client-side to show only that user’s own sales (history.filter(h => h.uuid_cliente === user.uuid)).
Response
An array of sale objects.Unique identifier for the sale. Used to look up associated product line items from
GET /producto-ventas/all.UUID of the client who received the crates. Resolved to a name by joining against
GET /admin/all.UUID of the admin who processed the dispatch.
The total monetary value of the sale.
ISO 8601 date string of when the sale was created.
POST /producto-ventas/create
Creates a single product line item associated with an existing sale. For every product that had a quantity greater than zero in the Despachar Caja dialog, the frontend calls this endpoint once — passing the sale UUID obtained from thePOST /ventas/create response.
Request Body
The UUID of the product being sold. Taken from the product list loaded by
GET /productos/all.The UUID of the parent sale. This must be the
uuid returned by the POST /ventas/create response for this transaction.The number of crates of this product included in the sale.
The subtotal for this product line:
cantidad × precio. Calculated on the frontend before the request is sent.Response
The newly created product-sale line item object.GET /producto-ventas/all
Returns all product-level sale line items across every transaction. The History page and TerminarJornada dialog use this endpoint to display per-product breakdowns within each sale. After fetching, the frontend resolvesuuid_producto to a product name by joining against GET /productos/all, and groups line items by uuid_venta to attach them to their parent sale.
Response
An array of product-sale line item objects.Unique identifier for this line item.
UUID of the product. Join against
GET /productos/all using this field to retrieve the brand name and price.UUID of the parent sale. Use this to group line items by transaction when building the history view.
Number of crates of this product sold in the transaction.
Subtotal for this product within the sale (
cantidad × precio).