FacturaApiRequestDto
Full schema of the request body of POST /api/v1/facturas.
interface FacturaApiRequestDto {
/** REQUIRED. Type of document to issue. */
tipo: "FacturaElectronica" | "TiqueteElectronico" | "NotaCredito" | "NotaDebito";
/** REQUIRED. Tenant user the document is attributed to. */
idUsuario: number;
/** Recipient. Required for FE/NC/ND. Optional for TE. */
cliente?: FacturaApiClienteDto | null;
/**
* Issuing point of sale. Optional; if omitted, behavior does not change
* relative to v1.2. Determines which stock the sale is deducted from and
* which branch/terminal carries the consecutive number and the Hacienda key.
* The tenant's ids are listed by GET /catalogos/puntos-venta.
*/
idPuntoVenta?: number | null;
/** Sale-condition code. See Hacienda catalog. Default "01" (Cash). */
condicionVenta: string;
/** Term in days if condicionVenta="02". */
plazoCredito?: number;
/** Payment-method code. See Hacienda catalog. Default "01" (Cash). */
medioPago: string;
/** ISO currency code. Default "CRC". */
moneda: string;
/** Exchange rate. If moneda="USD" and it's omitted, it's queried from the BCCR. */
tipoCambio?: number | null;
/** Issuer's economic-activity code. If omitted, uses the tenant's main one. */
codigoActividad?: string | null;
/** Recipient's economic-activity code. */
codigoActividadReceptor?: string | null;
/** Free text with comments visible in the PDF and XML. */
comentario?: string | null;
/** REQUIRED. At least 1 line. */
lineas: FacturaApiLineaDto[];
/** REQUIRED for NC/ND. Optional for FE/TE. */
referencias: FacturaApiReferenciaDto[];
}Field validations
| Field | Rule | Error if it fails |
|---|---|---|
tipo | Must be one of the 4 values of the TipoComprobanteApi enum. | 400 |
idUsuario | Integer ≥ 1, corresponding to a user existing in the tenant. It’s a foreign key: a nonexistent id makes the issuance fail. | 400 |
cliente | Present and with idCliente or identificacion when tipo is FE, NC, or ND. | 400 — Factura electrónica requiere cliente… |
idPuntoVenta | Optional. If present, must be a point of sale of the tenant — listed by GET /catalogos/puntos-venta. | 400 |
condicionVenta | 2-character string per Hacienda catalog. | 400 or Hacienda validation 9015 |
plazoCredito | ≥ 0. Used only if condicionVenta = "02". | — |
medioPago | 2-character string per Hacienda catalog. | 400 or Hacienda validation |
moneda | "CRC", "USD", or internal code ("01" / "02"). | — |
tipoCambio | > 0 if present. | — |
lineas | Array with at least one element. | 400 — Debe incluir al menos una línea. |
referencias | Required (≥ 1) when tipo is NC or ND. | 400 |