Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/15aozzz/Lab-Nova-Salud/llms.txt

Use this file to discover all available pages before exploring further.

The comprobantes endpoints serve two purposes: listing previously issued vouchers (used by the Comprobantes history page) and providing the metadata the register screen needs before a new sale — the available document types and the next correlative number.
All routes require a valid JWT in the Authorization: Bearer <token> header.

GET /api/comprobantes

Returns the list of all issued sales vouchers. Supports filtering by date range, document type, and search text. Calls sp_listar_comprobantes.

Query parameters

fecha_inicio
string
Start date for filtering results (ISO date string, e.g., "2024-01-01"). Optional.
fecha_fin
string
End date for filtering results (ISO date string, e.g., "2024-01-31"). Optional.
tipo
string
Document type filter (e.g., "BOLETA", "FACTURA"). Pass "TODOS" or omit to return all types.
busqueda
string
Text search matched against client name or voucher number. Optional.

Response

200 OK — returns an array of voucher records.
id_venta
number
Internal sale ID. Use with GET /api/ventas/:id for full detail.
serie
string
Document series (e.g., "B001").
numero_documento
string
Correlative document number.
tipo_comprobante
string
Document type (e.g., "BOLETA DE VENTA").
fecha_venta
string
ISO timestamp of the sale.
total
number
Sale total amount.
nombres_razon_social
string
Client name recorded on the voucher.

Errors

StatusConditionBody
500Database or server error{ "error": "<message>" }

Example

curl --request GET \
  --url 'http://localhost:3000/api/comprobantes?fecha_inicio=2024-01-01&fecha_fin=2024-01-31&tipo=BOLETA' \
  --header 'Authorization: Bearer <token>'

GET /api/comprobantes/tipos

Returns the list of active document types configured for this pharmacy (e.g., Boleta de Venta, Factura). Calls sp_get_tipos_comprobante. The IDs returned here are what you pass as id_tipo_comprobante when registering a sale.

Parameters

No parameters required.

Response

200 OK — returns an array of document type records.
id_tipo_comprobante
number
Document type ID. Use this as id_tipo_comprobante in POST /api/ventas/registrar.
nombre
string
Human-readable document type name (e.g., "BOLETA DE VENTA", "FACTURA").
prefijo_serie
string
Series prefix letter used for numbering (e.g., "B" for Boleta, "F" for Factura).

Errors

StatusConditionBody
500Database or server error{ "error": "<message>" }

Example

curl --request GET \
  --url http://localhost:3000/api/comprobantes/tipos \
  --header 'Authorization: Bearer <token>'
Response
[
  {
    "id_tipo_comprobante": 1,
    "nombre": "BOLETA DE VENTA",
    "prefijo_serie": "B"
  },
  {
    "id_tipo_comprobante": 2,
    "nombre": "FACTURA",
    "prefijo_serie": "F"
  }
]

GET /api/comprobantes/serie/:id_tipo

Returns the series string and the next correlative number for a given document type. Calls sp_get_serie_correlativo. Call this endpoint after the cashier selects a document type so the register can display the document number that will be issued.

Path parameters

id_tipo
number
required
Document type ID. Obtain valid IDs from GET /api/comprobantes/tipos.

Response

200 OK
serie
string
required
Current series assigned to this document type (e.g., "B001").
correlativo
string
required
Next sequential number, zero-padded to 8 digits (e.g., "00000042"). This is the number that will appear on the next issued document.

Errors

StatusConditionBody
404No series configured for the given document type ID{ "error": "Tipo de comprobante no encontrado" }
500Database or server error{ "error": "<message>" }
The correlative returned is informational — the actual correlative is assigned atomically inside sp_registrar_venta. Do not use this value to pre-generate document numbers.

Example

curl --request GET \
  --url http://localhost:3000/api/comprobantes/serie/1 \
  --header 'Authorization: Bearer <token>'
Response
{
  "serie": "B001",
  "correlativo": "00000042"
}

Build docs developers (and LLMs) love