Skip to main content

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

/lote
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

idProducto
string
required
UUID of the product. Must be a valid product from the products catalog.
cantidad
number
required
Production quantity. Must be a positive number greater than 0.
fechaProduccion
string
required
Production date in dd/mm/yyyy format. Must be between today and 7 days in the past.Example: “08/03/2026”
estado
boolean
Batch status. Defaults to false (in progress).

Response

statusCode
integer
HTTP status code (201 for success)
message
string
“Lote creado correctamente”
data
object
Created batch object:
idLote
string
UUID of the batch
idProducto
string
UUID of the product
cantidad
number
Production quantity
unidad
string
Unit of measurement (e.g., “kg”)
fechaProduccion
string
Production date in ISO 8601 format
estado
boolean
Completion status (false = in progress, true = completed)
numeroLote
integer
Sequential batch number
producto
object
Product information:
nombre
string
Product name
categoria
string
Product category (“quesos” or “leches”)
{
  "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

nombre
string
Filter by product name. Minimum 1 character.
numeroLote
string
Filter by batch number. Must be a numeric string.Example: “15”
fecha
string
Filter by production date in dd/mm/yyyy format.Example: “08/03/2026”
orden
string
Sort order by production date. Valid values: “asc” or “desc”.
pagina
string
Page number for pagination. Must be greater than 0. Defaults to 1.

Response

statusCode
integer
HTTP status code (200 for success)
message
string
“Lotes listados correctamente”
data
object
Paginated batch list:
pagina
integer
Current page number
totalPaginas
integer
Total number of pages
totalLotes
integer
Total number of batches matching filters
lotes
array
Array of batch objects, each containing:
idLote
string
Batch UUID
idProducto
string
Product UUID
cantidad
number
Production quantity
unidad
string
Unit of measurement
fechaProduccion
string
Production date (ISO 8601)
estado
boolean
Completion status
numeroLote
integer
Batch number
producto
object
Product details (nombre, categoria)
mermas
array
Associated waste records
costosDirectos
array
Associated direct costs
{
  "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

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

idLote
string
required
UUID of the batch to retrieve

Response

{
  "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

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

idLote
string
required
UUID of the batch to update

Request Body

All fields are optional. Only include fields you want to update.
idProducto
string
New product UUID
cantidad
number
New quantity (must be positive)
fechaProduccion
string
New production date in dd/mm/yyyy format

Response

{
  "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

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

idLote
string
required
UUID of the batch to complete

Response

{
  "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

{
  "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

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

idLote
string
required
UUID of the batch to delete

Response

{
  "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

  • Batch does not exist

500 Internal Server Error

  • Unexpected server error

Build docs developers (and LLMs) love