FacturaApiLineaDto
Represents a detail line of the document. Each request must include at least one line.
Fields
| Field | Type | Required | Description |
|---|---|---|---|
idProducto | number | One of the two | ID of the product or service in the tenant’s catalog. |
codigoProducto | string | One of the two | Product code (SKU) in the tenant’s catalog. Used when the integrator’s system knows its own code and not LX CloudPos’s internal identifiers. |
cantidad | number | Yes | Quantity greater than 0. Supports up to 3 decimals. |
precioUnitario | number | Optional | Unit price in the document’s currency. If omitted, the product’s price is used. |
montoDescuento | number | Optional | Discount amount in the document’s currency. Default 0. |
naturalezaDescuento | string | Optional | Descriptive text for the discount (appears on the PDF). |
montoExoneracion | number | IGNORED | Accepted for backward compatibility but never used by the server. See Rules below. |
idExoneracion | number | Optional | Id of an exemption registered for the document’s customer. It’s the only real mechanism to exempt a line — see Tax exemptions. |
interface FacturaApiLineaDto {
/** ID of the product/service in the tenant's catalog. Alternative: codigoProducto.
One of the two must be provided. */
idProducto?: number;
/** Product code (SKU) in the tenant's catalog. Used when you don't send
idProducto: your system knows its own code, not our ids. */
codigoProducto?: string | null;
/** REQUIRED. Quantity > 0. Supports up to 3 decimals. */
cantidad: number;
/** Optional. Unit price in the document's currency. If omitted, uses the product's. */
precioUnitario?: number | null;
/** Discount amount in the document's currency. Default 0. */
montoDescuento: number;
/** Descriptive text for the discount (visible on the PDF). */
naturalezaDescuento?: string | null;
/**
* IGNORED. The exempted amount isn't a value that's captured: the server calculates it
* from idExoneracion and the product's real VAT rate (capping included). It stays in
* the contract so integrators who already send it don't get a validation error, but
* its value is never used — before idExoneracion existed, this field was the only way
* to "exempt" a line and it was purely decorative: the document came out fully taxed,
* with no error and no warning.
*/
montoExoneracion?: number | null;
/**
* Id of an exemption registered for the document's customer (created from the POS;
* queried via GET /clientes/{identificacion}, field `exoneraciones`). Declarative: you
* send ONLY the id, never an amount — the server looks it up among the customer's
* exemptions, validates that it's currently valid (active and not expired), and
* calculates the real amount by capping it at the product's VAT rate. If the id
* doesn't belong to the document's customer, or is expired/inactive, issuance fails
* with 400 instead of silently issuing with full VAT.
*/
idExoneracion?: number | null;
}Rules
- Each line must carry either
idProductoorcodigoProducto. If neither is provided,400. - The product must exist in the tenant’s catalog. Otherwise a
400 Producto X no encontrado(or400 Producto con código 'X' no encontrado) is returned. It’s not yet possible to invoice a free-form line that isn’t in the catalog — that functionality is on the roadmap. - VAT is applied automatically according to the product’s configuration.
montoDescuentois subtracted from the line’s subtotal (cantidad × precioUnitario).montoExoneraciondoes nothing. It’s a legacy field the server accepts but never reads. Sending it withoutidExoneraciondoes not exempt the line — it comes out fully taxed, with no error and no warning. See Tax exemptions.idExoneracionis the real exemption mechanism: it only applies if it belongs to a currently valid exemption of the document’s customer. See Tax exemptions for the400errors it can return (id belonging to someone else, expired, inactive, or no customer on the document).
Examples
Simple line
{ "idProducto": 100, "cantidad": 2 }Uses the product’s registered price in the catalog, with no discount and no exemption.
Line by catalog code
{ "codigoProducto": "WM-0001", "cantidad": 2 }Equivalent to the previous one, resolving the product by its SKU instead of its internal id.
Line with a price override
{ "idProducto": 100, "cantidad": 2, "precioUnitario": 1500.00 }Forces a unit price of 1500 (useful when the product has a variable price, like professional services).
Line with a discount
{
"idProducto": 100,
"cantidad": 5,
"montoDescuento": 1000.00,
"naturalezaDescuento": "Descuento por volumen >= 5 unidades"
}Line with an exemption
{ "idProducto": 101, "cantidad": 1, "idExoneracion": 7 }The 7 comes from the exoneraciones array returned by GET /clientes/{identificacion} for the document’s customer. The server calculates the exempted amount — no amount is sent on the line.