List received (supplier) documents — the compras inbox
const url = 'https://api.emite.cr/v1/documents/received?urgency=ok&from=2026-01-01&to=2026-12-31&sort=fechaEmision&order=asc&page=1&pageSize=25&q=ferreteria%20roble';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/documents/received?urgency=ok&from=2026-01-01&to=2026-12-31&sort=fechaEmision&order=asc&page=1&pageSize=25&q=ferreteria%20roble' \ --header 'Authorization: Bearer <token>'Paginated (items, total, page, pageSize, like GET /v1/invoices). Each row carries the derived acceptance deadline (dueAt, MH-DGT-RES-0027-2024, art. 10) and its urgency while pending. Filters are additive: q, acceptanceStatus (repeatable; pendingOnly is an alias of none), urgency (implies pending), docType (repeatable), from/to on fechaEmision (a bare date is a Costa Rica calendar day). Sort by fechaEmision (default), total or supplier; without order, the pending view (pendingOnly, urgency or acceptanceStatus=none alone) lists the nearest deadline first and every other view the newest first.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”Filter by how close the acceptance deadline is (MH-DGT-RES-0027-2024, art. 10: by default the 8th business day of the month after emission): overdue — past it; due_today — today is the last day; due_soon — it ends within the next 3 days; ok — later. Only a pending document has an urgency, so this filter implies acceptanceStatus=none. Resolved in SQL as a range of emission months (the deadline depends only on the month), so it paginates like any other filter.
Send true to list only the documents the company has not answered (acceptanceStatus = none); omit it otherwise. An alias of acceptanceStatus=none, kept for compatibility.
Send true to list only the documents the company can still answer: not answered yet (acceptanceStatus = none) and within their deadline, or without a fechaEmision. Past the deadline a document is presumed fully accepted (MH-DGT-RES-0027-2024, art. 10) and no answer is admitted; those are urgency=overdue. Implies acceptanceStatus=none, and lists the nearest deadline first like the rest of the pending view.
Filter by the company's response: none — not answered yet; accepted; partial — partially accepted; rejected. It is set when the company sends its message (or one is imported) and goes back to none if Hacienda rejects that message. Repeat the parameter for several values (?acceptanceStatus=accepted&acceptanceStatus=partial).
Filter by the Hacienda document type (TipoDocumento) of the received document; repeat the parameter for several: 01 factura electrónica (invoice), 02 nota de débito (debit note), 03 nota de crédito (credit note), 04 tiquete electrónico (ticket), 08 factura electrónica de compra (purchase invoice), 09 factura electrónica de exportación (export invoice), 10 recibo electrónico de pago (payment receipt); 05 to 07 are acceptance messages.
Example
2026-01-01Lower bound of fechaEmision, inclusive. A bare YYYY-MM-DD is a Costa Rica calendar day (from CR midnight); a full ISO 8601 instant is used as given.
Example
2026-12-31Upper bound of fechaEmision. A bare YYYY-MM-DD covers that whole Costa Rica calendar day; a full ISO 8601 instant is an inclusive cut at that instant.
Sort key: fechaEmision (the default; since the deadline depends only on the emission month, it also orders by deadline), total (the document total, compared as a number whatever its currency) or supplier (the supplier's name, case-insensitive).
Sort direction. Without it, the pending view (pendingOnly, urgency, or acceptanceStatus=none alone) is ascending — nearest deadline first — and every other view descending — newest first. Documents without a value go last either way.
Example
11-based page number. Default 1.
Example
25Rows per page. Default 25; a value over 100 is capped to it.
Example
ferreteria robleFree-text search over the supplier name, the clave and the consecutivo. Interpreted by SHAPE, exactly like GET /v1/search: a 50-digit string is an exact clave, other digit runs match a fragment of clave/consecutivo, and text matches the supplier accent-insensitively and per word, in any order. Terms under 3 characters match nothing (below the trigram index floor).
Responses
Section titled “Responses”object
The documents of this page.
object
Id of the received document.
The 50-digit Hacienda clave of the document.
Hacienda document type (TipoDocumento): 01 factura electrónica (invoice), 02 nota de débito (debit note), 03 nota de crédito (credit note), 04 tiquete electrónico (ticket), 08 factura electrónica de compra (purchase invoice), 09 factura electrónica de exportación (export invoice), 10 recibo electrónico de pago (payment receipt).
The supplier's name, as in the XML; null when it has none.
ISO 4217 currency of the document.
The document's FechaEmision; null when the XML has none.
Hacienda's verdict on the supplier's document, read from its MensajeHacienda when that XML was imported too: accepted, partial, rejected, or unknown for an unrecognized code. Null when it was not imported.
The company's response to the document: none — not answered yet; accepted; partial — partially accepted; rejected. It is set when the company sends its message (or one is imported) and goes back to none if Hacienda rejects that message.
Document total (TotalComprobante), in the document currency; null when missing.
End of the window to accept or reject the document (MH-DGT-RES-0027-2024, art. 10: by default the 8th business day of the month after emission), derived from fechaEmision and present whatever the acceptanceStatus; null without a fechaEmision.
How close dueAt is, only while the document is pending (acceptanceStatus: none): overdue — past it; due_today — today is the last day; due_soon — it ends within the next 3 days; ok — later. Null once answered, or without a dueAt.
Documents that match the filters, across all pages.
The page returned, from 1.
Rows per page applied (the request value, capped at 100).
Example
{ "items": [ { "docType": "01", "currency": "CRC", "haciendaStatus": "accepted", "acceptanceStatus": "none", "urgency": "ok" } ]}