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.
ApiKeyAuth documents:readAuthorizationBearer <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
limit?integerPage size. Defaults to 50 when omitted; must be in [1, 200] (an out-of-range value is a 422).
1 <= value <= 20050cursor?stringOpaque keyset cursor from a previous page's nextCursor. Omit for the first page. A malformed cursor is a 422.
1 <= length <= 512tipo?stringFilter to a single document type.
"FE""TE""NC""ND""FEC""FEE""REP"state?stringFilter to a single engine state-machine state.
"created""signed""submitted""accepted""rejected""error""dead_letter"updatedSince?stringOnly documents whose updatedAt (last state change) is at or after this instant; the boundary is inclusive. An RFC 3339 date-time with an offset (Z or ±hh:mm); a date-only or zone-less value is a 422. The boundary is compared at the stored microsecond precision, so …12:00:00.123456Z includes a document updated at exactly .123456 and excludes one updated at .123000; a value with more than six fractional digits is a 422. Filters on update time, not creation time, so a document created before the boundary and changed after it is included.
date-timeinternalType?stringFilter to one kind of document. invoice is FE, TE, FEC and FEE; credit_note is NC; debit_note is ND; receipt is REP. A document matches when its recorded kind is this value, or when it has no recorded kind (it was issued before Sello recorded one) and its tipo is of this kind. Combines with every other filter. Any other value is a 422.
"invoice""credit_note""debit_note""receipt"issuedFrom?stringOnly documents whose signed issue date (FechaEmision) falls on or after this Costa Rica calendar day (UTC-06:00). Exactly YYYY-MM-DD, a real date in years 0001 to 9999; anything else, or a value after issuedTo, is a 422. Combines with issuedTo and every other filter. A document with no recorded issue date never matches a date bound. Repeating the parameter is a 422.
^[0-9]{4}-[0-9]{2}-[0-9]{2}$issuedTo?stringOnly documents whose signed issue date falls on or before this Costa Rica calendar day (UTC-06:00), the whole day included. Same format and rules as issuedFrom. Repeating the parameter is a 422.
^[0-9]{4}-[0-9]{2}-[0-9]{2}$condicionVenta?stringOnly documents signed with this condición de venta, matched exactly. Any code of v4.4 (01–15, 99) is accepted, even one Sello does not issue today; any other spelling (1, 01, 001) is a 422. A document with no recorded condition never matches. Repeating the parameter is a 422.
"01""02""03""04""05""06""07""08""09""10""11""12""13""14""15""99"q?stringSearch: a document matches when its receptor identification starts with q, its receptor name contains q, or its consecutivo or clave starts with q. Leading and trailing Unicode whitespace is trimmed; an empty value is no search. Case and accents are ignored (pena finds Peña); internal spaces, punctuation and leading zeros count; %, _ and \ are literal. More than 200 characters after trimming, or repeating the parameter, is a 422. Combines with every other filter. Documents issued before Sello recorded the receptor name can still match on the other fields.
emisorId?string#1460 — only documents of this emisor, a UUID (any letter case; no surrounding whitespace). An account-wide key may name any emisor: one outside the account, or one that does not exist, gives an empty page. An emisor-pinned key may omit it or name its own emisor; naming any other emisor is a 403 (policy: key.emisor_pin). An empty or malformed value, or repeating the parameter, is a 422. Send it again with every cursor.
uuidSello-Version?stringDate-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.
^\d{4}-\d{2}-\d{2}$A page of documents plus the cursor to the next page.
application/json- response
A cursor-paginated page of documents. Pass nextCursor back as the cursor query param to fetch the next page; null means this is the last page. Drops straight into the @magiios/sdk paginate() helper.
data*array<>The documents in this page, newest composite-ordered.
nextCursor*|Opaque keyset cursor to the next page, or null on the last page.
curl -X GET 'https://api.sello.cr/v1/documents'{ "data": [ { "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", "issuedAt": "2019-08-24T14:15:22Z", "receptorTipoIdentificacion": "01", "receptorIdentificacion": "string" } ], "nextCursor": "string"}Preview a document's line amounts, taxes and totals without issuing it
Take the exact `createDocument` body and answer what a fresh create would sign: each line's amounts and taxes, the `ResumenFactura` totals, and the advisory warnings, computed by the same engine code that issues. Nothing is issued: no consecutivo or clave is allocated, nothing is signed, stored, queued to Hacienda or counted as a document. The `Idempotency-Key` and `Sello-Replay-Only` headers are ignored. The body is held to every `createDocument` rule, so derived line amounts stay required and a wrong one is the same `422` a create returns. Fiscal refusals (issuer identity and profile, the supported scenario matrix, CABYS, net totals, line and summary divergence) are the create refusals, byte for byte apart from `instance`. Issuance prerequisites are NOT checked: reception credentials, series seeding, the signing certificate and the plan's document allowance. A `200` therefore does not guarantee the document can be issued, and a later create validates again. Authorized by `documents:read` OR `documents:write`. Rate-limited on the account budget like any other request.
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.