Autenticación
Authenticate every /v1 request with a bearer API key.
The Issuance API authenticates every request with an API key sent as an HTTP bearer token:
Authorization: Bearer sello_live_ab12cd34_<secret>A request without a valid, non-revoked key is rejected with 401.
The key format
A Sello key is a single opaque string with a fixed, recognizable shape:
sello_<env>_<prefix>_<secret>
│ │ │ └─ 32 bytes of CSPRNG entropy (base64url) — the secret
│ │ └────────── 8 hex chars — a public, non-secret identifier
│ └────────────────── environment: live | test
└───────────────────────── fixed scheme label ("sello_")- The
sello_scheme label makes keys easy to spot in logs and lets secret scanners flag a leak. - The
envsegment (live/test) tells you (and Sello) which environment the key belongs to. - The prefix is non-secret and is what the dashboard shows to identify a key
(e.g.
sello_live_ab12cd34…). - The secret is the high-entropy tail. Sello stores only its SHA-256 hash and verifies presented keys with a constant-time compare.
Sending the key
Set the Authorization header on every /v1 request:
curl https://api.sello.cr/v1/documents/<clave> \
-H "Authorization: Bearer $SELLO_API_KEY"With the SDK, pass the key once when you construct the client and it is attached to every request for you:
import { SelloClient } from '@magiios/sdk';
const sello = new SelloClient({
apiKey: process.env.SELLO_API_KEY, // sent as Authorization: Bearer <key>
baseUrl: 'https://api.sello.cr',
});The security scheme is modeled as HTTP bearer (not an apiKey header) so every
generated SDK emits the Bearer prefix the engine requires. The token
option on SelloClient is an accepted alias for apiKey.
Scope is derived from the key
The account (and optional emisor) a request acts on is resolved from the verified
key — never from a request body or header. An account-wide key can select an
emisor within its account with the Sello-Emisor-Id header, but no header can
ever widen a key beyond its own account.
Permissions: what a key may do
A key also holds a list of the operations it may run. There are five
permissions, and each /v1 operation needs exactly one of them:
| Permission | Operations |
|---|---|
documents:read | List documents, get a document's status, download its PDF and XML |
documents:write | Create a document, send it by email |
received-documents:read | List received documents, get one |
received-documents:write | Ingest a supplier's document, respond to it (Mensaje Receptor) |
webhooks:write | Read, register, replace or remove your webhook endpoint |
/reference/* needs no permission: any valid key reads it.
A key created without naming permissions holds all five, and so does every key
created before permissions existed. The dashboard offers two choices: Full
access (all five) and Read-only (documents:read and
received-documents:read). Give a reporting tool a read-only key: it can read
your documents and cannot issue, respond, or see or move your webhook.
Reading the webhook endpoint needs webhooks:write, not a read permission. The
URL it returns is where every signed event goes, and while Odoo is connected it
carries the connection's own token, so only a key that may change the endpoint
may see it.
A key that lacks the permission an operation needs gets 403 with
type: https://sello.cr/problems/insufficient-permission, and the body names
the permission in requiredPermission:
{
"type": "https://sello.cr/problems/insufficient-permission",
"title": "Insufficient permission",
"status": 403,
"detail": "This API key does not hold the `documents:write` permission this operation requires. …",
"requiredPermission": "documents:write"
}Sello checks this before anything else the operation does, so a refused
request spends no consecutivo, no usage and no idempotency record. A retry under
an Idempotency-Key that another key already used is refused too; it does not
return the stored result. You cannot change a key's permissions: create a new
key with the ones you need and revoke the old one.