FacturaCompraApiLineaDto
Detail line of a purchase invoice. Unlike sales, the catalog behind it is producto_factura_compra — separate from the inventory catalog used by POST /facturas.
Fields
| Field | Type | Required | Description |
|---|---|---|---|
idProducto | number | One of the two paths | ID in the purchase-invoice catalog. Not the sales inventory catalog. |
descripcion | string | If there’s no idProducto | Description of the line. Creates the item in the purchase catalog. |
codigoCabys | string | If there’s no idProducto | 13-digit CAByS code. See CAByS codes. |
unidadMedida | string | Optional | Hacienda unit of measure. Default "Unid". |
cantidad | number | Yes | Quantity greater than 0. |
precioUnitario | number | Optional | Price in the document’s currency. If the line comes by idProducto and it’s omitted, uses the one from the purchase catalog. |
numeroVin | string | Optional | VIN number, for lines that require it. |
numeroRegistro | string | Optional | Health-registry number or equivalent. |
codigoPresentacion | string | Optional | Product presentation code. |
interface FacturaCompraApiLineaDto {
/** ID of the product in the purchase-invoice catalog (producto_factura_compra).
NOT the sales inventory catalog. Alternative: descripcion + codigoCabys. */
idProducto?: number | null;
/** Required if you don't send idProducto. Creates the line in the purchase catalog. */
descripcion?: string | null;
/** Required if you don't send idProducto. 13-digit CAByS code. */
codigoCabys?: string | null;
/** Hacienda unit of measure. Default "Unid". */
unidadMedida?: string | null;
/** REQUIRED. Quantity > 0. */
cantidad: number;
/** Unit price in the document's currency. If it comes by idProducto and is
omitted, uses the one from the purchase catalog. */
precioUnitario?: number | null;
numeroVin?: string | null;
numeroRegistro?: string | null;
codigoPresentacion?: string | null;
}Rules
- Each line goes by one of two paths:
idProductoordescripcion+codigoCabys. - When sending
descripcion+codigoCabyswithoutidProducto, the line is created inproducto_factura_compra. Before creating it, it’s looked up by exact name, so invoicing the same supply every month doesn’t fill the catalog with duplicates. - The line doesn’t support VAT, discount, or tax exemption: it has no such fields, because the purchase invoice is 0% exempt rate.
Examples
Line from the purchase catalog
{ "idProducto": 8, "cantidad": 100 }Ad-hoc line (gets created)
{
"descripcion": "Café en fruta",
"codigoCabys": "8511200000100",
"unidadMedida": "Kg",
"cantidad": 250,
"precioUnitario": 450.00
}