Overview
The Batches API (Lotes) manages production batches for dairy products. It allows creation, editing, listing, and tracking of production batches with associated costs and waste.
Base URL
Authentication Required: All endpoints require authentication via cookie-based JWT token.
Create Batch
curl -X POST https://api.tambo360.com/lote/registrar \
-H "Content-Type: application/json" \
-H "Cookie: token=<jwt_token>" \
-d '{
"idProducto": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
"cantidad": 100,
"fechaProduccion": "08/03/2026"
}'
Creates a new production batch for a specific product.
Request Body
UUID of the product. Must be a valid product from the products catalog.
Production quantity. Must be a positive number greater than 0.
Production date in dd/mm/yyyy format. Must be between today and 7 days in the past. Example: “08/03/2026”
Batch status. Defaults to false (in progress).
Response
HTTP status code (201 for success)
“Lote creado correctamente”
Created batch object: Unit of measurement (e.g., “kg”)
Production date in ISO 8601 format
Completion status (false = in progress, true = completed)
Product information: Product category (“quesos” or “leches”)
201 Success
400 Validation Error
400 No Establishment
401 Unauthorized
{
"statusCode" : 201 ,
"message" : "Lote creado correctamente" ,
"data" : {
"idLote" : "b2c3d4e5-6789-01ab-cdef-234567890abc" ,
"idProducto" : "a1b2c3d4-5678-90ab-cdef-1234567890ab" ,
"cantidad" : 100 ,
"unidad" : "kg" ,
"fechaProduccion" : "2026-03-08T14:30:00.000Z" ,
"estado" : false ,
"numeroLote" : 1 ,
"producto" : {
"nombre" : "Queso Cremoso" ,
"categoria" : "quesos"
}
},
"success" : true
}
List Batches
curl -X GET "https://api.tambo360.com/lote/listar?nombre=Queso&orden=desc&pagina=1" \
-H "Cookie: token=<jwt_token>"
Retrieves all production batches for the authenticated user’s establishment with optional filtering and pagination.
Query Parameters
Filter by product name. Minimum 1 character.
Filter by batch number. Must be a numeric string. Example: “15”
Filter by production date in dd/mm/yyyy format. Example: “08/03/2026”
Sort order by production date. Valid values: “asc” or “desc”.
Page number for pagination. Must be greater than 0. Defaults to 1.
Response
HTTP status code (200 for success)
“Lotes listados correctamente”
Paginated batch list: Total number of batches matching filters
Array of batch objects, each containing: Production date (ISO 8601)
Product details (nombre, categoria)
200 Success
400 No Establishment
{
"statusCode" : 200 ,
"message" : "Lotes listados correctamente" ,
"data" : {
"pagina" : 1 ,
"totalPaginas" : 2 ,
"totalLotes" : 30 ,
"lotes" : [
{
"idLote" : "b2c3d4e5-6789-01ab-cdef-234567890abc" ,
"idProducto" : "a1b2c3d4-5678-90ab-cdef-1234567890ab" ,
"cantidad" : 100 ,
"unidad" : "kg" ,
"fechaProduccion" : "2026-03-08T14:30:00.000Z" ,
"estado" : false ,
"numeroLote" : 1 ,
"producto" : {
"nombre" : "Queso Cremoso" ,
"categoria" : "quesos"
},
"mermas" : [],
"costosDirectos" : []
}
]
},
"success" : true
}
Get Batch by ID
GET /lote/buscar-lote/{idLote}
curl -X GET https://api.tambo360.com/lote/buscar-lote/b2c3d4e5-6789-01ab-cdef-234567890abc \
-H "Cookie: token=<jwt_token>"
Retrieves detailed information about a specific batch.
Path Parameters
UUID of the batch to retrieve
Response
200 Success
400 Invalid ID
404 Not Found
{
"statusCode" : 200 ,
"message" : "Lote obtenido correctamente" ,
"data" : {
"idLote" : "b2c3d4e5-6789-01ab-cdef-234567890abc" ,
"idProducto" : "a1b2c3d4-5678-90ab-cdef-1234567890ab" ,
"cantidad" : 100 ,
"unidad" : "kg" ,
"fechaProduccion" : "2026-03-08T14:30:00.000Z" ,
"estado" : false ,
"numeroLote" : 1 ,
"producto" : {
"nombre" : "Queso Cremoso" ,
"categoria" : "quesos"
},
"mermas" : [],
"costosDirectos" : []
},
"success" : true
}
Update Batch
PUT /lote/actualizar/{idLote}
curl -X PUT https://api.tambo360.com/lote/actualizar/b2c3d4e5-6789-01ab-cdef-234567890abc \
-H "Content-Type: application/json" \
-H "Cookie: token=<jwt_token>" \
-d '{
"cantidad": 150,
"fechaProduccion": "07/03/2026"
}'
Updates an existing production batch. Only batches without associated costs or waste can be edited.
Path Parameters
UUID of the batch to update
Request Body
All fields are optional. Only include fields you want to update.
New quantity (must be positive)
New production date in dd/mm/yyyy format
Response
200 Success
400 Cannot Edit
{
"statusCode" : 200 ,
"message" : "Lote actualizado correctamente" ,
"data" : {
"idLote" : "b2c3d4e5-6789-01ab-cdef-234567890abc" ,
"idProducto" : "a1b2c3d4-5678-90ab-cdef-1234567890ab" ,
"cantidad" : 150 ,
"unidad" : "kg" ,
"fechaProduccion" : "2026-03-07T14:30:00.000Z" ,
"estado" : false ,
"numeroLote" : 1 ,
"producto" : {
"nombre" : "Queso Cremoso" ,
"categoria" : "quesos"
}
},
"success" : true
}
Complete Batch
POST /lote/completar/{idLote}
curl -X POST https://api.tambo360.com/lote/completar/b2c3d4e5-6789-01ab-cdef-234567890abc \
-H "Cookie: token=<jwt_token>"
Marks a batch as completed, preventing further modifications.
Path Parameters
UUID of the batch to complete
Response
200 Success
400 Already Completed
{
"statusCode" : 200 ,
"message" : "Lote completado correctamente" ,
"data" : {
"idLote" : "b2c3d4e5-6789-01ab-cdef-234567890abc" ,
"estado" : true
},
"success" : true
}
Get Today’s Production
curl -X GET https://api.tambo360.com/lote/produccion-hoy \
-H "Cookie: token=<jwt_token>"
Retrieves all batches produced today for the authenticated user’s establishment.
Response
200 Success
404 No Production
{
"statusCode" : 200 ,
"message" : "Producción del día" ,
"data" : [
{
"idLote" : "b2c3d4e5-6789-01ab-cdef-234567890abc" ,
"idProducto" : "a1b2c3d4-5678-90ab-cdef-1234567890ab" ,
"cantidad" : 100 ,
"unidad" : "kg" ,
"fechaProduccion" : "2026-03-08T14:30:00.000Z" ,
"estado" : false ,
"numeroLote" : 1 ,
"producto" : {
"nombre" : "Queso Cremoso" ,
"categoria" : "quesos"
}
}
],
"success" : true
}
Delete Batch
DELETE /lote/eliminar/{idLote}
curl -X DELETE https://api.tambo360.com/lote/eliminar/b2c3d4e5-6789-01ab-cdef-234567890abc \
-H "Cookie: token=<jwt_token>"
Deletes a production batch. Only batches without associated costs or waste can be deleted.
Path Parameters
UUID of the batch to delete
Response
200 Success
400 Cannot Delete
{
"statusCode" : 200 ,
"message" : "Lote eliminado correctamente" ,
"data" : null ,
"success" : true
}
Error Responses
400 Bad Request
Invalid input data or validation errors
User has no registered establishment
Batch has associated data (cannot edit/delete)
Batch already completed
401 Unauthorized
Missing or invalid authentication token
403 Forbidden
User does not own the requested batch
404 Not Found
500 Internal Server Error