Skip to Content
v1.5Official documentation for the LX CloudPos API · stable in production
v1.5 (current)Endpoint referenceDownload the Hacienda message

Download the Hacienda message

GET /api/v1/facturas/{clave}/respuesta

Returns the Hacienda response XML: the acknowledgment signed by the Ministry stating whether the document was accepted or rejected, and for what reason.

It is a different document from the one obtained in Download XML — that one corresponds to the issuer’s own document, signed by the issuer — and this is the one that serves as proof in an audit that Hacienda (Costa Rica’s tax authority) received it and what it resolved.

Authentication and permissions

AttributeValue
SchemeAPI key (X-Api-Key)
Required scopefacturas:read

Works for all four types: FE, TE, NC, and ND.

Responses

200 OK

HTTP/1.1 200 OK Content-Type: application/xml Content-Disposition: attachment; filename="50615012600310112345600100001010000000123456789012_Respuesta.xml"

202 Accepted — no response yet

{ "mensaje": "El comprobante existe pero Hacienda todavía no ha respondido." }

Hacienda’s acknowledgment arrives asynchronously, minutes after issuance. This status means “no response yet; retry later,” not “doesn’t exist” — that’s why it isn’t a 404. If 404 were returned in both cases, there would be no way to distinguish a document that was just issued from a wrong key.

404 Not Found

{ "error": "Comprobante no encontrado." }

The key doesn’t correspond to any document for the tenant.

Operational notes

  • A rechazado (rejected) document does have a response: the XML is exactly where Hacienda explains the reason for the rejection. 202 doesn’t mean rejection, it means Hacienda hasn’t answered yet.
  • The acknowledgment arrives automatically, with no need to request it: if webhooks were configured, the event notifies you when the document was resolved, and that’s the moment to download this XML.

The same download for purchase invoices

See Download the Hacienda message for purchase invoices: same behavior (200 with the XML, 202 while Hacienda hasn’t answered, 404 if the key doesn’t exist), applied to the 08-type key space and with scope facturas-compra:read. As of v1.5 the purchase invoice also has its own signed XML, which was previously missing — only the PDF was available.