Skip to Content
v1.5Official documentation for the LX CloudPos API · stable in production

Reference code

Encodes the reason a document references another one (typical in credit notes and debit notes).

Where it goes

The code is accepted in either referencias[].codigo or referencias[].razon: whichever of the two is a valid code from the tenant’s catalog is used. These two references are equivalent:

{ "codigo": "01", "razon": "Anulación total por error en el monto" }
{ "razon": "01" }

What is not accepted is free text alone in both fields. In that case issuance is rejected with 400 and the message lists the available codes:

{ "error": "La razón de la referencia no es un código válido (razon='Cargo por interés moratorio'). Envíe el código de 2 dígitos en 'codigo' o en 'razon', tomado del catálogo: 01 (Anula documento de referencia), 02 (Corrige texto del documento de referencia), …" }

Catalog

CodeDescriptionTypical use
01Anula documento de referencia (cancels reference document)NC that voids the sale
02Corrige texto del documento de referencia (corrects text of the reference document)Recipient data, descriptions
04Referencia a otro documento (references another document)Generic link
05Sustituye comprobante provisional por contingencia (replaces provisional document issued under contingency)Deferred issuance
06Devolución de mercancía (return of merchandise)NC for a return
07Sustituye comprobante electrónico (replaces electronic tax document)Full replacement
08Factura endosada (endorsed invoice)—
09Nota de crédito financiera (financial credit note)Subsequent discounts and rebates
10Nota de débito financiera (financial debit note)Interest, late fees, additional charges
11Proveedor no domiciliado (non-resident supplier)—
12Crédito por exoneración posterior a la facturación (credit for a tax exemption granted after invoicing)—
99Otros (other)Include a clear description (in Spanish)

Each tenant may have a subset of these codes enabled. The 400 error message always returns the ones your tenant accepts.

03 “Corrige monto” no longer exists. Hacienda’s schema v4.4 removed it from the CodigoReferenciaType catalog (along with adding 06–12, which weren’t offered before). It’s disabled in every tenant’s database: sending it returns 400, same as any other non-current code. Credit and debit notes issued earlier with 03 were left untouched — they keep their historical code so the document isn’t left without a reason — but no new document can use it again. For the original use case (“correct an amount”), use 99 “Otros” with a free-text description explaining the adjustment — the same treatment historical notes received when migrated.

Caution with 01 on a debit note

Besides declaring that the note voids the referenced document, 01 is the only code with which a debit note (ND) deducts inventory. For the normal case of an ND — an additional charge that doesn’t move merchandise — 10 or 04 applies.

See also: reference type · FacturaApiReferenciaDto.