Bootstrap a tenant (admin/seed flow)
const url = 'https://api.emite.cr/v1/tenants/bootstrap';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"tenant":{"id":"01a00c73-5c09-7bb5-8b9e-d91c43bd61dc","identificationType":"01","identificationNumber":"3101234567","name":"Futurabyte CR S.A.","commercialName":"Futurabyte","economicActivityCode":"6201.0","location":{"provincia":"1","canton":"01","distrito":"01","barrio":"Carmen","otrasSenas":"50 metros norte de la iglesia, edificio azul"},"phoneCountryCode":"506","phoneNumber":"22223333","phone":"50622223333","email":"ventas@emite.cr","notificationEmail":"notificaciones@emite.cr","otrasSenasExtranjero":"1234 Ocean Ave, Miami, FL 33101, USA"},"initialAdmin":{"email":"ventas@emite.cr","password":"café lluvia tortuga","name":"María Solís","role":"admin"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.emite.cr/v1/tenants/bootstrap \ --header 'Content-Type: application/json' \ --data '{ "tenant": { "id": "01a00c73-5c09-7bb5-8b9e-d91c43bd61dc", "identificationType": "01", "identificationNumber": "3101234567", "name": "Futurabyte CR S.A.", "commercialName": "Futurabyte", "economicActivityCode": "6201.0", "location": { "provincia": "1", "canton": "01", "distrito": "01", "barrio": "Carmen", "otrasSenas": "50 metros norte de la iglesia, edificio azul" }, "phoneCountryCode": "506", "phoneNumber": "22223333", "phone": "50622223333", "email": "ventas@emite.cr", "notificationEmail": "notificaciones@emite.cr", "otrasSenasExtranjero": "1234 Ocean Ave, Miami, FL 33101, USA" }, "initialAdmin": { "email": "ventas@emite.cr", "password": "café lluvia tortuga", "name": "María Solís", "role": "admin" } }'Operator / seed flow, protected by the x-bootstrap-secret header (it must equal the server's BOOTSTRAP_SECRET; 401 otherwise). Creates an account from initialAdmin, THEN the company from tenant — with its default branch 001 and terminal 00001, and its default economic activity when economicActivityCode is sent — and makes the account the company's owner (initialAdmin.role is ignored). The two steps are not atomic: if creating the company fails (409 when its identification is already registered, for one), the account stays, and repeating the call with the same email answers 409 — create the company with that account's session through POST /v1/tenants instead. No acceptance of the legal documents is recorded, neither for the account nor for the company (POST /v1/legal/company-acceptances records the latter). Returns the two ids and no session. NOT for end-user signup — use POST /v1/auth/signup + POST /v1/tenants instead.
Request Bodyrequired
Section titled “Request Bodyrequired”object
The company to create: the same fields as the body of POST /v1/tenants, without legal.
object
Not used: ignored when a company is created, and kept as sent in the inline party of a document.
Example
01a00c73-5c09-7bb5-8b9e-d91c43bd61dcHacienda identification type: 01 cédula física, 02 cédula jurídica, 03 DIMEX, 04 NITE, 05 foreign (extranjero no domiciliado), 06 no contribuyente. Only 01–04 with an all-digit number can issue documents, because the clave embeds it.
Example
02Number of that identification, without separators, normalized to uppercase. Its format depends on identificationType: 01 9 digits; 02 10 positions — from 2026-11-01 the last six may be alphanumeric (decree 44648-MJ), e.g. 3101A1B2C3, which can receive documents but not issue them; 03 11–12 digits; 04 10 digits; 05 up to 20 letters, digits or hyphens; 06 9–12 digits.
Example
3101234567Legal name (razón social) — <Nombre> in the XML, cut to 100 characters. A company's name cannot change through PATCH /tenants/:id (400 IMMUTABLE_FIELD): POST /tenants/:id/hacienda-sync takes it from Hacienda's registry.
Example
Futurabyte CR S.A.Trade name — <NombreComercial> in the XML when present, cut to 80 characters.
Example
FuturabyteOnly when creating a company: becomes its default economic activity, in Hacienda's dotted form (e.g. 6201.0). Ignored afterwards — activities are managed in /tenants/:tenantId/economic-activities — and in a document's inline party, whose activity is the document's economicActivityCodeReceptor.
Example
6201.0Address in Costa Rica — <Ubicacion> in the XML. A company cannot issue without it (422 TENANT_LOCATION_MISSING). In a document it is never written for a 05 party; in a purchase invoice (FEC), a supplier of type 01–04 must carry it (400 SUPPLIER_LOCATION_REQUIRED).
object
Provincia code of Hacienda's location codification, one digit: 1 San José, 2 Alajuela, 3 Cartago, 4 Heredia, 5 Guanacaste, 6 Puntarenas, 7 Limón. GET /v1/catalogs/locations lists every code.
Example
1Cantón code within that provincia, two digits (01, 02…).
Example
01Distrito code within that cantón, two digits (01, 02…).
Example
01Neighborhood (barrio), by name — <Barrio>, which Hacienda requires to be 5–50 characters when present.
Example
CarmenThe rest of the address, free text — <OtrasSenas>, 5–250 characters in Hacienda's schema (cut to 250). Without it the XML says «Sin otras señas», since the element is mandatory.
Example
50 metros norte de la iglesia, edificio azulDial code without "+" (1-3 digits).
Example
506National number, digits only (5-20).
Example
22223333Deprecated: a legacy single-string phone (+506 22223333). Send phoneCountryCode + phoneNumber instead; this one is only parsed for the XML when those are absent.
Example
50622223333Email address — <CorreoElectronico> in the XML. For a company, its main address and where its notices go when notificationEmail is empty; for a document's customer, where the accepted document is emailed.
Example
ventas@emite.crCompany only: a separate address for the system's notices to it (rejections, errors, summaries…). Set it with PATCH /tenants/:id; "" or null clears it and the notices go back to email. Ignored on creation and in a document's party.
Example
notificaciones@emite.crAddress abroad, free text — <OtrasSenasExtranjero>, 5–300 characters in Hacienda's schema. Written only for a foreign (05) party, and required when that party is the supplier of a purchase invoice (400 SUPPLIER_FOREIGN_ADDRESS_REQUIRED).
Example
1234 Ocean Ave, Miami, FL 33101, USAThe account to create for the first person of the company, who becomes its owner. The account is created before the company: if creating the company then fails, the account remains, and repeating the call with the same email answers 409.
object
Email of the account to create, which it signs in with. 409 when it already belongs to an EmiteCR account.
Example
ventas@emite.crPassword of the new account. A password the person chooses: 12 to 72 characters, not built on the name or the email of the account, and hard to guess (no common or leaked password, sequence, keyboard pattern or date; the same estimator the app shows under the field). Upper case, digits and symbols are neither required nor refused. Refused with 400 PASSWORD_TOO_WEAK, whose params.reason is too_short, too_long, personal_info or too_guessable. Passwords set before this rule keep working to sign in.
Example
café lluvia tortugaName of the person: 2 characters or more.
Example
María SolísNot used: POST /v1/tenants/bootstrap, the only operation that takes this object, makes the account the owner of the new company whatever this says (admin and member have no effect).
Example
adminResponses
Section titled “Responses”object
Id of the company created.
Id of the account created from initialAdmin, the owner of the company.
Examplegenerated
{ "tenantId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "adminUserId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}Missing or invalid bootstrap secret.
The email already belongs to an account, or the identification to another company (the account is then created anyway).