Skip to Content
SelloDeveloper docs
API ReferenceConnect

Read an emisor's credential status

Reports whether the emisor has a complete credential set stored (the certificate, its PIN, the Hacienda user and password, the emisor's Hacienda endpoints and client id, and the certificate's expiry) and how close the certificate is to expiring. This reports what is stored, not whether Hacienda accepts the login now: the read decrypts nothing and calls no Hacienda service. `status` is `none` when any of those values is missing; otherwise `expired` when the certificate's expiry is at or before now; otherwise `expiring` when it is within 30 days of now; otherwise `valid`. `certificateExpiresAt` is the stored expiry whenever one is stored, `none` included, and null otherwise. Only a company key (`ApiKeyAuth`) pinned to this emisor and holding `credentials:read` may read. An account-wide key or a key pinned to another emisor answers `403` `https://sello.cr/problems/emisor-out-of-scope`, and a `test` key on a production emisor answers `403` `Wrong key environment`. A suspended or closed account may still read. A platform credential and an upload grant token are refused with `401`.

GET
/connect/emisores/{emisorId}/credential-status

Authorization

ApiKeyAuth credentials: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: credentials:read

Path Parameters

emisorId*string

The emisor whose credential status to read.

Response Body

The emisor's credential status. Nothing secret is returned.

application/json
  1. response

What the emisor has stored, not whether Hacienda accepts the login now. Nothing secret is returned.

emisorId*string
Formatuuid
status*string

none: a value of the credential set is missing. expired: the certificate's expiry is at or before now. expiring: it is within 30 days of now. valid: otherwise.

Value in"none""valid""expired""expiring"
certificateExpiresAt*|

The stored certificate expiry whenever one is stored, none included; null when none is stored.

Formatdate-time
Example Request
curl -X GET 'https://api.sello.cr/connect/emisores/string/credential-status'
Example Response
{  "emisorId": "ffed7f26-5af9-4c47-8187-286731b1e596",  "status": "none",  "certificateExpiresAt": "2019-08-24T14:15:22Z"}

Upload an emisor's credentials with a grant

Sent by the customer's browser to the `uploadUrl` of a grant, with `Authorization: Bearer <grant token>` and an `Origin` header. No API key, cookie or session is needed; cookies are ignored. The body is `multipart/form-data` with exactly four parts: `p12`, `pin`, `haciendaUsername` and `haciendaPassword`. Values are not trimmed. Sello checks, in this order: the token (`401` `https://sello.cr/problems/invalid-grant` for a missing, malformed, unknown or expired token; nothing consumed); then consumes the grant (a grant already used answers `429` `https://sello.cr/problems/grant-already-used` with `Retry-After`; mint a new one); then counts the attempt against the emisor (ten consuming attempts per emisor per fixed ten-minute window, then `429` with `Retry-After`, ahead of the origin and target checks); then the `Origin` (`403` `https://sello.cr/problems/origin-not-allowed`); then the path emisor (`403` `https://sello.cr/problems/grant-emisor-mismatch`); then the form; then the certificate and PIN; then one uncached Hacienda login with the submitted user and password against the emisor's own token endpoint and client id. Only after all of that are the four values stored, together, in one commit. Every refusal after the token check leaves the grant consumed: a grant allows one attempt. A failed upload leaves the previously stored credential set unchanged; a renewal is the same call. The answer shows nothing of the stored set. Preflight: `OPTIONS` on this path from an origin of an active connector answers `204` with `Access-Control-Allow-Origin`, `Access-Control-Allow-Methods: POST`, `Access-Control-Allow-Headers: Authorization, Content-Type` and `Access-Control-Max-Age: 600`, and consumes nothing; any other origin answers `403` with no CORS header. A POST from such an origin carries `Access-Control-Allow-Origin` on success and on refusal.

TypeScript SDK

The primary, hand-owned @magiios/sdk client for Node.