Provision a headless managed tenant (idempotent per cédula)
const url = 'https://api.emite.cr/v1/partner/tenants';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"identificationType":"01","identificationNumber":"3101234567","name":"Restaurante El Fogón S.A.","commercialName":"El Fogón","email":"admin@elfogon.cr","location":{"provincia":"1","canton":"01","distrito":"01","barrio":"Carmen","otrasSenas":"50 metros norte de la iglesia, edificio azul"},"phoneCountryCode":"506","phoneNumber":"22223333","defaultLocale":"es","economicActivityCode":"5610.0"}'};
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/partner/tenants \ --header 'Content-Type: application/json' \ --data '{ "identificationType": "01", "identificationNumber": "3101234567", "name": "Restaurante El Fogón S.A.", "commercialName": "El Fogón", "email": "admin@elfogon.cr", "location": { "provincia": "1", "canton": "01", "distrito": "01", "barrio": "Carmen", "otrasSenas": "50 metros norte de la iglesia, edificio azul" }, "phoneCountryCode": "506", "phoneNumber": "22223333", "defaultLocale": "es", "economicActivityCode": "5610.0" }'Creates a company with no users or memberships, production as its active environment and every notification email off. It starts with branch 001 (Casa Matriz) and terminal 00001 (Terminal Principal) as its defaults and, when economicActivityCode is sent, that activity as its default. Always answers 200 — created tells a new company apart. When this partner already manages the identification, the existing company is returned unchanged (created: false; the payload is not applied — use the config endpoint); when it belongs to a company this partner released, that company comes back with its numbering intact (created: false, revived: true). 409 PARTNER_TENANT_CEDULA_CONFLICT when the identification belongs to any other company; 403 PARTNER_MAX_TENANTS_REACHED when the partner already manages its maximum number of companies (a revival needs room too).
Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Partner app credential (ecp_*)
Request Bodyrequired
Section titled “Request Bodyrequired”object
Hacienda identification type of the company: 01 cédula física, 02 cédula jurídica, 03 DIMEX, 04 NITE, 05 foreign, 06 no contribuyente. With identificationNumber it is what provisioning is idempotent on: the same pair again returns the same company (created: false), and one held by anybody else answers 409 PARTNER_TENANT_CEDULA_CONFLICT.
Example
02Normalized to uppercase; its format depends on identificationType. From 2026-11-01 a cédula jurídica (type 02) may carry an alphanumeric consecutive (decree 44648-MJ), e.g. 3101A1B2C3: such a company can be provisioned and configured but cannot issue documents — readiness.issuerIdSupported says so before the first attempt.
Example
3101234567Legal name (razón social) — <Nombre> on its documents. The config endpoint cannot change it later.
Example
Restaurante El Fogón S.A.Trade name shown on its documents (<NombreComercial>).
Example
El FogónThe company's main email address — <CorreoElectronico> of its documents. Nothing is mailed to it: a provisioned company starts with every notification off.
Example
admin@elfogon.crFiscal address. Optional here, but the company cannot issue without it (readiness.location; emission answers 422 TENANT_LOCATION_MISSING) — it can also be set later through profile.location of the config endpoint.
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; 506 is assumed when absent.
Example
506Phone number, digits only — <Telefono> on its documents.
Example
22223333Language of what is sent on the company's behalf without a person choosing one — emails such as the grant-access invitation, and the PDFs they attach. A PDF downloaded through the API follows its own ?locale= instead.
Becomes the company's default economic activity, in Hacienda's dotted form: four digits, a dot and one digit (5610.0), the six characters the XSD admits.
Example
5610.0Responses
Section titled “Responses”object
Identifier of the company — the :id of every /partner/tenants/:id/* route. Every repeat of the call for the same identification returns the same one.
true when this call created the company. false when this partner already managed that identification — the existing company is returned as it is, without applying this payload to it (change it through PUT /partner/tenants/:id/config) — or when a company this partner had released came back (revived).
Present, and true, only when the identification belonged to a company this partner had released (DELETE /partner/tenants/:id): that same company comes back with its numbering intact, taking the legal name, trade name (cleared when not sent) and email of this payload and, when sent, its address, phone and economic activity. Its API keys and credentials went with the release and have to be set up again.
Examplegenerated
{ "tenantId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "created": true, "revived": true}