Skip to content

Apply the Hacienda name sync

POST
/v1/tenants/{id}/hacienda-sync
curl --request POST \
--url https://api.emite.cr/v1/tenants/example/hacienda-sync \
--header 'Authorization: Bearer <token>'

Replaces the company's legal name (name) with the one Hacienda's registry has for its identification, and returns the company as GET /tenants/me does. A no-op when the two already match (see GET /:id/hacienda-sync) — the company is returned unchanged, and the answer is 201 either way. Same Hacienda errors as the preview.

id
required
string
Media typeapplication/json
object
id
required

Id of the company — the {id} / {tenantId} of the tenant routes.

string format: uuid
identificationType
required

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.

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

Its identification number, without separators — the <Emisor> identification of its documents, embedded in every clave. Fixed once created.

string
name
required

Legal name (razón social), <Nombre> of the <Emisor>. Changes only through POST /tenants/{id}/hacienda-sync, which takes it from Hacienda's registry.

string
commercialName
required

Trade name, <NombreComercial> of its documents; null when it has none.

string
nullable
economicActivityCode
required

Deprecated: the same value as defaultEconomicActivityCode, kept for old clients.

string
nullable
defaultEconomicActivityCode
required

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

string
nullable
location
required

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

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

string
distrito
required

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

string
barrio

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

string
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
phoneCountryCode
required

Dial code of its phone, without + (e.g. 506); null without a phone.

string
nullable
phoneNumber
required

Its phone number, digits only — <Telefono> of its documents; null without one.

string
nullable
email
required

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.

string
notificationEmail
required

A separate address for the system's notices to the company (rejections, errors, summaries…); null when its notices go to email.

string
nullable
logoStorageKey
required

Storage key of the company's logo (a PNG); null without a logo. The image itself is served by GET /tenants/{id}/logo/raw.

string
nullable
branches
required

Its branches (deleted ones left out). A company starts with branch 001 «Casa Matriz».

Array<object>
object
id
required

Id of the branch — the {branchId} of the branch and terminal routes.

string format: uuid
code
required

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.

string
name
required

Name of the branch, for the app and the API; documents do not show it.

string
isDefault
required

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.

boolean
terminals
required

Its terminals, of every branch (branchId says which; deleted ones left out). A company starts with terminal 00001 «Terminal Principal» in branch 001.

Array<object>
object
id
required

Id of the terminal — the {terminalId} of the terminal routes.

string format: uuid
branchId
required

Id of the branch the terminal belongs to.

string format: uuid
code
required

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.

string
name
required

Name of the terminal, for the app and the API; documents do not show it.

string
isDefault
required

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.

boolean
economicActivities
required

Its economic activities registered with Hacienda; at most one is the default.

Array<object>
object
id
required

Id of the activity in the company; PATCH …/{activityId}/default takes it.

string format: uuid
code
required

Hacienda's economic activity code, in the dotted form its registry returns. The default one is what documents declare as <CodigoActividadEmisor>.

string
description
required

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.

string
nullable
isDefault
required

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.

boolean
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"
}
]
}