Overview
The Costs API manages direct production costs associated with batches. It tracks various cost concepts related to dairy production and provides detailed cost breakdowns per batch.
Base URL
Authentication Required: Yes (all endpoints require cookie-based JWT authentication)
Create Cost
curl -X POST https://api.tambo360.com/costos/registrar \
-H "Content-Type: application/json" \
-H "Cookie: token=<jwt_token>" \
-d '{
"loteId": "b2c3d4e5-6789-01ab-cdef-234567890abc",
"concepto": "leche_cruda",
"monto": 1200.50,
"observaciones": "Costo estimado para producción del lote"
}'
Registers a new direct cost for a production batch.
Request Body
UUID of the batch this cost is associated with. The batch must exist and belong to the authenticated user.
Cost concept/category. Must be one of:
insumos_basicos : Basic supplies (salt, packaging, etc.)
leche_cruda : Raw milk
cuajo_y_fermentos : Rennet and ferments
refrigeracion : Refrigeration and cold storage
Cost amount. Must be positive and cannot exceed 999,999,999. Value is automatically rounded to 2 decimal places.
Additional notes about the cost. Maximum 500 characters. Cannot contain only whitespace.
Response
HTTP status code (201 for success)
“Costo registrado correctamente”
Created cost object: UUID of the associated batch
Cost amount (rounded to 2 decimals)
Creation timestamp (ISO 8601)
201 Success
400 Validation Error
400 Batch Completed
401 Unauthorized
404 Batch Not Found
{
"statusCode" : 201 ,
"message" : "Costo registrado correctamente" ,
"data" : {
"idCostoDirecto" : "f5g6h7i8-9abc-45de-f012-67890abcdef1" ,
"idLote" : "b2c3d4e5-6789-01ab-cdef-234567890abc" ,
"concepto" : "leche_cruda" ,
"monto" : 1200.50 ,
"observaciones" : "Costo estimado para producción del lote" ,
"fechaCreacion" : "2026-03-08T16:20:00.000Z"
},
"timestamp" : "2026-03-08T16:20:00.000Z" ,
"success" : true
}
Get Cost by ID
curl -X GET https://api.tambo360.com/costos/detalle/f5g6h7i8-9abc-45de-f012-67890abcdef1 \
-H "Cookie: token=<jwt_token>"
Retrieves a specific cost record by its ID.
Path Parameters
Response
200 Success
400 Invalid ID
403 Forbidden
404 Not Found
{
"statusCode" : 200 ,
"message" : "Costo obtenido correctamente" ,
"data" : {
"idCostoDirecto" : "f5g6h7i8-9abc-45de-f012-67890abcdef1" ,
"idLote" : "b2c3d4e5-6789-01ab-cdef-234567890abc" ,
"concepto" : "leche_cruda" ,
"monto" : 1200.50 ,
"observaciones" : "Costo estimado para producción del lote" ,
"fechaCreacion" : "2026-03-08T16:20:00.000Z"
},
"timestamp" : "2026-03-08T16:25:00.000Z" ,
"success" : true
}
List Costs by Batch
GET /costos/costos-lote/{loteId}
curl -X GET https://api.tambo360.com/costos/costos-lote/b2c3d4e5-6789-01ab-cdef-234567890abc \
-H "Cookie: token=<jwt_token>"
Retrieves all costs associated with a specific batch.
Path Parameters
Response
HTTP status code (200 for success)
“Costos obtenidos correctamente”
Array of cost objects for the batch:
200 Success
400 Invalid Batch ID
403 Forbidden
404 Batch Not Found
{
"statusCode" : 200 ,
"message" : "Costos obtenidos correctamente" ,
"data" : [
{
"idCostoDirecto" : "f5g6h7i8-9abc-45de-f012-67890abcdef1" ,
"concepto" : "leche_cruda" ,
"monto" : 1200.50 ,
"observaciones" : "Costo estimado para producción del lote" ,
"fechaCreacion" : "2026-03-08T16:20:00.000Z"
},
{
"idCostoDirecto" : "g6h7i8j9-0bcd-56ef-0123-78901bcdef23" ,
"concepto" : "cuajo_y_fermentos" ,
"monto" : 350.75 ,
"observaciones" : null ,
"fechaCreacion" : "2026-03-08T16:25:00.000Z"
}
],
"timestamp" : "2026-03-08T16:30:00.000Z" ,
"success" : true
}
Update Cost
PUT /costos/actualizar/{id}
curl -X PUT https://api.tambo360.com/costos/actualizar/f5g6h7i8-9abc-45de-f012-67890abcdef1 \
-H "Content-Type: application/json" \
-H "Cookie: token=<jwt_token>" \
-d '{
"monto": 1350.00,
"observaciones": "Monto ajustado según factura"
}'
Updates an existing cost record. Only costs associated with incomplete batches can be updated.
Path Parameters
UUID of the cost to update
Request Body
All fields are optional. Only include fields you want to update.
New cost concept (must be a valid concept)
New cost amount (positive, max 999,999,999)
Updated observations (max 500 characters)
Response
200 Success
400 Batch Completed
404 Not Found
{
"statusCode" : 200 ,
"message" : "Costo actualizado correctamente" ,
"data" : {
"idCostoDirecto" : "f5g6h7i8-9abc-45de-f012-67890abcdef1" ,
"idLote" : "b2c3d4e5-6789-01ab-cdef-234567890abc" ,
"concepto" : "leche_cruda" ,
"monto" : 1350.00 ,
"observaciones" : "Monto ajustado según factura" ,
"fechaCreacion" : "2026-03-08T16:20:00.000Z"
},
"success" : true
}
Delete Cost
DELETE /costos/eliminar/{id}
curl -X DELETE https://api.tambo360.com/costos/eliminar/f5g6h7i8-9abc-45de-f012-67890abcdef1 \
-H "Cookie: token=<jwt_token>"
Deletes a cost record. Only costs associated with incomplete batches can be deleted.
Path Parameters
UUID of the cost to delete
Response
200 Success
400 Batch Completed
403 Forbidden
404 Not Found
{
"statusCode" : 200 ,
"message" : "Costo eliminado correctamente" ,
"data" : null ,
"success" : true
}
Cost Concepts Reference
insumos_basicos
Basic production supplies including:
Salt and seasonings
Packaging materials
Cleaning supplies
General production consumables
leche_cruda
Raw milk costs - the primary input for dairy production.
cuajo_y_fermentos
Rennet and fermentation cultures:
Rennet (cuajo) for cheese making
Bacterial cultures
Fermentation starters
refrigeracion
Refrigeration and cold storage costs:
Energy costs for cooling
Cold storage facility expenses
Temperature control systems
Error Responses
400 Bad Request
Invalid input data or validation errors
Invalid cost concept
Amount out of range
Batch is completed (cannot modify costs)
401 Unauthorized
Missing or invalid authentication token
403 Forbidden
User does not own the batch/cost
Insufficient permissions
404 Not Found
Cost does not exist
Associated batch does not exist
500 Internal Server Error