Get the IVA option suggested for a CAByS code
const url = 'https://api.emite.cr/v1/cabys/8399000000000/suggested-iva';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/cabys/8399000000000/suggested-iva \ --header 'Authorization: Bearer <token>'Reads the IVA rate Hacienda publishes for the code (as GET /:codigo does, cached for one hour) and maps it to an option of GET /v1/catalogs/iva-tariffs. Only the rates 13, 4, 2, 1 and 0.5 map to an option: any other rate, 0% included, returns suggested: null, and the client picks the tariff itself.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Example
839900000000013-digit CAByS code
Responses
Section titled “Responses”object
The 13-digit CAByS code looked up.
Description of the code in the CAByS catalog, as Hacienda returns it (Spanish).
IVA rate (%) Hacienda publishes for the code (its impuesto), read live from Hacienda and cached for up to one hour.
The IVA option that matches rate, ready to copy into an item or an invoice line. null when rate is not 13, 4, 2, 1 or 0.5, which includes a 0% rate: the client then picks the tariff itself (for example from GET /v1/catalogs/iva-tariffs).
object
Stable id of the matching option in GET /v1/catalogs/iva-tariffs (its id), for a client that renders that catalog as a picker.
Tax code (CodigoImpuestoType, Hacienda Nota 8). Always 01 (IVA) in a suggestion. It is the value for an item's defaultTaxCode and for taxes[].codigo of an invoice line (<Impuesto><Codigo> in the XML).
IVA rate code (CodigoTarifaIVAType): the value for an item's defaultTaxRateCode and for taxes[].codigoTarifa of an invoice line (<CodigoTarifaIVA> in the XML). This endpoint resolves five rates only: 08 (13%), 04 (4%), 03 (2%), 02 (1%) and 09 (0.5%).
IVA rate as a percentage (13 = 13%): the value for an item's defaultTaxRate and for taxes[].tarifa of an invoice line (<Tarifa> in the XML).
Label of the option, in Spanish, as the EmiteCR app shows it.
Spanish note on when the option applies, suitable as helper text in a form.
Example
{ "cabysCode": "8399000000000", "cabysDescription": "Servicios de consultoría en gestión empresarial", "rate": 13, "suggested": { "optionId": "iva-13", "taxCode": "01", "codigoTarifa": "08", "tarifa": 13, "label": "IVA general 13%", "description": "Tarifa estándar — la mayoría de bienes y servicios." }}Code is not 13 digits.
Code unknown in Hacienda's catalog.
Hacienda's CAByS service answered an error.
Hacienda's CAByS service could not be reached.