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
| Code | Description | Typical use |
|---|---|---|
01 | Anula documento de referencia (cancels reference document) | NC that voids the sale |
02 | Corrige texto del documento de referencia (corrects text of the reference document) | Recipient data, descriptions |
04 | Referencia a otro documento (references another document) | Generic link |
05 | Sustituye comprobante provisional por contingencia (replaces provisional document issued under contingency) | Deferred issuance |
06 | Devolución de mercancía (return of merchandise) | NC for a return |
07 | Sustituye comprobante electrónico (replaces electronic tax document) | Full replacement |
08 | Factura endosada (endorsed invoice) | — |
09 | Nota de crédito financiera (financial credit note) | Subsequent discounts and rebates |
10 | Nota de débito financiera (financial debit note) | Interest, late fees, additional charges |
11 | Proveedor no domiciliado (non-resident supplier) | — |
12 | Crédito por exoneración posterior a la facturación (credit for a tax exemption granted after invoicing) | — |
99 | Otros (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 theCodigoReferenciaTypecatalog (along with adding06–12, which weren’t offered before). It’s disabled in every tenant’s database: sending it returns400, same as any other non-current code. Credit and debit notes issued earlier with03were 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”), use99“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.