Skip to Content
SelloDeveloper docs
API ReferenceDocuments

Get the Hacienda status for a document

Returns the document's current Hacienda acceptance status. The `ind-estado` field carries Hacienda's verbatim hyphenated state (`aceptado` / `rechazado` / `procesando` / `error`); `respuesta-xml` is the Base64 Hacienda response XML once available. `mensajeHacienda` carries Hacienda's own `Mensaje` (`1` aceptado, `3` rechazado) and `DetalleMensaje`, read out of that response so you need not decode the XML to learn why a document was rejected. It is present only when the stored response exists and parses as a MensajeHacienda; when the response is missing or not recognised it is absent, and `ind-estado: rechazado` is then the only signal. It does not depend on the verdict: an accepted document whose response parses carries `mensaje: "1"`. The text is what Sello extracted (trimmed, entities decoded), not a byte-exact copy of the XML.

GET
/v1/documents/{clave}

Authorization

ApiKeyAuth documents:read
headerAuthorizationBearer <token>

Per-consumer API key sent as a bearer token: Authorization: Bearer <key>. Keys are scoped to a single Sello account (tenant). Modeled as HTTP bearer (not apiKey) so every generated SDK emits the Bearer prefix the engine requires; the scheme name stays ApiKeyAuth for contract stability. Every key belongs to one world, and the key says which. A key minted for production reads sello_live_…; one minted for sandbox reads sello_test_…. Each emisor is likewise production or sandbox, fixed when it is provisioned. A write that binds a key to an emisor — creating a document, ingesting a supplier comprobante, filing a Mensaje Receptor — is checked against that pairing, and the check runs ONE WAY (ADR-0040). A sello_test_ key acting on a production emisor is REFUSED with 403 Wrong key environment: it would sign a legally binding comprobante with the real certificate, burn a real consecutivo and file it with Hacienda, none of which can be undone. A sello_live_ key acting on a sandbox emisor is ALLOWED: it produces a sandbox document, which is never metered, since the emisor alone decides whether a document is billable. That pairing is usually a mis-classified emisor rather than a deliberate choice, so Sello logs it for its own operators — nothing about your request changes. The classification is not the destination (ADR-0067). Which Hacienda hears a document is decided by the emisor's Hacienda endpoints, which are a separate fact from its sandbox / production classification. So a sello_test_ key is refused on a sandbox emisor too when that emisor's endpoints are production endpoints — the same 403 Wrong key environment, because the document would be legally binding whatever the classification says. That combination is a misconfiguration on Sello's side of the line, not something you can fix with a different key: ask Sello to correct the emisor. The refusal follows the KEY, not how it was minted: an account-wide sello_test_ key naming that emisor is refused on the same request path, and a sello_live_ key is unaffected. The prefix is not decoration and not a hint you may edit: it is part of the hashed secret, so a key that authenticates at all is byte-identical to the one Sello minted. Read it to tell your own keys apart; you cannot change a key's world by rewriting it. To move between worlds, use the key that belongs to the world you mean. A key also says which operations it may run (#750). Each /v1 operation names one permission in its security requirement, and a key holds a non-empty set of them, fixed when it is created: documents:read (list, status, PDF, XML), documents:write (create, email), received-documents:read (list, get), received-documents:write (ingest, respond) and webhooks:write (register the endpoint). A key created without naming any holds all five, and so does every key created before permissions existed. A key without the permission an operation needs is refused 403 https://sello.cr/problems/insufficient-permission, naming it in requiredPermission, before anything else the operation does — an idempotent replay included. /reference/* needs no permission: any valid key reads it. To change what a key may do, create a new key and revoke the old one.

Scope: documents:read

Path Parameters

clave*string

The field-composed 50-digit Hacienda clave.

Match^\d{50}$
Length50 <= length <= 50

Header Parameters

Sello-Version?string

Date-based API version (e.g. 2026-06-15). The /v1 path segment is the stable major; this header picks the dated contract. Optional: when it is omitted the server uses the account's pinned version, read from the API key's account after the key is verified. An account's pinned version is set to the deployment's global default when the account is created, and a later change of that default never moves it. A pinned version the server does not serve is 400 https://sello.cr/problems/unsupported-version; the server never answers under another date instead. The value must be exactly a YYYY-MM-DD calendar date with a year from 0001 to 9999 (the server also checks the day exists, leap years included), else 400 https://sello.cr/problems/invalid-version. A valid date the server does not serve is 400 https://sello.cr/problems/unsupported-version; today the only supported date is 2026-06-15. A failure to resolve the version is 503 https://sello.cr/problems/version-resolution-unavailable. The response Sello-Version header carries the resolved date. /reference accepts the header and ignores it.

Match^\d{4}-\d{2}-\d{2}$

Response Body

Current status of the document.

application/json
  1. response

Hacienda status for a document: a Document plus the deprecated names the single-document read has always sent. ind-estado carries the same value as indEstado, and respuesta-xml is present exactly when respuestaXml is, with the same string. state is Sello's engine state for the document (the same member DocumentListItem carries), not Hacienda's verdict. Read the two together: dead_letter or error with no ind-estado means the document is stuck, not pending: Hacienda has given no verdict and is not deciding one. dead_letter is terminal and needs an operator; error is retried a bounded number of times, and parks in dead_letter if those run out.

clave*string

Field-composed 50-digit Hacienda clave.

Match^\d{50}$
Length50 <= length <= 50
tipo*DocumentTipo

Document type discriminator.

Value in"FE""TE""NC""ND""FEC""FEE""REP"
numeroConsecutivo*string

20-digit consecutivo (sucursal+caja+docType+sequential).

Length20 <= length <= 20
emisorId*string

The id of the emisor that issued the document.

Formatuuid
state*DocumentState

Engine state-machine state (distinct from Hacienda's ind-estado): created → signed → submitted → accepted | rejected; error is the recoverable bucket; dead_letter is the parked terminal after bounded retries.

Value in"created""signed""submitted""accepted""rejected""error""dead_letter"
indEstado?IndEstadoDeprecated

Deprecated; read indEstado, which carries the same value.

Value in"aceptado""rechazado""procesando""error"
createdAt*string

When Sello created the document, ISO 8601 UTC with milliseconds.

Formatdate-time
updatedAt*string

When the document last changed state, ISO 8601 UTC with milliseconds (the updatedSince filter's axis).

Formatdate-time
fechaEmision*|

The signed issue instant (FechaEmision) in Costa Rica time with the offset -06:00. The fraction of the second keeps the stored microseconds without trailing zeros and is left out when it is zero, so an instant the create echoed as 10:15:00.50-06:00 reads here as 10:15:00.5-06:00; that is the one known difference from the create echo. null when Sello has no recorded issue date for the document.

Formatdate-time
receptor*|

The receptor identification the document was signed with. null when the document has none (a TE without a receptor) or was issued before Sello kept it.

total*|

The document's total (TotalComprobante) as an exact decimal string with five decimals. null when Sello did not record it.

currency*string

The document's ISO 4217 currency code.

exchangeRate?

The exchange rate the document was signed with. Absent for a document issued before Sello kept it.

respuestaXml?string

Base64-encoded Hacienda response XML (once available). Sent only by the single-document read, with the same value as the deprecated respuesta-xml.

mensajeHacienda?

Hacienda's Mensaje and DetalleMensaje, parsed from the response XML. Sent only by the single-document read. Absent when there is no response or it is not a MensajeHacienda.

deferral?

The deferred-IVA balance of a Factura Electrónica issued under condicionVenta 10 (#548). Sent only by the single-document read. Absent for every other document.

warnings?array<>

Advisory, non-blocking findings of a create. Sent only on a create response, and omitted when there are none.

fecha*stringDeprecated

Deprecated; read updatedAt, which carries the same value.

Formatdate-time
ind-estado?IndEstadoDeprecated

Deprecated; read indEstado, which carries the same value.

Value in"aceptado""rechazado""procesando""error"
respuesta-xml?stringDeprecated

Deprecated; read respuestaXml, which carries the same value. Base64-encoded Hacienda response XML (once available).

receptorTipoIdentificacion*|Deprecated

Deprecated; read receptor.identificacion.tipo. The receptor's identification type as the document was signed. null when the document has no receptor identification (a TE without one) or was issued before Sello kept it.

Value in"01""02""03""04""05""06"null
receptorIdentificacion*|Deprecated

Deprecated; read receptor.identificacion.numero. The receptor's identification number exactly as it was signed. null whenever receptorTipoIdentificacion is.

Lengthlength <= 20
Example Request
curl -X GET 'https://api.sello.cr/v1/documents/stringstringstringstringstringstringstringstringst'
Example Response
{  "clave": "stringstringstringstringstringstringstringstringst",  "tipo": "FE",  "numeroConsecutivo": "stringstringstringst",  "emisorId": "ffed7f26-5af9-4c47-8187-286731b1e596",  "state": "created",  "indEstado": "aceptado",  "createdAt": "2019-08-24T14:15:22Z",  "updatedAt": "2019-08-24T14:15:22Z",  "fechaEmision": "2019-08-24T14:15:22Z",  "receptor": {    "identificacion": {      "tipo": "01",      "numero": "string"    }  },  "total": "string",  "currency": "string",  "exchangeRate": {    "tipoCambio": "string",    "source": "caller",    "bccr": {      "valor": "string",      "fecha": "2019-08-24"    }  },  "respuestaXml": "string",  "mensajeHacienda": {    "mensaje": "1",    "detalleMensaje": "string"  },  "deferral": {    "status": "pending",    "collected": "string",    "outstanding": "string",    "lapsesAt": "2019-08-24T14:15:22Z"  },  "warnings": [    {      "code": "cabys_not_in_catalog",      "message": "string",      "line": 0,      "appliedRate": "string",      "catalogRate": "string",      "cabys": "string",      "suppliedRate": "string",      "bccrRate": "string",      "bccrDate": "string",      "tolerance": "string"    }  ],  "fecha": "2019-08-24T14:15:22Z",  "ind-estado": "aceptado",  "respuesta-xml": "string",  "receptorTipoIdentificacion": "01",  "receptorIdentificacion": "string"}

List the account's documents (cursor-paginated)

Return a page of the authenticated account's issued documents, newest composite-ordered by `(created_at, id)` and KEYSET-paginated: pass the previous page's `nextCursor` back as `cursor` to fetch the next page, until `nextCursor` is `null`. The list is scoped to your API key's account (RLS + an explicit account predicate); another account's documents are never visible. An emisor-pinned key sees only its own emisor's documents; an account-wide key sees every emisor in the account. Optionally filter by `tipo`, `state`, `updatedSince`, `internalType`, the signed issue date (`issuedFrom` / `issuedTo`), `condicionVenta` and the search `q`. An account-wide key may narrow the list to one emisor with `emisorId`. Any other query parameter is a `400` (`urn:sello:problem:unknown-query-parameter`), never ignored. To catch up after missed webhooks, note the time before the first page (the first response's `Date` header is Sello's clock), pass `updatedSince` and page with `nextCursor` until it is `null`; every filter is re-applied on every page. The order and the cursor stay `(created_at, id)`, so a document created long ago and accepted since appears at its creation position. Start the next catch-up from the noted time minus a few minutes: a document that changed while you paged, or whose change committed after a later one, falls inside that overlap. The overlap returns some documents twice, so act on each `(clave, state)` once.

Download the representación gráfica (PDF)

Returns the document's representación gráfica as a PDF, rendered from the SIGNED XML (the single source of truth — monetary values appear exactly as signed, all content in Spanish). The per-state legend reflects the document's current lifecycle state. The QR field is implemented but disabled by default while the v4.4 QR obligation remains suspended. Returns 409 while the document has no signed XML yet.