Skip to content

Bootstrap a tenant (admin/seed flow)

POST
/v1/tenants/bootstrap
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.

Media typeapplication/json
object
tenant
required

The company to create: the same fields as the body of POST /v1/tenants, without legal.

object
id

Not used: ignored when a company is created, and kept as sent in the inline party of a document.

string
Example
01a00c73-5c09-7bb5-8b9e-d91c43bd61dc
identificationType
required

Hacienda 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.

string
Allowed values: 01 02 03 04 05 06
Example
02
identificationNumber
required

Number 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.

string
Example
3101234567
name
required

Legal 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.

string
Example
Futurabyte CR S.A.
commercialName

Trade name — <NombreComercial> in the XML when present, cut to 80 characters.

string
Example
Futurabyte
economicActivityCode

Only 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.

string
Example
6201.0
location

Address 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
required

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.

string
Example
1
canton
required

Cantón code within that provincia, two digits (01, 02…).

string
Example
01
distrito
required

Distrito code within that cantón, two digits (01, 02…).

string
Example
01
barrio

Neighborhood (barrio), by name — <Barrio>, which Hacienda requires to be 5–50 characters when present.

string
Example
Carmen
otrasSenas

The 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.

string
Example
50 metros norte de la iglesia, edificio azul
phoneCountryCode

Dial code without "+" (1-3 digits).

string
nullable
Example
506
phoneNumber

National number, digits only (5-20).

string
nullable
Example
22223333
phone

Deprecated: a legacy single-string phone (+506 22223333). Send phoneCountryCode + phoneNumber instead; this one is only parsed for the XML when those are absent.

string
Example
50622223333
email

Email 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.

string
Example
ventas@emite.cr
notificationEmail

Company 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.

string
nullable
Example
notificaciones@emite.cr
otrasSenasExtranjero

Address 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).

string
Example
1234 Ocean Ave, Miami, FL 33101, USA
initialAdmin
required

The 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
required

Email of the account to create, which it signs in with. 409 when it already belongs to an EmiteCR account.

string
Example
ventas@emite.cr
password
required

Password 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.

string
>= 12 characters <= 72 characters
Example
café lluvia tortuga
name
required

Name of the person: 2 characters or more.

string
Example
María Solís
role

Not 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).

string
Allowed values: admin member
Example
admin
Media typeapplication/json
object
tenantId
required

Id of the company created.

string format: uuid
adminUserId
required

Id of the account created from initialAdmin, the owner of the company.

string format: uuid
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).