Skip to content

Download an invoice XML

GET
/v1/invoices/{id}/xml
curl --request GET \
--url 'https://api.emite.cr/v1/invoices/example/xml?type=unsigned&disposition=attachment' \
--header 'Authorization: Bearer <token>'

Requires invoices:export (reading a document is invoices:read; taking its XML out is an export). Returns one of three XML documents. unsigned is the v4.4 XML before XAdES signing, written when the document is signed; signed is the same XML with the XAdES-EPES signature applied (the fiscal document submitted to Hacienda); hacienda-response is Hacienda's answer (MensajeHacienda) with its verdict, stored when a status check — the background poll or GET /v1/hacienda/status/{clave} — sees the document accepted or rejected. A document imported from XML has no unsigned. Each download is recorded in the audit log as invoice.downloaded.

id
required
string

Invoice UUID

type
string
Allowed values: unsigned signed hacienda-response

Which XML artifact to return. Defaults to signed.

disposition
string
Allowed values: attachment inline

Content-Disposition: attachment (default) downloads, inline previews in-browser.

The XML file, named after the document's consecutivo: <consecutivo>.xml for signed, <consecutivo>-unsigned.xml and <consecutivo>-hacienda-response.xml for the others.

Media typeapplication/xml
string format: binary
Content-Disposition
string

attachment (default) or inline, as disposition asks, with the file name.

Invoice not found, or that XML does not exist: a draft has neither unsigned nor signed (both are written when it is signed), hacienda-response exists once the verdict is in, and an unknown type matches nothing.