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

Download purchase invoice XML

GET /api/v1/facturas-compra/{clave}/xml

Returns the original signed XML (XAdES) of the purchase invoice, bit-for-bit identical to what was sent to Hacienda. Same behavior as GET /facturas/{clave}/xml, applied to the 08-type key space.

As of v1.5 the purchase invoice has its own signed XML, which was previously missing — only the PDF was available.

Authentication

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

Response

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

(XAdES XML)

When to use it

  • Tax audits — the signed XML is the official evidence before Hacienda (Costa Rica’s tax authority) of the self-invoice issued to the supplier.
  • Syncing with accounting systems that consume XML.
  • Signature verification by third parties (experts, oversight bodies, etc.).

Notes

  • Right after issuance, this endpoint can return 404 for a few seconds. Signing and uploading the XML happen in the background, same as for sales invoices — see Download XML.
  • If the purchase invoice ended up in error status and was never signed, the 404 is permanent.
  • The acknowledgment signed by Hacienda is a different document, downloaded separately: see Download the Hacienda message for purchase invoices.

Errors

CodeMeaning
404 Not FoundThe key doesn’t exist, exists but isn’t of type 08, or the XML hasn’t been generated yet.