Received documents
Ingest a supplier's comprobante and file a Mensaje Receptor.
The reception side of e-invoicing: when a supplier issues a comprobante to
you, you must acknowledge it with a Mensaje Receptor (MR) to back the IVA
credit or deductible expense. Sello models this as received-documents.
The XML's recipient identification type and number must match the selected emisor. A missing or different recipient returns 422 before an inbox record or notification is created. In accounts with several emisores, select the taxpayer named by the supplier.
There is no inbox to poll
An important mental-model correction: Sello does not fetch inbound documents from Hacienda — there is no Hacienda "documents issued to me" pull API. The legal delivery channel is supplier→receptor email. So your "inbox" is exactly the set of supplier XMLs you ingest. You feed Sello the supplier's signed XML (from an email attachment or an upload); Sello stores it so you can respond.
Two doors lead to the same inbox: the /v1 call below, and Upload supplier
XML in the dashboard's Inbox (paste or attach the .xml a supplier emailed
you). Both run the same parser and signature checks and land the same row.
1. Ingest a supplier document
POST /v1/received-documents with the supplier's raw signed XML (as text/xml /
application/xml, or wrapped in a JSON envelope { "xml": "…" }).
curl -X POST https://api.sello.cr/v1/received-documents \
-H "Authorization: Bearer $SELLO_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/xml" \
--data-binary @supplier-invoice.xml- The receiving emisor is resolved from your API key's scope (and the
optional
Sello-Emisor-Idheader for an account-wide key) — never from the XML. A key for account A can never file a reception under account B. - The response carries the
deadlineAtto respond — the 8th business day of the month following the document's emission (Hacienda Art. 10), not a flat 8-day countdown from ingest. - Idempotent per
(account, clave): redelivering the same XML returns the existing row (200) and never double-inserts. A first ingest is201.
2. List your inbox
GET /v1/received-documents returns your ingested documents, keyset-paginated
and key-scoped (no cédula parameter — the inbox is scoped by your key, never
by an identity you assert). Filter by reception status
(received, pending_response, responded_accepted, responded_partial,
responded_rejected, quarantined), supplier tipo, the issue date
(issuedFrom / issuedTo) and/or one emisor (emisorId, a UUID). An
account-wide key may name any emisor; one outside your account, or one that does
not exist, is an empty page. An emisor-pinned key may only name its own emisor:
any other is a 403 with policy: key.emisor_pin. An empty, malformed or
repeated emisorId is a 422. Any other query parameter (q,
condicionVenta and state included) is a 400
(urn:sello:problem:unknown-query-parameter), never ignored.
curl "https://api.sello.cr/v1/received-documents?status=pending_response&limit=50" \
-H "Authorization: Bearer $SELLO_API_KEY"Read one by clave with GET /v1/received-documents/{clave} (a cross-tenant clave
is a 404). The list rows and the single read return the same projection —
the fields the engine already stored, not a re-parse: clave, supplier identity
(supplierName, supplierCedula), the invoice's own issuedAt, the exact-decimal
money it carries (subtotal, taxTotal — the IVA — and total, all JSON strings,
never floats), currency, status, deadlineAt, and our Mensaje-Receptor verdict
(mrStatus).
3. Respond with a Mensaje Receptor
POST /v1/received-documents/{clave}/respond files your signed MR. Sello
allocates the MR consecutivo, signs it, and enqueues its Hacienda submission on
the outbox; the response returns immediately with the generated mrClave.
Every MR is numbered on caja 001-00001, whatever cajas you issue from. If your
business filed Mensajes Receptor through another provider, record the last MR
number Hacienda accepted for that caja in onboarding step 3 (0 if none) — even
when Sello has already filed MRs for you, since the counter never goes below a
number Sello filed. A production MR on an unseeded series is refused with
unseeded-series and spends no number.
The kind selects the MR type:
kind | MR | Meaning | IVA-credit effect |
|---|---|---|---|
accepted | MR01 | Aceptado | Backs full crédito fiscal / deduction. |
partial | MR02 | Aceptado parcialmente | Proportionally limited creditable IVA. |
rejected | MR03 | Rechazado | Backs nothing; IVA not creditable. |
{
"kind": "accepted",
"condicionImpuesto": "01",
"montoTotalImpuestoAcreditar": "130.00"
}Rules:
- A rejection (
kind: rejected) requires adetalleMensaje. - Acceptances may carry the credit hints (
condicionImpuesto01–05,montoTotalImpuestoAcreditar,montoTotalDeGastoAplicable) — all exact-decimal strings. - Idempotent: replaying the same
kindreturns the samemrClave(200); responding with a differentkindafter a response is a409.
The deadlineAt is effectively mandatory for any purchase that will back a
cost/expense or IVA credit — file the MR before it lapses. Only an accepted MR
makes the purchase IVA acreditable.
If the deadline passes and you have filed no Mensaje Receptor, Hacienda presumes you accepted the document in full (Res. MH-DGT-RES-0027-2024, art. 10). If you disagree with this document, talk to the supplier: they must issue a nota de crédito.