Get the current tenant of the authenticated user
const url = 'https://api.emite.cr/v1/tenants/me';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://api.emite.cr/v1/tenants/me \ --header 'Authorization: Bearer <token>'The company of the session: its profile with its branches, terminals and economic activities. If the person has not created or joined a company yet, responds with 404 TENANT_NOT_CONFIGURED so the web can redirect to /setup. A person's session only: an API key gets 401 — it reads its company with GET /tenants/{id}.
Authorizations
Section titled “Authorizations”Responses
Section titled “Responses”object
Id of the company — the {id} / {tenantId} of the tenant routes.
Hacienda identification type of the company: 01 cédula física, 02 cédula jurídica, 03 DIMEX, 04 NITE (05 and 06 are accepted at creation but cannot issue documents). Fixed once created.
Its identification number, without separators — the <Emisor> identification of its documents, embedded in every clave. Fixed once created.
Legal name (razón social), <Nombre> of the <Emisor>. Changes only through POST /tenants/{id}/hacienda-sync, which takes it from Hacienda's registry.
Trade name, <NombreComercial> of its documents; null when it has none.
Deprecated: the same value as defaultEconomicActivityCode, kept for old clients.
Code of its default economic activity — the <CodigoActividadEmisor> a document declares when it names none. null when no activity is the default (a document that names none is then refused with 412 TENANT_NOT_CONFIGURED).
Address of the company, <Ubicacion> of the <Emisor>. provincia, canton and distrito are empty strings until the company sets it, and it cannot issue until then (422 TENANT_LOCATION_MISSING).
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.
Cantón code within that provincia, two digits (01, 02…).
Distrito code within that cantón, two digits (01, 02…).
Neighborhood (barrio), by name — <Barrio>, which Hacienda requires to be 5–50 characters when present.
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.
Dial code of its phone, without + (e.g. 506); null without a phone.
Its phone number, digits only — <Telefono> of its documents; null without one.
Main email address of the company — <CorreoElectronico> of the <Emisor>, and where its notices go when notificationEmail is null. An empty string for a company created without one.
A separate address for the system's notices to the company (rejections, errors, summaries…); null when its notices go to email.
Storage key of the company's logo (a PNG); null without a logo. The image itself is served by GET /tenants/{id}/logo/raw.
Its branches (deleted ones left out). A company starts with branch 001 «Casa Matriz».
object
Id of the branch — the {branchId} of the branch and terminal routes.
Branch number, 3 digits: the first three digits of every consecutivo issued from it, and the branchCode a document names to be issued from it. Fixed once created.
Name of the branch, for the app and the API; documents do not show it.
Whether it is the company's default branch — the one a document uses when it names no branchCode. At most one branch is the default; with none, creating a document that names no branch answers 412 TENANT_NOT_CONFIGURED.
Its terminals, of every branch (branchId says which; deleted ones left out). A company starts with terminal 00001 «Terminal Principal» in branch 001.
object
Id of the terminal — the {terminalId} of the terminal routes.
Id of the branch the terminal belongs to.
Terminal number, 5 digits: the five digits after the branch code in every consecutivo issued from it, and the terminalCode a document names to be issued from it. Unique within its branch; fixed once created.
Name of the terminal, for the app and the API; documents do not show it.
Whether it is its branch's default terminal — the one a document of that branch uses when it names no terminalCode. At most one per branch; with none, creating a document of that branch that names no terminal answers 412 TENANT_NOT_CONFIGURED.
Its economic activities registered with Hacienda; at most one is the default.
object
Id of the activity in the company; PATCH …/{activityId}/default takes it.
Hacienda's economic activity code, in the dotted form its registry returns. The default one is what documents declare as <CodigoActividadEmisor>.
The activity's name, as Hacienda's registry returns it (in Spanish). null for an activity seeded from the company's economicActivityCode at its creation, until the first sync with Hacienda fills it.
Whether documents declare this activity when the request names none. At most one activity of the company is the default; with none, creating a document that names no activity answers 412 TENANT_NOT_CONFIGURED.
Example
{ "identificationType": "01", "identificationNumber": "3101234567", "name": "Futurabyte CR S.A.", "commercialName": "Futurabyte", "economicActivityCode": "6201.0", "defaultEconomicActivityCode": "6201.0", "location": { "provincia": "1", "canton": "01", "distrito": "01", "barrio": "Carmen", "otrasSenas": "50 metros norte de la iglesia, edificio azul" }, "phoneCountryCode": "506", "phoneNumber": "22223333", "email": "ventas@emite.cr", "notificationEmail": "notificaciones@emite.cr", "branches": [ { "code": "001", "name": "Casa Matriz" } ], "terminals": [ { "code": "00001", "name": "Terminal Principal" } ], "economicActivities": [ { "code": "6201.0", "description": "Programación de computadoras" } ]}TENANT_NOT_CONFIGURED — user has no tenant scope.