Skip to content

Download one block of the XML archive as a ZIP

GET
/v1/archive/download
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.

from
required
string
Example
2026-09-01

First Costa Rica calendar day of the EMISSION-date range (inclusive).

to
required
string
Example
2026-09-30

Last 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.

kind
required
string
Allowed values: issued received

issued (our documents) or received (suppliers').

block
required
number
>= 1
Example
1

1-based block number, as the plan lists it.

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.

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

attachment; filename="<emitidos|recibidos>_<from>_<to>[_bloque-<n>-de-<total>].zip".

X-Archive-Documents
integer

Documents in this block.

Cache-Control
string

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.