FacturaCompraApiRequestDto
Full schema of the request body of POST /api/v1/facturas-compra.
interface FacturaCompraApiRequestDto {
/** REQUIRED. Tenant user the document is attributed to. Same as in sales. */
idUsuario: number;
/** REQUIRED. The supplier. */
emisor: FacturaCompraApiEmisorDto;
/**
* Issuing point of sale. Optional; if omitted, behavior does not change
* relative to v1.2. Determines 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. "CRC" or "USD". Default "CRC". */
moneda: string;
/** Hacienda transaction-type code. Default "01". */
tipoTransaccion: string;
/** Economic-activity code the document is issued under. 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: FacturaCompraApiLineaDto[];
}Field validations
| Field | Rule | Error if it fails |
|---|---|---|
idUsuario | Integer ≥ 1, corresponding to an existing user of the tenant. | 400 |
emisor | With idEmisor or identificacion. | 400 — Debe indicar idEmisor o identificacion del proveedor. |
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 |
medioPago | 2-character string per Hacienda catalog. | 400 or Hacienda validation |
moneda | "CRC" or "USD". | — |
lineas | Array with at least one element. | 400 — Debe incluir al menos una línea. |
Unlike
FacturaApiRequestDto, here there is notipoorreferencias: the type is always08and a purchase invoice does not reference prior documents.