Download one block of the XML archive as a ZIP
const url = 'https://api.emite.cr/v1/archive/download?from=2026-09-01&to=2026-09-30&kind=issued&block=1';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://api.emite.cr/v1/archive/download?from=2026-09-01&to=2026-09-30&kind=issued&block=1' \ --header 'Authorization: Bearer <token>'The ZIP of block block of the plan for the same range: for each document its signed XML (<clave>.xml) and Hacienda's response (<clave>-respuesta.xml) when stored — plus, for received documents, our MensajeReceptor and its response — under emitidos/YYYY-MM/ or recibidos/YYYY-MM/, and an indice.csv with one line per document. Built while it downloads and stored nowhere. A file that cannot be read is listed in FALTANTES.txt and marked in the index, never silently dropped. At most two downloads at once per company (429 ARCHIVE_DOWNLOAD_BUSY). Recorded in the audit log as invoice.exported.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”Example
2026-09-01First Costa Rica calendar day of the EMISSION-date range (inclusive).
Example
2026-09-30Last Costa Rica calendar day of the range (inclusive), not before from (400 ARCHIVE_RANGE_INVALID). The range covers at most 366 days, both ends included (400 ARCHIVE_RANGE_TOO_LONG); a longer period takes several plans.
issued (our documents) or received (suppliers').
Example
11-based block number, as the plan lists it.
Responses
Section titled “Responses”The ZIP, named emitidos_<from>_<to>.zip or recibidos_<from>_<to>.zip, with _bloque-<n>-de-<total> before the extension when the period has more than one block. It streams while it is built, so there is no Content-Length; if anything fails once the download has started, the connection is cut and the file arrives incomplete — discard it and download the block again.
Headers
Section titled “Headers”attachment; filename="<emitidos|recibidos>_<from>_<to>[_bloque-<n>-de-<total>].zip".
Documents in this block.
Always no-store.
ARCHIVE_RANGE_INVALID / ARCHIVE_RANGE_TOO_LONG (as in the plan), ARCHIVE_KIND_INVALID, ARCHIVE_BLOCK_INVALID.
INSUFFICIENT_SCOPE: kind=received needs documents:read as well.
ARCHIVE_BLOCK_NOT_FOUND — the period has fewer blocks (a period without documents has none).
ARCHIVE_DOWNLOAD_BUSY.