Create a party (or reactivate a soft-deleted match)
const url = 'https://api.emite.cr/v1/tenants/example/parties';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"identificationType":"01","identificationNumber":"3101234567","name":"Distribuidora La Nacional S.A.","commercialName":"La Nacional","email":"compras@lanacional.cr","additionalEmails":["contabilidad@lanacional.cr"],"phoneCountryCode":"506","phoneNumber":"22223333","location":{"provincia":"1","canton":"01","distrito":"01","barrio":"Carmen","otrasSenas":"50 metros norte de la iglesia, edificio azul"},"otrasSenasExtranjero":"1234 Ocean Ave, Miami, FL 33101, USA","isCustomer":true,"isSupplier":false,"notes":"Cliente preferencial — descuento 5%"}'};
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/example/parties \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "identificationType": "01", "identificationNumber": "3101234567", "name": "Distribuidora La Nacional S.A.", "commercialName": "La Nacional", "email": "compras@lanacional.cr", "additionalEmails": [ "contabilidad@lanacional.cr" ], "phoneCountryCode": "506", "phoneNumber": "22223333", "location": { "provincia": "1", "canton": "01", "distrito": "01", "barrio": "Carmen", "otrasSenas": "50 metros norte de la iglesia, edificio azul" }, "otrasSenasExtranjero": "1234 Ocean Ave, Miami, FL 33101, USA", "isCustomer": true, "isSupplier": false, "notes": "Cliente preferencial — descuento 5%" }'If a soft-deleted party exists for the same identificationNumber + identificationType, this endpoint reactivates it atomically (FOR UPDATE serializes concurrent SELECT/INSERT): it keeps its id and creation date, the fields sent replace the stored ones, the fields left out are kept, and the capability flags (isCustomer/isSupplier) are OR-merged. Both cases answer 201 with the contact. Identification is immutable post-creation — PATCH cannot change it.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Tenant UUID.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Hacienda identification type (<Identificacion><Tipo>):
01: cédula física (an individual).02: cédula jurídica (a company or other legal entity).03: DIMEX (migration identity document for foreigners).04: NITE (identification number assigned by the tax administration, DGT).05: foreigner not domiciled in Costa Rica.06: non-contributor (not registered as a taxpayer).
Immutable after creation. Whether a document accepts the type is checked when the document is created: a 06, for example, can only be the supplier of a purchase invoice (FEC).
Example
02Identification number (<Identificacion><Numero>), with no spaces, normalized to upper case. Its format depends on identificationType: 01 9 digits; 02 10 positions, 4 digits and 6 that may include letters (cédulas jurídicas issued from 2026-11-01 under decree 44648-MJ are alphanumeric, e.g. 3101A1B2C3); 03 11–12 digits; 04 10 digits; 05 up to 20 letters, digits or dashes; 06 9–12 digits. Unique per type within the company, and immutable after creation.
Example
3101234567Legal name of the person or company: <Nombre> of the <Receptor>, or of the <Emisor> when the contact is the supplier of a purchase invoice (FEC). Hacienda's schema asks for at least 3 characters (5 as an <Emisor>).
Example
Distribuidora La Nacional S.A.Trade name, when it differs from name (<NombreComercial>). Hacienda's schema asks for at least 3 characters.
Example
La NacionalThe contact's email address: <CorreoElectronico> of the documents that name them, and where EmiteCR emails each of those documents once Hacienda accepts it (unless the company turned that off).
Example
compras@lanacional.crUp to 3 more email addresses, kept with the contact for reference. Documents carry email only, and EmiteCR sends nothing to these addresses.
Example
[ "contabilidad@lanacional.cr"]Country calling code, 1–3 digits with no + (<Telefono><CodigoPais>). 506 (Costa Rica) is assumed when a phoneNumber comes without it.
Example
506Phone number, 5–20 digits with no spaces or symbols (<Telefono><NumTelefono>). Without it, documents carry no <Telefono>.
Example
22223333Address in Costa Rica (<Ubicacion>): the provincia, cantón and distrito codes of GET /v1/catalogs/locations, all three or no location (400 otherwise, also for codes that do not exist), plus optional barrio and otrasSenas. Not written for a foreign (05) contact, nor on an export invoice (FEE) or a payment receipt (REP). Required when an inscribed (01–04) contact is the supplier of a purchase invoice (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 azulAddress abroad, free text (<OtrasSenasExtranjero>; the schema asks for 5–300 characters). Written only for a foreign (05) contact, and required when that contact is the supplier of a purchase invoice (400 SUPPLIER_FOREIGN_ADDRESS_REQUIRED).
Example
1234 Ocean Ave, Miami, FL 33101, USAThe contact can be the customer of the documents the company issues: a document whose receiverId names a contact that is not a customer is rejected (400 PARTY_NOT_CUSTOMER), except a purchase invoice (FEC) and its notes, which need a supplier. Defaults to true. A contact is a customer, a supplier or both (422 when neither).
Example
trueThe contact is a supplier: the counterpart of a purchase invoice (FEC, docType 08) and of the notes on it, whose receiverId must name a supplier (400 PARTY_NOT_SUPPLIER). Defaults to false.
Example
falseInternal notes about the contact. Never sent to Hacienda nor printed.
Example
Cliente preferencial — descuento 5%Responses
Section titled “Responses”The contact, created or reactivated.
object
Id of the contact — the receiverId a document names it by.
Hacienda identification type: 01 cédula física, 02 cédula jurídica, 03 DIMEX, 04 NITE, 05 foreigner not domiciled, 06 non-contributor. Fixed once created.
Identification number, upper case and without spaces. Unique per type within the company, and fixed once created.
Legal name of the person or company (<Nombre>).
Trade name (<NombreComercial>); null when it has none.
Email address documents carry (<CorreoElectronico>) and accepted documents are emailed to; null when it has none.
More email addresses, kept for reference only; null when there are none.
Country calling code, digits only; null when not set.
Phone number, digits only; null when not set.
Address in Costa Rica (<Ubicacion>); null when the contact has none.
object
Provincia code, one digit (GET /v1/catalogs/locations).
Cantón code, two digits.
Distrito code, two digits.
Neighborhood (barrio), by name; null when not set.
The rest of the address, free text; null when not set.
Address abroad of a foreign (05) contact; null when not set.
Whether the contact can be the customer of the documents the company issues.
Whether the contact is a supplier (the counterpart of a purchase invoice, FEC).
Internal notes; null when there are none.
When the contact was created (a reactivation keeps the original date).
When the contact last changed.
Example
{ "identificationType": "01", "identificationNumber": "3101234567", "name": "Distribuidora La Nacional S.A.", "commercialName": "La Nacional", "email": "compras@lanacional.cr", "additionalEmails": [ "contabilidad@lanacional.cr" ], "phoneCountryCode": "506", "phoneNumber": "22223333", "location": { "provincia": "1", "canton": "01", "distrito": "01", "barrio": "Carmen", "otrasSenas": "50 metros norte de la iglesia, edificio azul" }, "otrasSenasExtranjero": "1234 Ocean Ave, Miami, FL 33101, USA", "notes": "Cliente preferencial — descuento 5%"}Invalid fields — including an identificationNumber whose format does not match identificationType (e.g. letters in a 01 cédula) — or location codes that are incomplete or do not exist.
Missing or invalid JWT / API key
Tenant boundary violation or insufficient scope.
An active contact of the company already has this identificationType + identificationNumber.
The contact would be neither a customer nor a supplier.