Skip to Content
SelloDeveloper docs
API ReferenceConnect

Provision a company for a connector

Creates, in one transaction, an account (with its organization and no member), one emisor in the requested `environment`, and one company key pinned to that emisor. The key holds the five default permissions plus `credentials:read` and `credentials:write`; it is a `sello_live_` key for a production emisor and a `sello_test_` key for a sandbox one. The response is the only place its plaintext appears. The connector comes from the platform credential, never from the body. The provisioning identity is (connector, `companyId`, `environment`): sandbox and production are separate accounts, and `companyId` is compared exactly as sent (no trim, no case folding). The emisor's Hacienda endpoints and client id come from the deployment. A REPLAY (same identity, same details) answers `200` with the same `accountId` and `emisorId` and a NEW key, and revokes the key the previous answer returned: save the newest key. The same identity with different details answers `409` `https://sello.cr/problems/provisioning-conflict` and changes nothing. Requests for one identity run one at a time. `production` needs a production plan on the connector (otherwise `409` `https://sello.cr/problems/production-not-enabled`), an explicit `emisor.numberingMigrating`, and the deployment's published production endpoints (otherwise `503` `https://sello.cr/problems/production-endpoints-not-published`). Nothing is written on any refusal.

POST
/connect/companies

Authorization

ConnectorAuth
headerAuthorizationBearer <token>

A connector's platform credential, sent as a bearer token: Authorization: Bearer sello_platform_<8 hex>_<secret>. An operator registers the connector and issues its credentials; Sello stores only their hash and shows the plaintext once. It authenticates the /connect operations that name this scheme and nothing else: /v1 and /reference refuse it with 401. A revoked credential, or one whose connector is disabled, is refused with 401.

Request Body

application/json
  1. body

The company to provision. Closed: an unknown field answers 422. The body carries no connector id, plan, origin, endpoint URL, client id or Hacienda credential; each of those is an unknown field.

companyId*string

The connector's own id for the company. Opaque: Sello never trims it, folds its case or normalizes it, so Acme and acme are two companies.

Length1 <= length <= 200
environment*string

The Hacienda world of the emisor and its key.

Value in"sandbox""production"
name*string

The account name, 1 to 200 characters after trimming.

Length1 <= length <= 200
emisor*

The emisor to create. Closed. The Hacienda endpoints and client id come from the deployment, never from this object.

Response Body

A replay: the same account and emisor, a new key, and the key the previous answer returned is revoked.

application/json
  1. response

The provisioned company. apiKey is the only copy of the key's plaintext; Sello stores its hash. A later replay revokes it.

accountId*string
Formatuuid
emisorId*string
Formatuuid
environment*string
Value in"sandbox""production"
apiKey*string

The company key, sello_test_… for sandbox and sello_live_… for production.

apiKeyId*string
Formatuuid
replayed*boolean

true on a 200 replay, false on the 201.

Example Request
curl -X POST 'https://api.sello.cr/connect/companies' \  -H 'Content-Type: application/json' \  -d '{  "companyId": "string",  "environment": "sandbox",  "name": "string",  "emisor": {    "name": "string",    "tipoIdentificacion": "01",    "identificacion": "string"  }}'
Example Response
{  "accountId": "3d07c219-0a88-45be-9cfc-91e9d095a1e9",  "emisorId": "ffed7f26-5af9-4c47-8187-286731b1e596",  "environment": "sandbox",  "apiKey": "string",  "apiKeyId": "37ba0474-c0bb-4910-bfb5-d6cebb614366",  "replayed": true}

Look up a tax-exemption authorization by its number

Broker Hacienda's intended-public exoneración lookup (`/fe/ex?autorizacion=<n>`) server-side: the terms of a tax-exemption authorization — the exonerated party, the authorized rate in tarifa points, the covered CABYS codes, and the emission/expiry dates. Like `/tax-status` this is a LIVE passthrough with a short server-side cache. Consumers MUST honour `fechaVencimiento` — an authorization can lapse. A well-formed but unknown authorization is a clean `404`.

Mint a single-use credential upload grant

Mints a grant that lets a browser upload one emisor's credential set (the .p12 certificate, its PIN and the Hacienda user and password) straight to Sello, once. The request has no body; the emisor is the path parameter. Two credentials may mint. A connector's platform credential (`ConnectorAuth`) mints only for an emisor its connector provisioned; any other emisor answers `404`. A company key (`ApiKeyAuth`) must be pinned to this emisor and hold `credentials:write`; 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`. The answer is the only place the grant token appears; Sello stores its SHA-256 hash. The grant lives exactly 600 seconds, writes the credentials of this one emisor only and reads nothing. `uploadUrl` is the deployment's public API base (`SELLO_PUBLIC_API_URL`) with `/connect/emisores/{emisorId}/credentials` appended; it never contains the token. Minting changes no other grant: several unused grants of one emisor stay usable until each expires or is consumed. Ten mints per emisor per fixed ten-minute window; the eleventh answers `429` and creates no grant.