Create a recurring invoice schedule
const url = 'https://api.emite.cr/v1/recurring-invoices';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"Renta oficina — mensual","schedule":{"frequency":"daily","interval":1,"startDate":"2026-06-01","endDate":"2027-06-01","dayOfMonth":15,"endOfMonthRule":"last_day_when_missing","weekday":1,"maxOccurrences":12,"autoSubmit":true},"template":{"docType":"01","receiver":{"id":"01a00c73-5c09-7bb5-8b9e-d91c43bd61dc","identificationType":"01","identificationNumber":"3101234567","name":"Futurabyte CR S.A.","commercialName":"Futurabyte","economicActivityCode":"6201.0","location":{"provincia":"1","canton":"01","distrito":"01","barrio":"Carmen","otrasSenas":"50 metros norte de la iglesia, edificio azul"},"phoneCountryCode":"506","phoneNumber":"22223333","phone":"50622223333","email":"ventas@emite.cr","notificationEmail":"notificaciones@emite.cr","otrasSenasExtranjero":"1234 Ocean Ave, Miami, FL 33101, USA"},"receiverId":"01a00c73-5c07-7bb5-8b9e-d20f16537e42","selfConsumption":true,"currency":"AED","exchangeRate":540,"saleCondition":"01","condicionVentaOtros":"Permuta de activos","creditTermDays":30,"paymentMethods":[{"type":"01","amount":12500,"otherDescription":"Crypto — USDT TRC-20"}],"lines":[{"lineNumber":1,"code":"8399000000000","partidaArancelaria":"850431200090","vinNumbers":["1HGCM82633A004352"],"pharmacyRegistry":"CR-MED-2024-1234","pharmaceuticalForm":"01","quantity":1,"unitOfMeasure":"Unid","transactionType":"01","commercialUnitOfMeasure":"Caja de 12","commercialCodes":[{"tipo":"01","codigo":"SKU-IMP-350"}],"description":"Servicio de consultoría TI — bloque mensual","unitPrice":10000,"discounts":[{"monto":500,"codigoDescuento":"01","naturaleza":"Descuento por volumen"}],"subtotal":10000,"taxes":[{"codigo":"01","codigoTarifa":"01","tarifa":13,"factor":0.13,"monto":1300,"exoneracion":{"tipoDocumento":"01","tipoDocumentoOtro":"Resolución especial 2024-001","numeroDocumento":"AL-001-2024","articulo":"15","inciso":"a","nombreInstitucion":"01","nombreInstitucionOtros":"Caja Costarricense de Seguro Social","fechaEmision":"2024-01-15T10:00:00-06:00","tarifaExonerada":13,"montoExoneracion":1300},"datosEspecifico":{"cantidadUnidadMedida":355,"porcentaje":5,"proporcion":17.75,"volumenUnidadConsumo":355,"impuestoUnidad":18.5,"esJabonTocador":false}}],"surtido":[{"cabysCode":"2310100000000","commercialCodes":[{"tipo":"01","codigo":"SKU-IMP-350"}],"cantidad":1,"unidadMedida":"Unid","unidadMedidaComercial":"Caja","detalle":"Arroz 1kg","precioUnitario":1000,"montoTotal":1000,"discounts":[{"monto":100,"codigo":"01","otros":"Descuento de temporada"}],"subtotal":1000,"ivaCobradoFabrica":"01","baseImponible":1000,"taxes":[{"codigo":"01","codigoTarifa":"08","tarifa":13,"datosEspecifico":{"cantidadUnidadMedida":355,"porcentaje":5,"proporcion":17.75,"volumenUnidadConsumo":355,"impuestoUnidad":18.5,"esJabonTocador":false},"monto":130}]}],"total":11300}],"otherCharges":[{"tipoDocumento":"01","tipoDocumentoOtros":"Cargo por embalaje especial","terceroIdentificationType":"01","terceroIdentificationNumber":"3101234567","nombreTercero":"Cruz Roja Costarricense","detalle":"Impuesto de servicio 10% sobre subtotal de servicios","porcentajeOc":10,"montoCargo":5000}],"notes":"Pago a 30 días — gracias por su compra.","branchCode":"001","terminalCode":"00001","economicActivityCode":"6201.0","economicActivityCodeReceptor":"6201.0","references":[{"invoiceId":"01a00c73-5c07-7bb5-8b9e-d20f16537e42","tipoDocIR":"05","tipoDocRefOTRO":"Recibo de compra de bien usado","numero":"REC-2026-0417","fechaEmisionIR":"2026-09-15T00:00:00-06:00","codigo":"01","codigoReferenciaOTRO":"Motivo personalizado para la referencia","razon":"Anulación por error en datos del receptor"}],"scheduledSendAt":"2026-07-03T20:00:00.000Z","omittedFixedAttachmentIds":["b0a1…","c2d3…"],"externalReference":"0197fa2e-1111-7abc-8000-3f5de1a2b3c4","situacion":1,"fechaEmision":"2026-07-12T19:30:00.000Z"},"notes":"Renovación automática del contrato de oficina."}'};
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/recurring-invoices \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "Renta oficina — mensual", "schedule": { "frequency": "daily", "interval": 1, "startDate": "2026-06-01", "endDate": "2027-06-01", "dayOfMonth": 15, "endOfMonthRule": "last_day_when_missing", "weekday": 1, "maxOccurrences": 12, "autoSubmit": true }, "template": { "docType": "01", "receiver": { "id": "01a00c73-5c09-7bb5-8b9e-d91c43bd61dc", "identificationType": "01", "identificationNumber": "3101234567", "name": "Futurabyte CR S.A.", "commercialName": "Futurabyte", "economicActivityCode": "6201.0", "location": { "provincia": "1", "canton": "01", "distrito": "01", "barrio": "Carmen", "otrasSenas": "50 metros norte de la iglesia, edificio azul" }, "phoneCountryCode": "506", "phoneNumber": "22223333", "phone": "50622223333", "email": "ventas@emite.cr", "notificationEmail": "notificaciones@emite.cr", "otrasSenasExtranjero": "1234 Ocean Ave, Miami, FL 33101, USA" }, "receiverId": "01a00c73-5c07-7bb5-8b9e-d20f16537e42", "selfConsumption": true, "currency": "AED", "exchangeRate": 540, "saleCondition": "01", "condicionVentaOtros": "Permuta de activos", "creditTermDays": 30, "paymentMethods": [ { "type": "01", "amount": 12500, "otherDescription": "Crypto — USDT TRC-20" } ], "lines": [ { "lineNumber": 1, "code": "8399000000000", "partidaArancelaria": "850431200090", "vinNumbers": [ "1HGCM82633A004352" ], "pharmacyRegistry": "CR-MED-2024-1234", "pharmaceuticalForm": "01", "quantity": 1, "unitOfMeasure": "Unid", "transactionType": "01", "commercialUnitOfMeasure": "Caja de 12", "commercialCodes": [ { "tipo": "01", "codigo": "SKU-IMP-350" } ], "description": "Servicio de consultoría TI — bloque mensual", "unitPrice": 10000, "discounts": [ { "monto": 500, "codigoDescuento": "01", "naturaleza": "Descuento por volumen" } ], "subtotal": 10000, "taxes": [ { "codigo": "01", "codigoTarifa": "01", "tarifa": 13, "factor": 0.13, "monto": 1300, "exoneracion": { "tipoDocumento": "01", "tipoDocumentoOtro": "Resolución especial 2024-001", "numeroDocumento": "AL-001-2024", "articulo": "15", "inciso": "a", "nombreInstitucion": "01", "nombreInstitucionOtros": "Caja Costarricense de Seguro Social", "fechaEmision": "2024-01-15T10:00:00-06:00", "tarifaExonerada": 13, "montoExoneracion": 1300 }, "datosEspecifico": { "cantidadUnidadMedida": 355, "porcentaje": 5, "proporcion": 17.75, "volumenUnidadConsumo": 355, "impuestoUnidad": 18.5, "esJabonTocador": false } } ], "surtido": [ { "cabysCode": "2310100000000", "commercialCodes": [ { "tipo": "01", "codigo": "SKU-IMP-350" } ], "cantidad": 1, "unidadMedida": "Unid", "unidadMedidaComercial": "Caja", "detalle": "Arroz 1kg", "precioUnitario": 1000, "montoTotal": 1000, "discounts": [ { "monto": 100, "codigo": "01", "otros": "Descuento de temporada" } ], "subtotal": 1000, "ivaCobradoFabrica": "01", "baseImponible": 1000, "taxes": [ { "codigo": "01", "codigoTarifa": "08", "tarifa": 13, "datosEspecifico": { "cantidadUnidadMedida": 355, "porcentaje": 5, "proporcion": 17.75, "volumenUnidadConsumo": 355, "impuestoUnidad": 18.5, "esJabonTocador": false }, "monto": 130 } ] } ], "total": 11300 } ], "otherCharges": [ { "tipoDocumento": "01", "tipoDocumentoOtros": "Cargo por embalaje especial", "terceroIdentificationType": "01", "terceroIdentificationNumber": "3101234567", "nombreTercero": "Cruz Roja Costarricense", "detalle": "Impuesto de servicio 10% sobre subtotal de servicios", "porcentajeOc": 10, "montoCargo": 5000 } ], "notes": "Pago a 30 días — gracias por su compra.", "branchCode": "001", "terminalCode": "00001", "economicActivityCode": "6201.0", "economicActivityCodeReceptor": "6201.0", "references": [ { "invoiceId": "01a00c73-5c07-7bb5-8b9e-d20f16537e42", "tipoDocIR": "05", "tipoDocRefOTRO": "Recibo de compra de bien usado", "numero": "REC-2026-0417", "fechaEmisionIR": "2026-09-15T00:00:00-06:00", "codigo": "01", "codigoReferenciaOTRO": "Motivo personalizado para la referencia", "razon": "Anulación por error en datos del receptor" } ], "scheduledSendAt": "2026-07-03T20:00:00.000Z", "omittedFixedAttachmentIds": [ "b0a1…", "c2d3…" ], "externalReference": "0197fa2e-1111-7abc-8000-3f5de1a2b3c4", "situacion": 1, "fechaEmision": "2026-07-12T19:30:00.000Z" }, "notes": "Renovación automática del contrato de oficina." }'Persists a schedule that materializes an invoice on each occurrence of its cadence. The template is a full CreateInvoiceDto restricted to FE/TE/FEC/FEE doc types and without references. The first nextRunDate is computed server-side from the schedule config (anchored at max(startDate, today)). The schedule starts active — or completed, when its first occurrence already falls after endDate; runs are materialized by the worker (or via POST /:id/run-now).
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Human-friendly label shown in the schedules list. 1-120 chars.
Example
Renta oficina — mensualWhen the invoices are created. Due occurrences are processed every day at 06:00 Costa Rica time, in the environment (sandbox or production) the schedule was created in.
object
How often an invoice is created, every interval units:
daily: counted in days fromstartDate.weekly: onweekday.monthly: ondayOfMonth.yearly: in the month ofstartDate, ondayOfMonth.
Example
monthlyEvery how many frequency units an invoice is created: 2 with monthly means every other month. An integer, 1 or more; 1 when omitted.
Example
1Anchor of the cadence, a calendar date (YYYY-MM-DD) in Costa Rica time: occurrences are counted from it. The first run is the first occurrence on or after both this date and today.
Example
2026-06-01Last date an occurrence may fall on (YYYY-MM-DD, inclusive). The schedule becomes completed once its next occurrence would come after it, and one whose first occurrence already does is created completed.
Example
2027-06-01Day of the month for monthly and yearly schedules; defaults to the day of startDate. For a month without that day see endOfMonthRule. Ignored for daily and weekly.
Example
15How monthly and yearly schedules pick the day:
last_day_when_missing(default):dayOfMonth, or the last day of a month that does not have it (31 becomes 30, or 28/29 in February).last_day_always: always the last day of the month, whateverdayOfMonthsays.
Ignored for daily and weekly.
Example
last_day_when_missingDay of the week for weekly schedules, 0 Sunday to 6 Saturday; defaults to the weekday of startDate. The first occurrence is the first such day on or after startDate. Ignored for the other frequencies.
Example
1Maximum number of occurrences: the schedule becomes completed after that many. An occurrence that failed for good also counts.
Example
12true (default): each invoice is signed and sent to Hacienda as soon as it is created, which needs a caller holding invoices:sign and invoices:submit (403 RECURRING_AUTO_SUBMIT_REQUIRES_SUBMIT_SCOPE). false: each invoice is left as a draft for someone to review and send.
Example
trueThe invoice each occurrence creates: a body like the one of POST /v1/invoices, replayed as it is on every run. Only docType 01 (FE), 04 (TE), 08 (FEC) or 09 (FEE), without references (400 RECURRING_DOCTYPE_NOT_ALLOWED), and in CRC or USD (400 RECURRING_CURRENCY_NOT_SUPPORTED); a USD invoice takes the exchange rate of the day it is created. Its fields are validated now; an occurrence the invoice rules refuse fails and pauses the schedule, and the company gets an email (unless it turned that notice off).
object
Type of document to issue (Anexo nota 3), also digits 9–10 of its consecutivo:
01: electronic invoice (factura electrónica, FE), to an identified receiver.02: debit note (nota de débito, ND), which adds to or corrects one of the company's accepted documents, named inreferences.03: credit note (nota de crédito, NC), which reduces, refunds or annuls one; it requires theinvoices:voidscope.04: electronic ticket (tiquete electrónico, TE); the receiver is optional.05,06,07: the receiver's messages accepting, partially accepting or rejecting a received document; send them withPOST /v1/documents/received/{id}/acceptance, not here.08: purchase invoice (factura electrónica de compra, FEC), which the company issues for what it buys from a supplier who does not issue one;receiveris then the SUPPLIER andreferencesnames the supplier's document.09: export invoice (factura electrónica de exportación, FEE); every line is exempt (IVA tariff code10).10: payment receipt (recibo electrónico de pago, REP), which records a payment of an accepted FE sold with sale condition08or10.
A receiver (receiver or receiverId) is required for 01, 08, 09 and 10 (RECEIVER_REQUIRED_FOR_DOCTYPE), except on a self-consumption invoice (selfConsumption), whose receiver is the company itself.
Example
01The other party, written in full: the customer, or on a purchase invoice (08) and a note over one, the SUPPLIER, who goes in the XML's <Emisor>. Use it or receiverId, never both (RECEIVER_BOTH_PROVIDED). Identification 05 (non-domiciled foreigner) is accepted on an FE only with sale condition 12 and never on a payment receipt; 06 (non-taxpayer) only as the supplier of a purchase invoice with sale condition 13. On a purchase invoice a 05 supplier needs otrasSenasExtranjero (SUPPLIER_FOREIGN_ADDRESS_REQUIRED), and any supplier but a 06 a location (SUPPLIER_LOCATION_REQUIRED).
object
Not used: ignored when a company is created, and kept as sent in the inline party of a document.
Example
01a00c73-5c09-7bb5-8b9e-d91c43bd61dcHacienda identification type: 01 cédula física, 02 cédula jurídica, 03 DIMEX, 04 NITE, 05 foreign (extranjero no domiciliado), 06 no contribuyente. Only 01–04 with an all-digit number can issue documents, because the clave embeds it.
Example
02Number of that identification, without separators, normalized to uppercase. Its format depends on identificationType: 01 9 digits; 02 10 positions — from 2026-11-01 the last six may be alphanumeric (decree 44648-MJ), e.g. 3101A1B2C3, which can receive documents but not issue them; 03 11–12 digits; 04 10 digits; 05 up to 20 letters, digits or hyphens; 06 9–12 digits.
Example
3101234567Legal name (razón social) — <Nombre> in the XML, cut to 100 characters. A company's name cannot change through PATCH /tenants/:id (400 IMMUTABLE_FIELD): POST /tenants/:id/hacienda-sync takes it from Hacienda's registry.
Example
Futurabyte CR S.A.Trade name — <NombreComercial> in the XML when present, cut to 80 characters.
Example
FuturabyteOnly when creating a company: becomes its default economic activity, in Hacienda's dotted form (e.g. 6201.0). Ignored afterwards — activities are managed in /tenants/:tenantId/economic-activities — and in a document's inline party, whose activity is the document's economicActivityCodeReceptor.
Example
6201.0Address in Costa Rica — <Ubicacion> in the XML. A company cannot issue without it (422 TENANT_LOCATION_MISSING). In a document it is never written for a 05 party; in a purchase invoice (FEC), a supplier of type 01–04 must carry it (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 azulDial code without "+" (1-3 digits).
Example
506National number, digits only (5-20).
Example
22223333Deprecated: a legacy single-string phone (+506 22223333). Send phoneCountryCode + phoneNumber instead; this one is only parsed for the XML when those are absent.
Example
50622223333Email address — <CorreoElectronico> in the XML. For a company, its main address and where its notices go when notificationEmail is empty; for a document's customer, where the accepted document is emailed.
Example
ventas@emite.crCompany only: a separate address for the system's notices to it (rejections, errors, summaries…). Set it with PATCH /tenants/:id; "" or null clears it and the notices go back to email. Ignored on creation and in a document's party.
Example
notificaciones@emite.crAddress abroad, free text — <OtrasSenasExtranjero>, 5–300 characters in Hacienda's schema. Written only for a foreign (05) party, and required when that party is the supplier of a purchase invoice (400 SUPPLIER_FOREIGN_ADDRESS_REQUIRED).
Example
1234 Ocean Ave, Miami, FL 33101, USAId of a contact saved in the company's directory (/v1/tenants/{tenantId}/parties), used instead of receiver; its data is copied into the document. It must be marked as a customer (PARTY_NOT_CUSTOMER), or as a supplier on a purchase invoice (08) and a note over one (PARTY_NOT_SUPPLIER).
Example
01a00c73-5c07-7bb5-8b9e-d20f16537e42Self-consumption (autoconsumo): the company declares goods or services it consumes itself, valued at their sale price, as an electronic invoice (01), and corrects one with a credit or debit note (03, 02) that carries it too (SELF_CONSUMPTION_NOT_ALLOWED_FOR_DOCTYPE otherwise). The API fills in the rest:
- the receiver is the company itself, from its profile; send neither
receivernorreceiverId(SELF_CONSUMPTION_RECEIVER_PROVIDED); - each line without a
transactionTypegets the self-consumption one:03taxed goods and02exempt goods (CAByS0to4),05taxed services and04exempt services (CAByS5to9), taxed meaning IVA at a rate above zero; - without
paymentMethods, the payment method is99(other) named «Autoconsumo». Hacienda requires one unless the sale is on credit (-517).
The detail of the invoice shows each line with its transactionType.
Example
trueISO 4217 currency of the whole document, emitted as <CodigoMoneda>: every amount in the request is in it. It must be enabled for the company (CURRENCY_NOT_ENABLED). A credit or debit note and a payment receipt use the currency of the document they reference (REFERENCE_CURRENCY_MISMATCH).
Example
CRCColones per unit of currency (up to 5 decimals), emitted as <TipoCambio>; ignored for CRC, where the XML declares 1. A rate sent here always wins. Without one, a credit or debit note takes the rate of the document it references, and USD takes the Central Bank's (BCCR) rate of the day in Costa Rica (EXCHANGE_RATE_REQUIRED_BCCR_DOWN if it cannot be fetched); any other currency requires it (EXCHANGE_RATE_REQUIRED).
Example
540Terms of the sale, emitted as <CondicionVenta> (Anexo nota 5):
01: cash (contado).02: credit (crédito); requirescreditTermDays.03: consignment.04: layaway (apartado).05: lease with an option to buy.06: lease as financing (arrendamiento en función financiera).07: collection on behalf of a third party.08: services provided to the State on credit.09: payment of services provided to the State; payment receipts only, for an FE with08.10: sale on credit with IVA up to 90 days (LIVA art. 27); requirescreditTermDays.11: payment of such a sale; payment receipts only, for an FE with10.12: sale of goods not yet nationalized in Costa Rica (mercancía no nacionalizada); FE (and notes over one) only, and the one condition under which an FE accepts a non-domiciled receiver (05).13: sale of used goods by a non-taxpayer; used on a purchase invoice whose supplier is a non-taxpayer (06).14: operating lease (arrendamiento operativo), as the tax rules define it.15: financial lease (arrendamiento financiero), as the tax rules define it.99: any other condition, described incondicionVentaOtros.
At least one payment method is required except with 02, 08 and 10 (PAYMENT_METHOD_REQUIRED). A payment receipt (10) accepts only 09 and 11 (SALE_CONDITION_INVALID_FOR_REP), which no other document accepts (SALE_CONDITION_REP_ONLY); 12 is refused outside FE, NC and ND (SALE_CONDITION_FE_ONLY).
Example
01Description of the sale condition when saleCondition is 99, emitted as <CondicionVentaOtros>: required then, 5–100 characters (CONDICION_VENTA_OTROS_REQUIRED); ignored for any other condition.
Example
Permuta de activosDays the customer has to pay, emitted as <PlazoCredito>. Required with sale condition 02 or 10 (CREDIT_TERM_REQUIRED). A payment receipt (10) has no such element.
Example
30How the customer pays, each entry emitted as a <MedioPago>. At least one is required unless saleCondition is a credit code (02, 08 or 10) (PAYMENT_METHOD_REQUIRED); a payment receipt (10) therefore always carries one. With two or more, every entry needs its amount (PAYMENT_AMOUNT_REQUIRED) and the amounts must add up to the document total within 0.01 (PAYMENT_METHODS_SUM_MISMATCH).
object
How the customer pays, emitted as <TipoMedioPago> (Anexo nota 6):
01: cash.02: card.03: cheque.04: bank transfer or deposit.05: collected by a third party (recaudado por terceros): the payment is received by someone other than the seller, e.g. a phone bill paid at a supermarket.06: SINPE Móvil (Costa Rica's mobile payment system).07: digital platform.99: any other method, described inotherDescription.
Example
01Amount paid with this method, in the document currency (up to 5 decimals), emitted as <TotalMedioPago>. Required on every entry when there are two or more (PAYMENT_AMOUNT_REQUIRED), and then the amounts must add up to the document total within 0.01 (PAYMENT_METHODS_SUM_MISMATCH); with a single entry it is ignored.
Example
12500Description of the payment method when type is 99, emitted as <MedioPagoOtros>: required then, 3–100 characters (PAYMENT_OTHER_DESCRIPTION_REQUIRED); ignored for any other type.
Example
Crypto — USDT TRC-20What the document sells, each line emitted as a <LineaDetalle> (Hacienda allows up to 1000). At least one is required (LINE_REQUIRED), except on a document whose only content is other charges of types 04, 08, 09 or 10 (OTHER_CHARGES_REQUIRES_LINE). On a payment receipt (10) each line is a payment towards the invoice it references.
object
Number of the line in the document, starting at 1, emitted as <NumeroLinea>; the lines are written to the XML in the order of this number.
Example
113-digit CABYS code (Costa Rica's catalog of goods and services, published by the BCCR) of what the line sells, emitted as <CodigoCABYS>; Hacienda checks it against the catalog in force. Required on every document except a payment receipt (10), whose lines carry none (LINE_CABYS_REQUIRED). Its first digit also places the line among the services (5 to 9) or the goods (0 to 4) in the document totals.
Example
8399000000000Customs tariff heading of the goods (partida arancelaria), emitted as <PartidaArancelaria> and only on an export invoice (09). There it is required, with exactly 12 letters or digits, on every line whose CABYS code starts with 0 to 4, that is, goods (PARTIDA_ARANCELARIA_REQUIRED).
Example
850431200090VIN or serial number of each vehicle, aircraft or vessel the line sells, one entry per unit, exactly 17 characters each (VIN_LENGTH); each is emitted as a <NumeroVINoSerie>. Hacienda asks for them when the CABYS code is a means of transport.
Example
[ "1HGCM82633A004352"]Ministry of Health registration number of the medicine the line sells, emitted as <RegistroMedicamento>. Hacienda asks for it when the CABYS code is a medicine with a sanitary registration.
Example
CR-MED-2024-1234Code of the medicine's pharmaceutical form from Hacienda's catalog (Anexo nota 19, «Código de forma farmacéutica»), emitted as <FormaFarmaceutica>; a code outside it is refused (PHARMACEUTICAL_FORM_INVALID). Like pharmacyRegistry, Hacienda asks for it on medicines with a sanitary registration.
Example
01Quantity sold, greater than 0, up to 3 decimals, emitted as <Cantidad>. A payment receipt (10) has no quantity in its XML: there quantity × unitPrice is the amount being paid, without tax.
Example
1Unit of measure, as a symbol from Hacienda's catalog (Anexo nota 15), emitted as <UnidadMedida>: for example Unid (unit), Kg (kilogram), L (litre), h (hour), Sp (professional services), St (technical services) or Os (other service). The symbols are case-sensitive; Hacienda checks them, the API does not. A payment receipt (10) does not use it.
Example
UnidWhy the line is on the document (Anexo nota 22), emitted as <TipoTransaccion>. Omit it for a normal sale, which is how Hacienda reads a line without it:
01: normal sale of goods and services.02/03: the business consumes its own goods (autoconsumo), exempt / taxed.04/05: the business consumes its own services (autoconsumo), exempt / taxed.06/07: membership fee, taxed / exempt.08/09/10: capital goods for the issuer, for the receiver, or for both.11: capital goods withdrawn for the issuer's own use, exempt.12: capital goods transferred to third parties without consideration, exempt.13: goods withdrawn for own use or transferred to third parties without consideration.
Accepted on an invoice (01), a purchase invoice (08), an export invoice (09) and the credit and debit notes (03, 02); a ticket (04) and a payment receipt (10) have no such element (LINE_NOT_ALLOWED_FOR_DOCTYPE, reason transaction_type). The self-consumption of a business goes on an invoice to the business itself.
A type that names a tax condition must match the line: 02, 04, 07, 11 and 12 are exempt and carry no IVA at a positive rate, and 03 and 05 are taxed and carry one (LINE_TRANSACTION_TYPE_TAX_MISMATCH). A note that corrects such a line declares the same type, as the Anexo asks; POST /v1/invoices/{id}/credit-note copies it.
Example
05The business's own unit for the line, not a standard measure (a box, a pallet), emitted as <UnidadMedidaComercial> next to unitOfMeasure, which stays required. Up to 20 characters. A payment receipt (10) has no such element (LINE_NOT_ALLOWED_FOR_DOCTYPE, reason commercial_unit).
Example
Caja de 12The product's own codes (the seller's SKU, the buyer's code, a GTIN…), each emitted as a <CodigoComercial>. tipo (Anexo nota 12): 01 seller's code, 02 buyer's code, 03 code assigned by the manufacturer (industrial or importer), 04 internal-use code, 99 other. A combo line (surtido) must carry one of type 03 with the package's SKU or GTIN (SURTIDO_COMMERCIAL_CODE_REQUIRED).
object
Who assigned the code (<CodigoComercial><Tipo>, Anexo nota 12):
01: the seller's product code.02: the buyer's product code.03: code assigned by the manufacturer (industrial or importer), such as a GTIN.04: internal-use code.99: other.
Example
01The code itself, 1–20 characters (<CodigoComercial><Codigo>).
Example
SKU-IMP-350What the line sells, as the document shows it, emitted as <Detalle> (Hacienda accepts 3–200 characters). On a payment receipt (10) it describes the payment of the original invoice and, per the Anexo, names at least the instalment.
Example
Servicio de consultoría TI — bloque mensualPrice of one unit before discounts and taxes, in the document currency (up to 5 decimals), emitted as <PrecioUnitario>. On a combo line (surtido) the API replaces it with the sum of the components' subtotals for one unit of the combo.
Example
10000Discounts on the line, each emitted as a <Descuento> (Hacienda allows at most 5). They lower the line subtotal; codes 01, 02 and 03 cover the whole line and must be its only discount (LINE_DISCOUNT_FULL_EXCLUSIVE). Not accepted on a payment receipt (10) (LINE_NOT_ALLOWED_FOR_DOCTYPE).
object
Discount amount in the document currency (up to 5 decimals), emitted as <MontoDescuento>; Hacienda accepts at most the line's quantity × unitPrice. For codes 01, 02 and 03 it must equal quantity × unitPrice (LINE_DISCOUNT_FULL_REQUIRED).
Example
500Kind of discount, emitted as <CodigoDescuento> (Anexo nota 20):
01: gift (regalía). The whole line is given away; its IVA is computed on the grossquantity×unitPriceand assumed by the issuer (<ImpuestoAsumidoEmisorFabrica>), so the customer pays none of it.02: gift or bonus with the IVA charged to the customer (regalía o bonificación, IVA cobrado al cliente). The whole line; its IVA is computed on thesubtotal, which the discount leaves at 0, so on a line with no other tax the IVAmontois 0.03: bonus (bonificación). The whole line, with the IVA treatment of01.04: volume discount.05: seasonal discount.06: promotional discount.07: commercial discount.08: frequency discount.09: sustained discount.99: any other discount, described innaturaleza.
Codes 04 to 99 lower the subtotal and the IVA is computed on what remains. Codes 01, 02 and 03 must be the only discount of their line (LINE_DISCOUNT_FULL_EXCLUSIVE).
Example
01Description of the discount, emitted as <NaturalezaDescuento> (Hacienda accepts 3–80 characters). Required for code 99, with at least 5 characters (NATURALEZA_REQUIRED): for that code the same text is also emitted as <CodigoDescuentoOTRO>, which Hacienda demands.
Example
Descuento por volumenquantity × unitPrice minus the line's discounts, in the document currency (up to 5 decimals), emitted as <SubTotal>. The API recomputes it and answers 422 INVOICE_TOTALS_MISMATCH when it differs by more than 0.005; on a combo line (surtido) it replaces it with the value derived from the components.
Example
10000Taxes on the line, each emitted as an <Impuesto>. Hacienda requires at least one on every line (TAX_REQUIRED), and a code may appear only once per line (DUPLICATE_TAX_CODE). An exempt line still carries IVA (01) with tariff code 10 and a monto of 0. On a combo line (surtido) the API replaces them with the sum of the components' taxes.
object
Tax code, emitted as <Codigo> (Anexo nota 8):
01: IVA (value-added tax).02: selective consumption tax (impuesto selectivo de consumo).03: single tax on fuels.04: specific tax on alcoholic beverages.05: specific tax on packaged non-alcoholic beverages and toilet soaps.06: tax on tobacco products.07: IVA with a special calculation of its taxable base.08: IVA under the used-goods regime, computed withfactor.12: specific tax on cement.99: another tax.
Codes 02, 03, 04, 05, 06 and 12 are accepted only on documents in CRC (EXCISE_NOT_SUPPORTED_FOR_CURRENCY), and a payment receipt (10) accepts only the IVA codes 01, 07 and 08 (LINE_NOT_ALLOWED_FOR_DOCTYPE).
Example
01IVA tariff code, emitted as <CodigoTarifaIVA> (Anexo nota 8.1):
01: 0% rate of RLIVA art. 32.1, which keeps the full credit right (e.g. sales to the CCSS or to municipalities).02: reduced 1%.03: reduced 2%.04: reduced 4%.05: transitional 0%, for credit and debit notes only.06: transitional 4%, for credit and debit notes only.07: transitional 8%, for credit and debit notes only.08: general 13%.09: reduced 0.5%.10: exempt (Ley 9635, art. 8); the taxmontois then 0.11: 0% without credit right, to record a good or service not subject to IVA that grants no credit.
Hacienda requires it for tax codes 01 and 07. On an export invoice (09) every IVA tax must use 10 (LINE_NOT_ALLOWED_FOR_DOCTYPE, reason export_tariff).
Example
08Tax rate as a percentage (13 for 13%, 0.5 for 0.5%), emitted as <Tarifa>. With code 01 it must be the rate of codigoTarifa (Hacienda rejects a mismatch); for 02 and 99 it is the rate the applicable rule sets, and for 12 (cement) it is 5%. For code 08 the XML carries factor instead, and the per-unit codes 03 to 06 take their amount from datosEspecifico, not from this rate.
Example
13Factor set by the Ministry of Finance for IVA under the used-goods regime (code 08), as a decimal with up to 4 places, emitted as <FactorCalculoIVA> instead of <Tarifa>. Required for 08 (FACTOR_REQUIRED): the IVA is then the taxable base × this factor.
Example
0.13Amount of this tax in the document currency (up to 5 decimals), emitted as <Monto>: always the full tax, also when an exoneracion covers part of it. The API recomputes it and answers 422 INVOICE_TOTALS_MISMATCH when it differs by more than 0.005:
01and07: taxable base ×tarifa/ 100;08: taxable base ×factor. The base is the linesubtotalplus its taxes02,04,05and12, or the grossquantity×unitPricewhen the line has discount01or03.02and12:subtotal×tarifa/ 100.03to06: the formula ofdatosEspecifico.- Any other code is taken as sent.
Example
1300The authorization that exonerates the customer from all or part of this tax, emitted as <Exoneracion> inside the tax. Use it on an IVA tax (01, 07 or 08), the only ones whose exoneration the line and document totals count; the tax monto stays the full tax and the exonerated share is declared in montoExoneracion. Not accepted on an export invoice (09) or a payment receipt (10) (LINE_NOT_ALLOWED_FOR_DOCTYPE).
object
Kind of document that grants the exoneration, emitted as <TipoDocumentoEX1> (Anexo nota 10.1):
01: purchases authorized by the Dirección General de Tributación (DGT).02: exempt sales to diplomats.03: authorized by a special law.04: Dirección General de Hacienda (DGH) exemption, generic local authorization.05: DGH exemption under Transitorio V (engineering, architecture, surveying and civil-works services).06: tourism services registered with the Costa Rican Tourism Institute (ICT).07: Transitorio XVII (collection, sorting and storage of recyclable and reusable materials).08: free-trade-zone exoneration (zona franca).09: services complementary to exports (RLIVA art. 11).10: municipal corporations (corporaciones municipales).11: DGH exemption, specific local-tax authorization.99: any other document, described intipoDocumentoOtro.
The Anexo reserves 01, 05, 06 and 07 for credit and debit notes.
Example
01What kind of document it is when tipoDocumento is 99, emitted as <TipoDocumentoOTRO>. Required for 99 (EXONERACION_TIPO_DOCUMENTO_OTRO_REQUIRED); Hacienda accepts 5–100 characters.
Example
Resolución especial 2024-001Number of the exoneration or authorization document, written exactly as the issuing institution printed it, hyphens included; emitted as <NumeroDocumento> (Hacienda accepts 3–40 characters). With tipoDocumento 02, 03 or 08 it is the number of the law that grants the exoneration. With 04 or 11 Hacienda checks it against the authorization it issued, which must be in force; GET /v1/hacienda/exoneracion/{autorizacion} reads an authorization of the AL-XXXXXXXX-XX form.
Example
AL-001-2024Article of the law that establishes the exoneration, emitted as <Articulo>. Hacienda requires it for tipoDocumento 02, 03, 06, 07 and 08; its schema types it as a whole number of up to 6 digits.
Example
15Subsection (inciso) of that article, when the article refers to one; emitted as <Inciso>. Hacienda's schema types it as a whole number of up to 6 digits.
Example
aInstitution that issued the exoneration document, emitted as <NombreInstitucion> (Anexo nota 23):
01: Ministry of Finance (Ministerio de Hacienda).02: Ministry of Foreign Affairs and Worship.03: Ministry of Agriculture and Livestock.04: Ministry of Economy, Industry and Commerce.05: Costa Rican Red Cross.06: Costa Rica Fire Department (Benemérito Cuerpo de Bomberos).07: Asociación Obras del Espíritu Santo.08: Federación Cruzada Nacional de Protección al Anciano (Fecrunapa).09: Escuela de Agricultura de la Región Húmeda (EARTH).10: Instituto Centroamericano de Administración de Empresas (INCAE).11: Junta de Protección Social (JPS).12: Autoridad Reguladora de los Servicios Públicos (Aresep).99: another institution, named innombreInstitucionOtros.
Example
01Name of the issuing institution when nombreInstitucion is 99, emitted as <NombreInstitucionOtros>. Required for 99 (EXONERACION_NOMBRE_INSTITUCION_OTROS_REQUIRED); Hacienda accepts 5–160 characters.
Example
Caja Costarricense de Seguro SocialWhen the exoneration document was issued: an ISO 8601 date-time, emitted as <FechaEmisionEX>. With tipoDocumento 04 or 11 Hacienda checks it against the authorization and rejects the document if it differs.
Example
2024-01-15T10:00:00-06:00Percentage points of the tax that the exoneration covers, emitted as <TarifaExonerada>: 13 exonerates a 13% IVA in full, 4 leaves 9 points of it to pay. When it is lower than the tax's tarifa, only that share of the line's base is reported as exonerated and the rest as taxed. With tipoDocumento 04 or 11 Hacienda rejects a rate higher than the authorization grants.
Example
13Amount of tax the exoneration covers, in the document currency (up to 5 decimals), emitted as <MontoExoneracion>: the line's IVA base × tarifaExonerada / 100, never more than the tax's monto. It is subtracted from the line's net tax; send this exact figure, because the API derives the line total and the document totals from that same calculation.
Example
1300Per-unit data of a specific tax, emitted as <DatosImpuestoEspecifico>. Required for codes 03, 04, 05 and 06 (SPECIFIC_TAX_DATA_REQUIRED) and ignored for the others. The API computes the tax monto from it with the Anexo formulas, quantity being the line's:
03:cantidadUnidadMedida×impuestoUnidad.04:quantity×proporcion×impuestoUnidad.05beverage:quantity×cantidadUnidadMedida×impuestoUnidad/volumenUnidadConsumo.05toilet soap:quantity×volumenUnidadConsumo×impuestoUnidad.06:quantity×cantidadUnidadMedida×impuestoUnidad.
Codes 03 to 06 are not accepted on a purchase invoice (08) or an export invoice (09), whose schemas have no place for this data (LINE_NOT_ALLOWED_FOR_DOCTYPE).
object
Quantity of the unit of measure the tax applies to, up to 2 decimals, emitted as <CantidadUnidadMedida>. Code 03 (fuel): the litres of fuel of the whole line (the tax is this × impuestoUnidad, not multiplied by the line quantity). Codes 04 and 05: the millilitres of the container sold. Code 06 (tobacco): the per-unit measure the tax is levied on (the tax is quantity × this × impuestoUnidad).
Example
355Alcohol by volume of the beverage, as a percentage (5 for 5%, up to 2 decimals), emitted as <Porcentaje>. Required for code 04 (SPECIFIC_TAX_FIELD_REQUIRED).
Example
5Code 04: millilitres of absolute alcohol per unit, porcentaje / 100 × cantidadUnidadMedida (up to 5 decimals), emitted as <Proporcion>. Hacienda requires it for 04; when it is omitted the API computes it.
Example
17.75Code 05: the reference volume in millilitres for a beverage, or the grams of toilet soap sold (up to 2 decimals), emitted as <VolumenUnidadConsumo>. Required for 05 (SPECIFIC_TAX_FIELD_REQUIRED).
Example
355Tax per unit of measure, as the law of each specific tax sets it (up to 5 decimals), emitted as <ImpuestoUnidad>: per litre for 03, per millilitre of absolute alcohol for 04, per reference volume for a 05 beverage, per gram for 05 soap and per unit of cantidadUnidadMedida for 06. In colones: the API accepts specific taxes only on documents in CRC.
Example
18.5Code 05 only: true when the product is toilet soap, so the tax is quantity × volumenUnidadConsumo × impuestoUnidad; otherwise the beverage formula, quantity × cantidadUnidadMedida × impuestoUnidad / volumenUnidadConsumo, applies. Not part of the XML: it only selects the formula.
Example
falseComponents of a combo, kit or assortment billed as one line (surtido), emitted as <DetalleSurtido>: 2 to 20 products with different CABYS codes (SURTIDO_MIN_COMPONENTS, SURTIDO_DUPLICATE_CABYS), each described for ONE unit of the combo. The API recomputes every amount of the components and of the line from the components' quantities, prices, discounts and taxes, overwriting what was sent. Not accepted on a purchase invoice (08) or a payment receipt (10) (SURTIDO_NOT_ALLOWED_FOR_DOCTYPE). The Anexo allows a combo to be billed this way only by its manufacturer or importer; anyone else lists its products as separate lines.
object
13-digit CABYS code of the component, emitted as <CodigoCABYSSurtido>; Hacienda checks it against the catalog in force. No two components of a combo may share one (SURTIDO_DUPLICATE_CABYS).
Example
2310100000000Optional codes of the component (the seller's SKU, a GTIN…), each emitted as a <CodigoComercialSurtido>, with the same tipo codes as the line's commercialCodes (at most 5).
object
Who assigned the code (<CodigoComercial><Tipo>, Anexo nota 12):
01: the seller's product code.02: the buyer's product code.03: code assigned by the manufacturer (industrial or importer), such as a GTIN.04: internal-use code.99: other.
Example
01The code itself, 1–20 characters (<CodigoComercial><Codigo>).
Example
SKU-IMP-350Quantity of this component in ONE unit of the combo (up to 3 decimals), emitted as <CantidadSurtido>; Hacienda requires it to be greater than 0.
Example
1Unit of measure of the component, a symbol from Hacienda's catalog (Anexo nota 15) such as Unid, like the line's unitOfMeasure; emitted as <UnidadMedidaSurtido>.
Example
UnidThe business's own unit for the component, not a standard measure (e.g. a box or a pallet), emitted as <UnidadMedidaComercialSurtido>.
Example
CajaWhat the component is, emitted as <DetalleSurtido> (Hacienda accepts 3–200 characters).
Example
Arroz 1kgPrice of one unit of the component before discounts and taxes, in the document currency (up to 5 decimals), emitted as <PrecioUnitarioSurtido>; Hacienda requires it to be greater than 0. With cantidad, the discounts and the tax rates, it is what the API computes the combo from.
Example
1000cantidad × precioUnitario, emitted as <MontoTotalSurtido>. The API recomputes it and overwrites what was sent.
Example
1000Discounts on the component, each emitted as a <DescuentoSurtido> (at most 5). A combo's discounts go here: the API sets the line unitPrice to the sum of the components' subtotals, after these discounts.
object
Discount on the component for ONE unit of the combo, in the document currency (up to 5 decimals), emitted as <MontoDescuentoSurtido>; Hacienda accepts at most the component's montoTotal.
Example
100Kind of discount, from the same catalog as a line discount's codigoDescuento (Anexo nota 20): 01 gift (regalía), 02 gift or bonus with the IVA charged to the customer, 03 bonus (bonificación), 04 volume, 05 seasonal, 06 promotional, 07 commercial, 08 frequency, 09 sustained, 99 other; emitted as <CodigoDescuentoSurtido>. With 01 or 03 the IVA of the component is computed on its gross montoTotal and assumed by the issuer, and then every component of the combo must carry one of them (SURTIDO_BONIFICACION_ALL_OR_NONE).
Example
01Description of the discount when codigo is 99, emitted as <DescuentoSurtidoOtros>: required then, 3–80 characters (DESCUENTO_OTROS_REQUIRED).
Example
Descuento de temporadamontoTotal minus the component's discounts, emitted as <SubTotalSurtido>. The API recomputes it and overwrites what was sent.
Example
1000Only for taxpayers that pay IVA at factory level (Anexo nota 21), emitted as <IVACobradoFabricaSurtido>:
01: sale of goods with IVA under the special system of IVA at factory level.02: exempt sale under that system (factory, wholesale and customs level), because the goods already bore the tax at factory level.
Not written on an export invoice (09).
Example
01IVA base of the component, emitted as <BaseImponibleSurtido> (not on an export invoice): its subtotal (its gross montoTotal when it carries discount 01 or 03) plus its taxes 02, 04 and 05. The API recomputes it and overwrites what was sent.
Example
1000Taxes on the component, each emitted as an <ImpuestoSurtido>; Hacienda requires at least one. A combo may mix components with different IVA rates: the line's taxes are their sum per code and rate, × the line quantity.
object
Tax code of the component, from the same catalog as a line tax's codigo (Anexo nota 8): 01 IVA, 02 selective consumption tax, 04 alcoholic beverages, 05 packaged non-alcoholic beverages and toilet soaps, 06 tobacco, 07 IVA with a special base, 08 IVA on used goods, 99 other; emitted as <CodigoImpuestoSurtido>. The fuel (03) and cement (12) taxes are refused inside a combo (SURTIDO_EXCISE_NOT_ALLOWED).
Example
01IVA tariff code of the component, from the same catalog as a line tax's codigoTarifa (Anexo nota 8.1; e.g. 08 general 13%, 10 exempt), emitted as <CodigoTarifaIVASurtido>. Hacienda requires it with tax code 01.
Example
08Tax rate as a percentage (13 for 13%), emitted as <TarifaSurtido>; with code 01 it must be the rate of codigoTarifa. The API computes the amount of an IVA tax as baseImponible × this rate / 100.
Example
13Per-unit data of a specific tax (04, 05 or 06) on the component, emitted as <DatosImpuestoEspecificoSurtido>; Hacienda requires it for those codes. Same fields and formulas as a line tax's datosEspecifico, with the component's cantidad as the quantity.
object
Quantity of the unit of measure the tax applies to, up to 2 decimals, emitted as <CantidadUnidadMedida>. Code 03 (fuel): the litres of fuel of the whole line (the tax is this × impuestoUnidad, not multiplied by the line quantity). Codes 04 and 05: the millilitres of the container sold. Code 06 (tobacco): the per-unit measure the tax is levied on (the tax is quantity × this × impuestoUnidad).
Example
355Alcohol by volume of the beverage, as a percentage (5 for 5%, up to 2 decimals), emitted as <Porcentaje>. Required for code 04 (SPECIFIC_TAX_FIELD_REQUIRED).
Example
5Code 04: millilitres of absolute alcohol per unit, porcentaje / 100 × cantidadUnidadMedida (up to 5 decimals), emitted as <Proporcion>. Hacienda requires it for 04; when it is omitted the API computes it.
Example
17.75Code 05: the reference volume in millilitres for a beverage, or the grams of toilet soap sold (up to 2 decimals), emitted as <VolumenUnidadConsumo>. Required for 05 (SPECIFIC_TAX_FIELD_REQUIRED).
Example
355Tax per unit of measure, as the law of each specific tax sets it (up to 5 decimals), emitted as <ImpuestoUnidad>: per litre for 03, per millilitre of absolute alcohol for 04, per reference volume for a 05 beverage, per gram for 05 soap and per unit of cantidadUnidadMedida for 06. In colones: the API accepts specific taxes only on documents in CRC.
Example
18.5Code 05 only: true when the product is toilet soap, so the tax is quantity × volumenUnidadConsumo × impuestoUnidad; otherwise the beverage formula, quantity × cantidadUnidadMedida × impuestoUnidad / volumenUnidadConsumo, applies. Not part of the XML: it only selects the formula.
Example
falseAmount of this tax for ONE unit of the combo, emitted as <MontoImpuestoSurtido>. The API recomputes it from the rate or from datosEspecifico and overwrites what was sent; the line's own taxes are the sum over the components × the line quantity.
Example
130Line total, emitted as <MontoTotalLinea>: the subtotal plus the net tax, which is the sum of the tax montos minus the tax the issuer assumes (the IVA of a line with discount 01 or 03, and the specific taxes 03, 04, 05 and 12) and minus the exonerated amounts. The API recomputes it and answers 422 INVOICE_TOTALS_MISMATCH when it differs by more than 0.005 (or the sum of all line totals by more than 0.01); on a combo line (surtido) it replaces it.
Example
11300Charges that are not a sale of goods or services, such as the 10% service charge or an amount collected for a third party, each emitted as an <OtrosCargos>. They add to the document total (<TotalOtrosCargos>), never to its taxable or sales totals. Not accepted on a payment receipt (10) (OTHER_CHARGES_NOT_ALLOWED_FOR_DOCTYPE).
object
Kind of charge, emitted as <TipoDocumentoOC> (Anexo nota 16):
01: parafiscal levy (contribución parafiscal).02: Red Cross stamp (timbre de la Cruz Roja).03: Fire Department stamp (timbre del Benemérito Cuerpo de Bomberos).04: amount collected on behalf of a third party (cobro de un tercero).05: export costs.06: 10% service charge (impuesto de servicio), the usual restaurant surcharge.07: professional association stamp (timbre de colegios profesionales).08: security deposit.09: fine or penalty.10: late-payment interest (intereses moratorios).99: any other charge, described intipoDocumentoOtros.
A document may have no lines only when every charge uses 04, 08, 09 or 10; otherwise the API answers OTHER_CHARGES_REQUIRES_LINE.
Example
06What kind of charge it is when tipoDocumento is 99, emitted as <TipoDocumentoOTROS>. Required for 99 (5–100 characters, otherwise OTHER_CHARGES_TIPO_OTROS_REQUIRED); never emitted for any other code.
Example
Cargo por embalaje especialIdentification type of the third party behind the charge, emitted as <IdentificacionTercero><Tipo>: 01 cédula física (individual), 02 cédula jurídica (legal entity), 03 DIMEX (foreign resident), 04 NITE (number issued by the tax administration), 05 non-domiciled foreigner, 06 non-taxpayer. The identification is emitted only when this and terceroIdentificationNumber are both present; Hacienda requires them, and nombreTercero, for code 04.
Identification number of the third party, emitted as <IdentificacionTercero><Numero>: 1–20 digits, no dashes (OTHER_CHARGES_TERCERO_NUMBER_INVALID otherwise). Required when terceroIdentificationType is set (OTHER_CHARGES_TERCERO_NUMBER_REQUIRED). For code 04 Hacienda checks its length against the type: 9 digits for a cédula física, 10 for a cédula jurídica or a NITE, 11 or 12 for a DIMEX.
Example
3101234567Name or business name of the third party, emitted as <NombreTercero> (5–100 characters). Optional, except that Hacienda requires it for code 04.
Example
Cruz Roja CostarricenseDescription of the charge as the document shows it, emitted as <Detalle>.
Example
Impuesto de servicio 10% sobre subtotal de serviciosPercentage the charge was computed with, when it has one, emitted as <PorcentajeOC>: a percent written as a number (10 for 10%, 0.5 for 0.5%), zero or more, up to 5 decimals. Informational: the API does not recompute montoCargo from it.
Example
10Amount of the charge in the document currency, greater than zero, up to 5 decimals; emitted as <MontoCargo>. The charges add up to totals.totalOtrosCargos (<TotalOtrosCargos>), which is added to <TotalComprobante> and to none of the sales or tax subtotals.
Example
5000Free-text remarks, emitted as <Otros><OtroTexto> and printed on the PDF from there. At most 500 characters (INVOICE_NOTES_TOO_LONG). Not accepted on a payment receipt (10), whose schema has no such element (NOTES_NOT_ALLOWED_FOR_DOCTYPE).
Example
Pago a 30 días — gracias por su compra.Code of the branch (sucursal) that issues the document, 1–3 digits, zero-padded (1 is 001): digits 1–3 of its consecutivo. It must be one of the company's branches; omitted, the default branch is used.
Example
001Code of the terminal (point of sale) within that branch, 1–5 digits, zero-padded: digits 4–8 of the consecutivo. It must exist in the branch; omitted, the branch's default terminal is used. Each branch, terminal and document type keeps its own numbering.
Example
00001Economic activity, registered by the company with Hacienda, under which the document is issued, in its dotted form (6201.0); emitted as <CodigoActividadEmisor>. It must be one of the company's registered activities; omitted, its default activity is used. On a purchase invoice (08) and a note over one, where the company is the XML receiver, it is emitted as <CodigoActividadReceptor> instead, unless economicActivityCodeReceptor is sent. A payment receipt (10) carries no activity.
Example
6201.0The receiver's economic activity for this purchase, in the same dotted form, emitted as <CodigoActividadReceptor>; Hacienda uses it when the receiver needs the document for a tax credit or a deductible expense. Not written on a ticket (04), an export invoice (09) or a payment receipt (10), whose schemas lack it. On a purchase invoice (08) it is the company's own activity for the purchase and defaults to economicActivityCode.
Example
6201.0The documents this one refers to, each emitted as an <InformacionReferencia> (1 to 10). Required on a debit note (02), a credit note (03), a purchase invoice (08) and a payment receipt (10) (REFERENCES_REQUIRED); an FE with sale condition 12 to a non-domiciled receiver must name its supporting document (REFERENCE_REQUIRED_FOR_EXTRANJERO_FE); an FE or TE with situacion 2 names the provisional receipt it replaces (SITUACION_2_REQUIRES_PROVISIONAL_REFERENCE); an FE, a TE or an FEE may name, by invoiceId, the document of ours it replaces (07, 15, 16, see codigo); any other reference is refused (REFERENCES_FORBIDDEN). Notes and payment receipts name the company's own documents by invoiceId; a purchase invoice names the supplier's document with tipoDocIR, numero and fechaEmisionIR (or, by invoiceId, the earlier purchase invoice it replaces).
object
Internal reference: the id of one of the company's own documents in the same environment, already numbered. It is what a credit or debit note adjusts, what a payment receipt pays (an accepted FE) and the earlier purchase invoice an FEC replaces; notes and payment receipts accept only this form (REFERENCE_INVOICE_REQUIRED). The API writes that document's clave as <Numero>, its emission date as <FechaEmisionIR> and derives <TipoDocIR> from its type: FE → 01, ND → 02, NC → 03, TE → 04; over an FEC, a credit note declares 17, a debit note 18 and an FEC that replaces it 15; over an FEE, a note declares 19. Send it alone, without tipoDocIR, tipoDocRefOTRO, numero or fechaEmisionIR (REFERENCE_SHAPE_AMBIGUOUS).
Example
01a00c73-5c07-7bb5-8b9e-d20f16537e42External reference: the type of a document that is not one of the company's, emitted as <TipoDocIR> (Anexo nota 10). Required when there is no invoiceId; with invoiceId the API derives it. The accepted types:
05: dispatch note (nota de despacho).06: contract.07: procedure (procedimiento).08: document issued in contingency (comprobante emitido en contingencia): the paper provisional receipt an FE or TE withsituacion2replaces, always withcodigo05(PROVISIONAL_REFERENCE_INVALID).13: billing of the past month (facturación mes vencido), e.g. utilities billed in the first days of a month for income of the month before.14: document provided by a taxpayer under a special regime (comprobante aportado por contribuyente de régimen especial).16: document of a non-domiciled supplier (comprobante de proveedor no domiciliado); purchase invoices only.99: any other document, described intipoDocRefOTRO.
Only a purchase invoice (08), an FE with sale condition 12 and an FE or TE with situacion 2 (its provisional receipt, 08) accept external references (REFERENCE_EXTERNAL_NOT_ALLOWED_FOR_DOCTYPE). A purchase invoice references the supplier's document with 14, 16 or 99 (REFERENCE_TIPO_DOC_NOT_ALLOWED_FOR_DOCTYPE), and 16 exactly when the supplier is a non-domiciled foreigner (05) (FEC_REFERENCE_TIPO_MISMATCH).
Example
14What kind of document it is when tipoDocIR is 99, emitted as <TipoDocRefOTRO>: required then, 5–100 characters (REFERENCE_TIPO_DOC_OTRO_REQUIRED).
Example
Recibo de compra de bien usadoExternal reference: the number of the document as its issuer gave it, emitted as <Numero>. Required when there is no invoiceId (REFERENCE_NUMERO_REQUIRED); with invoiceId the API writes that document's clave.
Example
REC-2026-0417External reference: when that document was issued, emitted as <FechaEmisionIR>. Required when there is no invoiceId (REFERENCE_FECHA_REQUIRED); it cannot fall after today in Costa Rica nor be more than 10 years old (REFERENCE_FECHA_INVALID). With tipoDocIR 13 it is the date of the fiscal period the income belongs to. For a provisional receipt (08) it is the date and time the receipt was issued, at most 30 days back (PROVISIONAL_FECHA_OUT_OF_RANGE): it counts as the emission date of the document that replaces it, which carries its own date of generation.
Example
2026-09-15T00:00:00-06:00What this document does to the one it references, emitted as <Codigo> (Anexo nota 9):
01: annuls it (anula). A credit note annuls a document that is not a credit note, and a debit note annuls a credit note (ANNUL_TARGET_INVALID); the note must equal the total of that document (ANNUL_AMOUNT_MISMATCH), only once (INVOICE_ALREADY_ANNULLED) and not after partial credits (ANNUL_AFTER_PARTIAL_CREDIT).02: corrects the amount (corrige monto).04: refers to another document.05: replaces a provisional receipt issued in contingency; only withtipoDocIR08, on an FE or TE withsituacion2.06: return of goods (devolución de mercancía).07: replaces an electronic document. On an FE, a TE or an FEE, it names, byinvoiceId, a document of ours annulled with01; the Anexo makes it mandatory on the document issued in place of an annulled one (REFERENCE_NOT_ANNULLED).08: endorsed invoice (factura endosada).09: financial credit note.10: financial debit note.11: non-domiciled supplier.12: financial credit note for an exoneration approved after the sale; credit notes only (REFERENCE_CODE_NOT_ALLOWED_FOR_DOCTYPE).13: annuls it because of a material error (anula por error material): the same rules as01, and a document annulled with one cannot be annulled with the other. Its effect is declared in the period of the annulled document, not in the note's; notes only.14: corrects the amount because of a material error (corrige monto por error material), declared in the period of the corrected document; notes only.15: replaces a document annulled with13(sustituye por error material); on an FE, a TE or an FEE the document must be annulled with13(REFERENCE_NOT_ANNULLED).16: replaces a document Hacienda rejected (sustituye comprobante rechazado); the referenced document must be rejected (REFERENCE_NOT_REJECTED).17: pays it (pago a comprobante electrónico); payment receipts (10) only.99: any other reason, described incodigoReferenciaOTRO.
13 to 17 are the codes Hacienda added on 2026-04-22, mandatory from 2026-11-01. A note cannot carry 15, 16 or 17, nor any other document 13 or 14 (REFERENCE_CODE_NOT_ALLOWED_FOR_DOCTYPE). A note with more than one reference must use 09 (credit note) or 10 (debit note) on all of them (REFERENCE_MULTIPLE_REQUIRES_FINANCIERA). Every credit note, and a debit note with 01 or 13, requires the invoices:void scope (INVOICE_REVERSAL_SCOPE_REQUIRED).
An FE, a TE or an FEE that replaces a document of ours (07, 15, 16) may replace an FE, a TE or an FEE (REFERENCE_TARGET_NOT_ALLOWED), and a document is replaced once: a live replacement, a draft included, blocks another (REFERENCE_ALREADY_SUBSTITUTED). The detail of a document says which code its replacement declares (substituteCode). A debit note cannot eliminate the annulment of a document that a live document replaces (ANNULMENT_HAS_SUBSTITUTE).
Example
01Description of the reason when codigo is 99, emitted as <CodigoReferenciaOTRO>: required then, 5–100 characters (REFERENCE_CODIGO_OTRO_REQUIRED).
Example
Motivo personalizado para la referenciaWhy this document references the other one, in free text (1–180 characters), emitted as <Razon>. Hacienda's schema marks it optional, but Hacienda rejects a reference without it (error -131).
Example
Anulación por error en datos del receptorA future instant (ISO 8601) at which the API signs the new draft and sends it to Hacienda by itself; a past instant is refused (SCHEDULED_SEND_IN_PAST). The sweep that sends it runs every 5 minutes. The same as creating the draft and then calling POST /v1/invoices/{id}/schedule-send.
Example
2026-07-03T20:00:00.000ZIds of the company's fixed email attachments to leave out of this document's email. A mandatory fixed attachment is always sent, and unknown ids are dropped; omitted, every fixed attachment is sent.
Example
[ "b0a1…", "c2d3…"]Your own identifier of the sale this document records (e.g. the uuid of a POS ticket), 1–128 characters, unique per company and environment with no time limit — unlike the 24-hour Idempotency-Key. Creating again with the same value answers 409 INVOICE_EXTERNAL_REFERENCE_EXISTS naming the existing invoice, so a retry never issues the sale twice; to issue it again on purpose (after a rejection), append an attempt suffix such as :2. Filter by it with GET /v1/invoices?externalReference=.
Example
0197fa2e-1111-7abc-8000-3f5de1a2b3c4Situation of the document, digit 42 of its clave:
1: normal. Use it also when Hacienda does not answer: the API keeps the document and delivers it later.2: contingency (contingencia): the electronic document that replaces a paper provisional receipt, handed out while the billing system could not be used — for a system in the cloud, also while the business had no internet. Only an FE or a TE (SITUACION_2_NOT_ALLOWED_FOR_DOCTYPE), and always with one reference to that receipt:tipoDocIR08,codigo05, its number and date (SITUACION_2_REQUIRES_PROVISIONAL_REFERENCE).3: no internet (sin internet): generated and signed at the moment of the sale by a system that could not reach the internet, and sent once it can. A system that signs in the cloud, as this API does, cannot generate a document without internet: it hands out a provisional receipt and uses2.
Only 3 accepts fechaEmision.
When a document with situacion 3 was generated and signed (ISO 8601): it sets the date in the clave and <FechaEmision> instead of the moment of signing here. Refused with any other situacion (FECHA_EMISION_REQUIRES_SITUACION): a document with 2 is generated now, and the date of the provisional receipt it replaces goes in its reference. Refused more than 30 days back or in the future (FECHA_EMISION_OUT_OF_RANGE).
Example
2026-07-12T19:30:00.000ZInternal note about the schedule. It is not copied into the invoices.
Example
Renovación automática del contrato de oficina.Responses
Section titled “Responses”Schedule created
object
Id of the schedule, used in the /v1/recurring-invoices/{id} routes.
Id of the company the schedule belongs to.
Environment the schedule was created in. Its invoices are issued in it, and it is only visible from it.
Lifecycle of the schedule:
active: the daily sweep creates each occurrence once its date comes.paused: no occurrence is created; resume it withPOST …/resumeor a PATCH. A schedule is also paused when an occurrence fails for good.completed: it reachedendDateormaxOccurrences; final.canceled: never returned — a canceled schedule is deleted, and the API answers 404 for it.
Label of the schedule.
Hacienda type of the invoices it creates, from template.docType: 01 (FE), 04 (TE), 08 (FEC) or 09 (FEE).
Unit of the cadence; see interval.
Every how many frequency units an invoice is created.
Day of the month of a monthly or yearly schedule: the one given, or the day of startDate. null for daily and weekly.
How monthly and yearly schedules pick the day (see ScheduleConfigDto); null when none was given, and then last_day_when_missing applies. Ignored for daily and weekly.
Day of the week of a weekly schedule, 0 Sunday to 6 Saturday: the one given, or the weekday of startDate. null for the other frequencies.
Anchor of the cadence (YYYY-MM-DD, a Costa Rica calendar day).
Last date an occurrence may fall on (inclusive); null without an end date.
Cap on the number of occurrences; null without one.
Occurrences processed so far: each one that created its invoice, and each one that failed for good. A transient failure is retried and does not count.
Date of the next occurrence (YYYY-MM-DD). The daily sweep (06:00 Costa Rica time) creates it once that date has come, while the schedule is active; a paused schedule keeps it, so it can lie in the past. null once the schedule is completed.
When the last occurrence was processed (its invoice created, or failed for good); null while none has been.
true: each invoice is signed and sent to Hacienda as soon as it is created; false: it is left as a draft for someone to review and send.
The invoice body every occurrence replays, as stored — the body of POST /v1/invoices. A template in a currency other than CRC takes the exchange rate of the day each invoice is created: a stored exchangeRate is not reused.
object
Type of document to issue (Anexo nota 3), also digits 9–10 of its consecutivo:
01: electronic invoice (factura electrónica, FE), to an identified receiver.02: debit note (nota de débito, ND), which adds to or corrects one of the company's accepted documents, named inreferences.03: credit note (nota de crédito, NC), which reduces, refunds or annuls one; it requires theinvoices:voidscope.04: electronic ticket (tiquete electrónico, TE); the receiver is optional.05,06,07: the receiver's messages accepting, partially accepting or rejecting a received document; send them withPOST /v1/documents/received/{id}/acceptance, not here.08: purchase invoice (factura electrónica de compra, FEC), which the company issues for what it buys from a supplier who does not issue one;receiveris then the SUPPLIER andreferencesnames the supplier's document.09: export invoice (factura electrónica de exportación, FEE); every line is exempt (IVA tariff code10).10: payment receipt (recibo electrónico de pago, REP), which records a payment of an accepted FE sold with sale condition08or10.
A receiver (receiver or receiverId) is required for 01, 08, 09 and 10 (RECEIVER_REQUIRED_FOR_DOCTYPE), except on a self-consumption invoice (selfConsumption), whose receiver is the company itself.
The other party, written in full: the customer, or on a purchase invoice (08) and a note over one, the SUPPLIER, who goes in the XML's <Emisor>. Use it or receiverId, never both (RECEIVER_BOTH_PROVIDED). Identification 05 (non-domiciled foreigner) is accepted on an FE only with sale condition 12 and never on a payment receipt; 06 (non-taxpayer) only as the supplier of a purchase invoice with sale condition 13. On a purchase invoice a 05 supplier needs otrasSenasExtranjero (SUPPLIER_FOREIGN_ADDRESS_REQUIRED), and any supplier but a 06 a location (SUPPLIER_LOCATION_REQUIRED).
object
Not used: ignored when a company is created, and kept as sent in the inline party of a document.
Hacienda identification type: 01 cédula física, 02 cédula jurídica, 03 DIMEX, 04 NITE, 05 foreign (extranjero no domiciliado), 06 no contribuyente. Only 01–04 with an all-digit number can issue documents, because the clave embeds it.
Number of that identification, without separators, normalized to uppercase. Its format depends on identificationType: 01 9 digits; 02 10 positions — from 2026-11-01 the last six may be alphanumeric (decree 44648-MJ), e.g. 3101A1B2C3, which can receive documents but not issue them; 03 11–12 digits; 04 10 digits; 05 up to 20 letters, digits or hyphens; 06 9–12 digits.
Legal name (razón social) — <Nombre> in the XML, cut to 100 characters. A company's name cannot change through PATCH /tenants/:id (400 IMMUTABLE_FIELD): POST /tenants/:id/hacienda-sync takes it from Hacienda's registry.
Trade name — <NombreComercial> in the XML when present, cut to 80 characters.
Only when creating a company: becomes its default economic activity, in Hacienda's dotted form (e.g. 6201.0). Ignored afterwards — activities are managed in /tenants/:tenantId/economic-activities — and in a document's inline party, whose activity is the document's economicActivityCodeReceptor.
Address in Costa Rica — <Ubicacion> in the XML. A company cannot issue without it (422 TENANT_LOCATION_MISSING). In a document it is never written for a 05 party; in a purchase invoice (FEC), a supplier of type 01–04 must carry it (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.
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 without "+" (1-3 digits).
National number, digits only (5-20).
Deprecated: a legacy single-string phone (+506 22223333). Send phoneCountryCode + phoneNumber instead; this one is only parsed for the XML when those are absent.
Email address — <CorreoElectronico> in the XML. For a company, its main address and where its notices go when notificationEmail is empty; for a document's customer, where the accepted document is emailed.
Company only: a separate address for the system's notices to it (rejections, errors, summaries…). Set it with PATCH /tenants/:id; "" or null clears it and the notices go back to email. Ignored on creation and in a document's party.
Address abroad, free text — <OtrasSenasExtranjero>, 5–300 characters in Hacienda's schema. Written only for a foreign (05) party, and required when that party is the supplier of a purchase invoice (400 SUPPLIER_FOREIGN_ADDRESS_REQUIRED).
Id of a contact saved in the company's directory (/v1/tenants/{tenantId}/parties), used instead of receiver; its data is copied into the document. It must be marked as a customer (PARTY_NOT_CUSTOMER), or as a supplier on a purchase invoice (08) and a note over one (PARTY_NOT_SUPPLIER).
Self-consumption (autoconsumo): the company declares goods or services it consumes itself, valued at their sale price, as an electronic invoice (01), and corrects one with a credit or debit note (03, 02) that carries it too (SELF_CONSUMPTION_NOT_ALLOWED_FOR_DOCTYPE otherwise). The API fills in the rest:
- the receiver is the company itself, from its profile; send neither
receivernorreceiverId(SELF_CONSUMPTION_RECEIVER_PROVIDED); - each line without a
transactionTypegets the self-consumption one:03taxed goods and02exempt goods (CAByS0to4),05taxed services and04exempt services (CAByS5to9), taxed meaning IVA at a rate above zero; - without
paymentMethods, the payment method is99(other) named «Autoconsumo». Hacienda requires one unless the sale is on credit (-517).
The detail of the invoice shows each line with its transactionType.
ISO 4217 currency of the whole document, emitted as <CodigoMoneda>: every amount in the request is in it. It must be enabled for the company (CURRENCY_NOT_ENABLED). A credit or debit note and a payment receipt use the currency of the document they reference (REFERENCE_CURRENCY_MISMATCH).
Colones per unit of currency (up to 5 decimals), emitted as <TipoCambio>; ignored for CRC, where the XML declares 1. A rate sent here always wins. Without one, a credit or debit note takes the rate of the document it references, and USD takes the Central Bank's (BCCR) rate of the day in Costa Rica (EXCHANGE_RATE_REQUIRED_BCCR_DOWN if it cannot be fetched); any other currency requires it (EXCHANGE_RATE_REQUIRED).
Terms of the sale, emitted as <CondicionVenta> (Anexo nota 5):
01: cash (contado).02: credit (crédito); requirescreditTermDays.03: consignment.04: layaway (apartado).05: lease with an option to buy.06: lease as financing (arrendamiento en función financiera).07: collection on behalf of a third party.08: services provided to the State on credit.09: payment of services provided to the State; payment receipts only, for an FE with08.10: sale on credit with IVA up to 90 days (LIVA art. 27); requirescreditTermDays.11: payment of such a sale; payment receipts only, for an FE with10.12: sale of goods not yet nationalized in Costa Rica (mercancía no nacionalizada); FE (and notes over one) only, and the one condition under which an FE accepts a non-domiciled receiver (05).13: sale of used goods by a non-taxpayer; used on a purchase invoice whose supplier is a non-taxpayer (06).14: operating lease (arrendamiento operativo), as the tax rules define it.15: financial lease (arrendamiento financiero), as the tax rules define it.99: any other condition, described incondicionVentaOtros.
At least one payment method is required except with 02, 08 and 10 (PAYMENT_METHOD_REQUIRED). A payment receipt (10) accepts only 09 and 11 (SALE_CONDITION_INVALID_FOR_REP), which no other document accepts (SALE_CONDITION_REP_ONLY); 12 is refused outside FE, NC and ND (SALE_CONDITION_FE_ONLY).
Description of the sale condition when saleCondition is 99, emitted as <CondicionVentaOtros>: required then, 5–100 characters (CONDICION_VENTA_OTROS_REQUIRED); ignored for any other condition.
Days the customer has to pay, emitted as <PlazoCredito>. Required with sale condition 02 or 10 (CREDIT_TERM_REQUIRED). A payment receipt (10) has no such element.
How the customer pays, each entry emitted as a <MedioPago>. At least one is required unless saleCondition is a credit code (02, 08 or 10) (PAYMENT_METHOD_REQUIRED); a payment receipt (10) therefore always carries one. With two or more, every entry needs its amount (PAYMENT_AMOUNT_REQUIRED) and the amounts must add up to the document total within 0.01 (PAYMENT_METHODS_SUM_MISMATCH).
object
How the customer pays, emitted as <TipoMedioPago> (Anexo nota 6):
01: cash.02: card.03: cheque.04: bank transfer or deposit.05: collected by a third party (recaudado por terceros): the payment is received by someone other than the seller, e.g. a phone bill paid at a supermarket.06: SINPE Móvil (Costa Rica's mobile payment system).07: digital platform.99: any other method, described inotherDescription.
Amount paid with this method, in the document currency (up to 5 decimals), emitted as <TotalMedioPago>. Required on every entry when there are two or more (PAYMENT_AMOUNT_REQUIRED), and then the amounts must add up to the document total within 0.01 (PAYMENT_METHODS_SUM_MISMATCH); with a single entry it is ignored.
Description of the payment method when type is 99, emitted as <MedioPagoOtros>: required then, 3–100 characters (PAYMENT_OTHER_DESCRIPTION_REQUIRED); ignored for any other type.
What the document sells, each line emitted as a <LineaDetalle> (Hacienda allows up to 1000). At least one is required (LINE_REQUIRED), except on a document whose only content is other charges of types 04, 08, 09 or 10 (OTHER_CHARGES_REQUIRES_LINE). On a payment receipt (10) each line is a payment towards the invoice it references.
object
Number of the line in the document, starting at 1, emitted as <NumeroLinea>; the lines are written to the XML in the order of this number.
13-digit CABYS code (Costa Rica's catalog of goods and services, published by the BCCR) of what the line sells, emitted as <CodigoCABYS>; Hacienda checks it against the catalog in force. Required on every document except a payment receipt (10), whose lines carry none (LINE_CABYS_REQUIRED). Its first digit also places the line among the services (5 to 9) or the goods (0 to 4) in the document totals.
Customs tariff heading of the goods (partida arancelaria), emitted as <PartidaArancelaria> and only on an export invoice (09). There it is required, with exactly 12 letters or digits, on every line whose CABYS code starts with 0 to 4, that is, goods (PARTIDA_ARANCELARIA_REQUIRED).
VIN or serial number of each vehicle, aircraft or vessel the line sells, one entry per unit, exactly 17 characters each (VIN_LENGTH); each is emitted as a <NumeroVINoSerie>. Hacienda asks for them when the CABYS code is a means of transport.
Ministry of Health registration number of the medicine the line sells, emitted as <RegistroMedicamento>. Hacienda asks for it when the CABYS code is a medicine with a sanitary registration.
Code of the medicine's pharmaceutical form from Hacienda's catalog (Anexo nota 19, «Código de forma farmacéutica»), emitted as <FormaFarmaceutica>; a code outside it is refused (PHARMACEUTICAL_FORM_INVALID). Like pharmacyRegistry, Hacienda asks for it on medicines with a sanitary registration.
Quantity sold, greater than 0, up to 3 decimals, emitted as <Cantidad>. A payment receipt (10) has no quantity in its XML: there quantity × unitPrice is the amount being paid, without tax.
Unit of measure, as a symbol from Hacienda's catalog (Anexo nota 15), emitted as <UnidadMedida>: for example Unid (unit), Kg (kilogram), L (litre), h (hour), Sp (professional services), St (technical services) or Os (other service). The symbols are case-sensitive; Hacienda checks them, the API does not. A payment receipt (10) does not use it.
Why the line is on the document (Anexo nota 22), emitted as <TipoTransaccion>. Omit it for a normal sale, which is how Hacienda reads a line without it:
01: normal sale of goods and services.02/03: the business consumes its own goods (autoconsumo), exempt / taxed.04/05: the business consumes its own services (autoconsumo), exempt / taxed.06/07: membership fee, taxed / exempt.08/09/10: capital goods for the issuer, for the receiver, or for both.11: capital goods withdrawn for the issuer's own use, exempt.12: capital goods transferred to third parties without consideration, exempt.13: goods withdrawn for own use or transferred to third parties without consideration.
Accepted on an invoice (01), a purchase invoice (08), an export invoice (09) and the credit and debit notes (03, 02); a ticket (04) and a payment receipt (10) have no such element (LINE_NOT_ALLOWED_FOR_DOCTYPE, reason transaction_type). The self-consumption of a business goes on an invoice to the business itself.
A type that names a tax condition must match the line: 02, 04, 07, 11 and 12 are exempt and carry no IVA at a positive rate, and 03 and 05 are taxed and carry one (LINE_TRANSACTION_TYPE_TAX_MISMATCH). A note that corrects such a line declares the same type, as the Anexo asks; POST /v1/invoices/{id}/credit-note copies it.
The business's own unit for the line, not a standard measure (a box, a pallet), emitted as <UnidadMedidaComercial> next to unitOfMeasure, which stays required. Up to 20 characters. A payment receipt (10) has no such element (LINE_NOT_ALLOWED_FOR_DOCTYPE, reason commercial_unit).
The product's own codes (the seller's SKU, the buyer's code, a GTIN…), each emitted as a <CodigoComercial>. tipo (Anexo nota 12): 01 seller's code, 02 buyer's code, 03 code assigned by the manufacturer (industrial or importer), 04 internal-use code, 99 other. A combo line (surtido) must carry one of type 03 with the package's SKU or GTIN (SURTIDO_COMMERCIAL_CODE_REQUIRED).
object
Who assigned the code (<CodigoComercial><Tipo>, Anexo nota 12):
01: the seller's product code.02: the buyer's product code.03: code assigned by the manufacturer (industrial or importer), such as a GTIN.04: internal-use code.99: other.
The code itself, 1–20 characters (<CodigoComercial><Codigo>).
What the line sells, as the document shows it, emitted as <Detalle> (Hacienda accepts 3–200 characters). On a payment receipt (10) it describes the payment of the original invoice and, per the Anexo, names at least the instalment.
Price of one unit before discounts and taxes, in the document currency (up to 5 decimals), emitted as <PrecioUnitario>. On a combo line (surtido) the API replaces it with the sum of the components' subtotals for one unit of the combo.
Discounts on the line, each emitted as a <Descuento> (Hacienda allows at most 5). They lower the line subtotal; codes 01, 02 and 03 cover the whole line and must be its only discount (LINE_DISCOUNT_FULL_EXCLUSIVE). Not accepted on a payment receipt (10) (LINE_NOT_ALLOWED_FOR_DOCTYPE).
object
Discount amount in the document currency (up to 5 decimals), emitted as <MontoDescuento>; Hacienda accepts at most the line's quantity × unitPrice. For codes 01, 02 and 03 it must equal quantity × unitPrice (LINE_DISCOUNT_FULL_REQUIRED).
Kind of discount, emitted as <CodigoDescuento> (Anexo nota 20):
01: gift (regalía). The whole line is given away; its IVA is computed on the grossquantity×unitPriceand assumed by the issuer (<ImpuestoAsumidoEmisorFabrica>), so the customer pays none of it.02: gift or bonus with the IVA charged to the customer (regalía o bonificación, IVA cobrado al cliente). The whole line; its IVA is computed on thesubtotal, which the discount leaves at 0, so on a line with no other tax the IVAmontois 0.03: bonus (bonificación). The whole line, with the IVA treatment of01.04: volume discount.05: seasonal discount.06: promotional discount.07: commercial discount.08: frequency discount.09: sustained discount.99: any other discount, described innaturaleza.
Codes 04 to 99 lower the subtotal and the IVA is computed on what remains. Codes 01, 02 and 03 must be the only discount of their line (LINE_DISCOUNT_FULL_EXCLUSIVE).
Description of the discount, emitted as <NaturalezaDescuento> (Hacienda accepts 3–80 characters). Required for code 99, with at least 5 characters (NATURALEZA_REQUIRED): for that code the same text is also emitted as <CodigoDescuentoOTRO>, which Hacienda demands.
quantity × unitPrice minus the line's discounts, in the document currency (up to 5 decimals), emitted as <SubTotal>. The API recomputes it and answers 422 INVOICE_TOTALS_MISMATCH when it differs by more than 0.005; on a combo line (surtido) it replaces it with the value derived from the components.
Taxes on the line, each emitted as an <Impuesto>. Hacienda requires at least one on every line (TAX_REQUIRED), and a code may appear only once per line (DUPLICATE_TAX_CODE). An exempt line still carries IVA (01) with tariff code 10 and a monto of 0. On a combo line (surtido) the API replaces them with the sum of the components' taxes.
object
Tax code, emitted as <Codigo> (Anexo nota 8):
01: IVA (value-added tax).02: selective consumption tax (impuesto selectivo de consumo).03: single tax on fuels.04: specific tax on alcoholic beverages.05: specific tax on packaged non-alcoholic beverages and toilet soaps.06: tax on tobacco products.07: IVA with a special calculation of its taxable base.08: IVA under the used-goods regime, computed withfactor.12: specific tax on cement.99: another tax.
Codes 02, 03, 04, 05, 06 and 12 are accepted only on documents in CRC (EXCISE_NOT_SUPPORTED_FOR_CURRENCY), and a payment receipt (10) accepts only the IVA codes 01, 07 and 08 (LINE_NOT_ALLOWED_FOR_DOCTYPE).
IVA tariff code, emitted as <CodigoTarifaIVA> (Anexo nota 8.1):
01: 0% rate of RLIVA art. 32.1, which keeps the full credit right (e.g. sales to the CCSS or to municipalities).02: reduced 1%.03: reduced 2%.04: reduced 4%.05: transitional 0%, for credit and debit notes only.06: transitional 4%, for credit and debit notes only.07: transitional 8%, for credit and debit notes only.08: general 13%.09: reduced 0.5%.10: exempt (Ley 9635, art. 8); the taxmontois then 0.11: 0% without credit right, to record a good or service not subject to IVA that grants no credit.
Hacienda requires it for tax codes 01 and 07. On an export invoice (09) every IVA tax must use 10 (LINE_NOT_ALLOWED_FOR_DOCTYPE, reason export_tariff).
Tax rate as a percentage (13 for 13%, 0.5 for 0.5%), emitted as <Tarifa>. With code 01 it must be the rate of codigoTarifa (Hacienda rejects a mismatch); for 02 and 99 it is the rate the applicable rule sets, and for 12 (cement) it is 5%. For code 08 the XML carries factor instead, and the per-unit codes 03 to 06 take their amount from datosEspecifico, not from this rate.
Factor set by the Ministry of Finance for IVA under the used-goods regime (code 08), as a decimal with up to 4 places, emitted as <FactorCalculoIVA> instead of <Tarifa>. Required for 08 (FACTOR_REQUIRED): the IVA is then the taxable base × this factor.
Amount of this tax in the document currency (up to 5 decimals), emitted as <Monto>: always the full tax, also when an exoneracion covers part of it. The API recomputes it and answers 422 INVOICE_TOTALS_MISMATCH when it differs by more than 0.005:
01and07: taxable base ×tarifa/ 100;08: taxable base ×factor. The base is the linesubtotalplus its taxes02,04,05and12, or the grossquantity×unitPricewhen the line has discount01or03.02and12:subtotal×tarifa/ 100.03to06: the formula ofdatosEspecifico.- Any other code is taken as sent.
The authorization that exonerates the customer from all or part of this tax, emitted as <Exoneracion> inside the tax. Use it on an IVA tax (01, 07 or 08), the only ones whose exoneration the line and document totals count; the tax monto stays the full tax and the exonerated share is declared in montoExoneracion. Not accepted on an export invoice (09) or a payment receipt (10) (LINE_NOT_ALLOWED_FOR_DOCTYPE).
object
Kind of document that grants the exoneration, emitted as <TipoDocumentoEX1> (Anexo nota 10.1):
01: purchases authorized by the Dirección General de Tributación (DGT).02: exempt sales to diplomats.03: authorized by a special law.04: Dirección General de Hacienda (DGH) exemption, generic local authorization.05: DGH exemption under Transitorio V (engineering, architecture, surveying and civil-works services).06: tourism services registered with the Costa Rican Tourism Institute (ICT).07: Transitorio XVII (collection, sorting and storage of recyclable and reusable materials).08: free-trade-zone exoneration (zona franca).09: services complementary to exports (RLIVA art. 11).10: municipal corporations (corporaciones municipales).11: DGH exemption, specific local-tax authorization.99: any other document, described intipoDocumentoOtro.
The Anexo reserves 01, 05, 06 and 07 for credit and debit notes.
What kind of document it is when tipoDocumento is 99, emitted as <TipoDocumentoOTRO>. Required for 99 (EXONERACION_TIPO_DOCUMENTO_OTRO_REQUIRED); Hacienda accepts 5–100 characters.
Number of the exoneration or authorization document, written exactly as the issuing institution printed it, hyphens included; emitted as <NumeroDocumento> (Hacienda accepts 3–40 characters). With tipoDocumento 02, 03 or 08 it is the number of the law that grants the exoneration. With 04 or 11 Hacienda checks it against the authorization it issued, which must be in force; GET /v1/hacienda/exoneracion/{autorizacion} reads an authorization of the AL-XXXXXXXX-XX form.
Article of the law that establishes the exoneration, emitted as <Articulo>. Hacienda requires it for tipoDocumento 02, 03, 06, 07 and 08; its schema types it as a whole number of up to 6 digits.
Subsection (inciso) of that article, when the article refers to one; emitted as <Inciso>. Hacienda's schema types it as a whole number of up to 6 digits.
Institution that issued the exoneration document, emitted as <NombreInstitucion> (Anexo nota 23):
01: Ministry of Finance (Ministerio de Hacienda).02: Ministry of Foreign Affairs and Worship.03: Ministry of Agriculture and Livestock.04: Ministry of Economy, Industry and Commerce.05: Costa Rican Red Cross.06: Costa Rica Fire Department (Benemérito Cuerpo de Bomberos).07: Asociación Obras del Espíritu Santo.08: Federación Cruzada Nacional de Protección al Anciano (Fecrunapa).09: Escuela de Agricultura de la Región Húmeda (EARTH).10: Instituto Centroamericano de Administración de Empresas (INCAE).11: Junta de Protección Social (JPS).12: Autoridad Reguladora de los Servicios Públicos (Aresep).99: another institution, named innombreInstitucionOtros.
Name of the issuing institution when nombreInstitucion is 99, emitted as <NombreInstitucionOtros>. Required for 99 (EXONERACION_NOMBRE_INSTITUCION_OTROS_REQUIRED); Hacienda accepts 5–160 characters.
When the exoneration document was issued: an ISO 8601 date-time, emitted as <FechaEmisionEX>. With tipoDocumento 04 or 11 Hacienda checks it against the authorization and rejects the document if it differs.
Percentage points of the tax that the exoneration covers, emitted as <TarifaExonerada>: 13 exonerates a 13% IVA in full, 4 leaves 9 points of it to pay. When it is lower than the tax's tarifa, only that share of the line's base is reported as exonerated and the rest as taxed. With tipoDocumento 04 or 11 Hacienda rejects a rate higher than the authorization grants.
Amount of tax the exoneration covers, in the document currency (up to 5 decimals), emitted as <MontoExoneracion>: the line's IVA base × tarifaExonerada / 100, never more than the tax's monto. It is subtracted from the line's net tax; send this exact figure, because the API derives the line total and the document totals from that same calculation.
Per-unit data of a specific tax, emitted as <DatosImpuestoEspecifico>. Required for codes 03, 04, 05 and 06 (SPECIFIC_TAX_DATA_REQUIRED) and ignored for the others. The API computes the tax monto from it with the Anexo formulas, quantity being the line's:
03:cantidadUnidadMedida×impuestoUnidad.04:quantity×proporcion×impuestoUnidad.05beverage:quantity×cantidadUnidadMedida×impuestoUnidad/volumenUnidadConsumo.05toilet soap:quantity×volumenUnidadConsumo×impuestoUnidad.06:quantity×cantidadUnidadMedida×impuestoUnidad.
Codes 03 to 06 are not accepted on a purchase invoice (08) or an export invoice (09), whose schemas have no place for this data (LINE_NOT_ALLOWED_FOR_DOCTYPE).
object
Quantity of the unit of measure the tax applies to, up to 2 decimals, emitted as <CantidadUnidadMedida>. Code 03 (fuel): the litres of fuel of the whole line (the tax is this × impuestoUnidad, not multiplied by the line quantity). Codes 04 and 05: the millilitres of the container sold. Code 06 (tobacco): the per-unit measure the tax is levied on (the tax is quantity × this × impuestoUnidad).
Alcohol by volume of the beverage, as a percentage (5 for 5%, up to 2 decimals), emitted as <Porcentaje>. Required for code 04 (SPECIFIC_TAX_FIELD_REQUIRED).
Code 04: millilitres of absolute alcohol per unit, porcentaje / 100 × cantidadUnidadMedida (up to 5 decimals), emitted as <Proporcion>. Hacienda requires it for 04; when it is omitted the API computes it.
Code 05: the reference volume in millilitres for a beverage, or the grams of toilet soap sold (up to 2 decimals), emitted as <VolumenUnidadConsumo>. Required for 05 (SPECIFIC_TAX_FIELD_REQUIRED).
Tax per unit of measure, as the law of each specific tax sets it (up to 5 decimals), emitted as <ImpuestoUnidad>: per litre for 03, per millilitre of absolute alcohol for 04, per reference volume for a 05 beverage, per gram for 05 soap and per unit of cantidadUnidadMedida for 06. In colones: the API accepts specific taxes only on documents in CRC.
Code 05 only: true when the product is toilet soap, so the tax is quantity × volumenUnidadConsumo × impuestoUnidad; otherwise the beverage formula, quantity × cantidadUnidadMedida × impuestoUnidad / volumenUnidadConsumo, applies. Not part of the XML: it only selects the formula.
Components of a combo, kit or assortment billed as one line (surtido), emitted as <DetalleSurtido>: 2 to 20 products with different CABYS codes (SURTIDO_MIN_COMPONENTS, SURTIDO_DUPLICATE_CABYS), each described for ONE unit of the combo. The API recomputes every amount of the components and of the line from the components' quantities, prices, discounts and taxes, overwriting what was sent. Not accepted on a purchase invoice (08) or a payment receipt (10) (SURTIDO_NOT_ALLOWED_FOR_DOCTYPE). The Anexo allows a combo to be billed this way only by its manufacturer or importer; anyone else lists its products as separate lines.
object
13-digit CABYS code of the component, emitted as <CodigoCABYSSurtido>; Hacienda checks it against the catalog in force. No two components of a combo may share one (SURTIDO_DUPLICATE_CABYS).
Optional codes of the component (the seller's SKU, a GTIN…), each emitted as a <CodigoComercialSurtido>, with the same tipo codes as the line's commercialCodes (at most 5).
object
Who assigned the code (<CodigoComercial><Tipo>, Anexo nota 12):
01: the seller's product code.02: the buyer's product code.03: code assigned by the manufacturer (industrial or importer), such as a GTIN.04: internal-use code.99: other.
The code itself, 1–20 characters (<CodigoComercial><Codigo>).
Quantity of this component in ONE unit of the combo (up to 3 decimals), emitted as <CantidadSurtido>; Hacienda requires it to be greater than 0.
Unit of measure of the component, a symbol from Hacienda's catalog (Anexo nota 15) such as Unid, like the line's unitOfMeasure; emitted as <UnidadMedidaSurtido>.
The business's own unit for the component, not a standard measure (e.g. a box or a pallet), emitted as <UnidadMedidaComercialSurtido>.
What the component is, emitted as <DetalleSurtido> (Hacienda accepts 3–200 characters).
Price of one unit of the component before discounts and taxes, in the document currency (up to 5 decimals), emitted as <PrecioUnitarioSurtido>; Hacienda requires it to be greater than 0. With cantidad, the discounts and the tax rates, it is what the API computes the combo from.
cantidad × precioUnitario, emitted as <MontoTotalSurtido>. The API recomputes it and overwrites what was sent.
Discounts on the component, each emitted as a <DescuentoSurtido> (at most 5). A combo's discounts go here: the API sets the line unitPrice to the sum of the components' subtotals, after these discounts.
object
Discount on the component for ONE unit of the combo, in the document currency (up to 5 decimals), emitted as <MontoDescuentoSurtido>; Hacienda accepts at most the component's montoTotal.
Kind of discount, from the same catalog as a line discount's codigoDescuento (Anexo nota 20): 01 gift (regalía), 02 gift or bonus with the IVA charged to the customer, 03 bonus (bonificación), 04 volume, 05 seasonal, 06 promotional, 07 commercial, 08 frequency, 09 sustained, 99 other; emitted as <CodigoDescuentoSurtido>. With 01 or 03 the IVA of the component is computed on its gross montoTotal and assumed by the issuer, and then every component of the combo must carry one of them (SURTIDO_BONIFICACION_ALL_OR_NONE).
Description of the discount when codigo is 99, emitted as <DescuentoSurtidoOtros>: required then, 3–80 characters (DESCUENTO_OTROS_REQUIRED).
montoTotal minus the component's discounts, emitted as <SubTotalSurtido>. The API recomputes it and overwrites what was sent.
Only for taxpayers that pay IVA at factory level (Anexo nota 21), emitted as <IVACobradoFabricaSurtido>:
01: sale of goods with IVA under the special system of IVA at factory level.02: exempt sale under that system (factory, wholesale and customs level), because the goods already bore the tax at factory level.
Not written on an export invoice (09).
IVA base of the component, emitted as <BaseImponibleSurtido> (not on an export invoice): its subtotal (its gross montoTotal when it carries discount 01 or 03) plus its taxes 02, 04 and 05. The API recomputes it and overwrites what was sent.
Taxes on the component, each emitted as an <ImpuestoSurtido>; Hacienda requires at least one. A combo may mix components with different IVA rates: the line's taxes are their sum per code and rate, × the line quantity.
object
Tax code of the component, from the same catalog as a line tax's codigo (Anexo nota 8): 01 IVA, 02 selective consumption tax, 04 alcoholic beverages, 05 packaged non-alcoholic beverages and toilet soaps, 06 tobacco, 07 IVA with a special base, 08 IVA on used goods, 99 other; emitted as <CodigoImpuestoSurtido>. The fuel (03) and cement (12) taxes are refused inside a combo (SURTIDO_EXCISE_NOT_ALLOWED).
IVA tariff code of the component, from the same catalog as a line tax's codigoTarifa (Anexo nota 8.1; e.g. 08 general 13%, 10 exempt), emitted as <CodigoTarifaIVASurtido>. Hacienda requires it with tax code 01.
Tax rate as a percentage (13 for 13%), emitted as <TarifaSurtido>; with code 01 it must be the rate of codigoTarifa. The API computes the amount of an IVA tax as baseImponible × this rate / 100.
Per-unit data of a specific tax (04, 05 or 06) on the component, emitted as <DatosImpuestoEspecificoSurtido>; Hacienda requires it for those codes. Same fields and formulas as a line tax's datosEspecifico, with the component's cantidad as the quantity.
object
Quantity of the unit of measure the tax applies to, up to 2 decimals, emitted as <CantidadUnidadMedida>. Code 03 (fuel): the litres of fuel of the whole line (the tax is this × impuestoUnidad, not multiplied by the line quantity). Codes 04 and 05: the millilitres of the container sold. Code 06 (tobacco): the per-unit measure the tax is levied on (the tax is quantity × this × impuestoUnidad).
Alcohol by volume of the beverage, as a percentage (5 for 5%, up to 2 decimals), emitted as <Porcentaje>. Required for code 04 (SPECIFIC_TAX_FIELD_REQUIRED).
Code 04: millilitres of absolute alcohol per unit, porcentaje / 100 × cantidadUnidadMedida (up to 5 decimals), emitted as <Proporcion>. Hacienda requires it for 04; when it is omitted the API computes it.
Code 05: the reference volume in millilitres for a beverage, or the grams of toilet soap sold (up to 2 decimals), emitted as <VolumenUnidadConsumo>. Required for 05 (SPECIFIC_TAX_FIELD_REQUIRED).
Tax per unit of measure, as the law of each specific tax sets it (up to 5 decimals), emitted as <ImpuestoUnidad>: per litre for 03, per millilitre of absolute alcohol for 04, per reference volume for a 05 beverage, per gram for 05 soap and per unit of cantidadUnidadMedida for 06. In colones: the API accepts specific taxes only on documents in CRC.
Code 05 only: true when the product is toilet soap, so the tax is quantity × volumenUnidadConsumo × impuestoUnidad; otherwise the beverage formula, quantity × cantidadUnidadMedida × impuestoUnidad / volumenUnidadConsumo, applies. Not part of the XML: it only selects the formula.
Amount of this tax for ONE unit of the combo, emitted as <MontoImpuestoSurtido>. The API recomputes it from the rate or from datosEspecifico and overwrites what was sent; the line's own taxes are the sum over the components × the line quantity.
Line total, emitted as <MontoTotalLinea>: the subtotal plus the net tax, which is the sum of the tax montos minus the tax the issuer assumes (the IVA of a line with discount 01 or 03, and the specific taxes 03, 04, 05 and 12) and minus the exonerated amounts. The API recomputes it and answers 422 INVOICE_TOTALS_MISMATCH when it differs by more than 0.005 (or the sum of all line totals by more than 0.01); on a combo line (surtido) it replaces it.
Charges that are not a sale of goods or services, such as the 10% service charge or an amount collected for a third party, each emitted as an <OtrosCargos>. They add to the document total (<TotalOtrosCargos>), never to its taxable or sales totals. Not accepted on a payment receipt (10) (OTHER_CHARGES_NOT_ALLOWED_FOR_DOCTYPE).
object
Kind of charge, emitted as <TipoDocumentoOC> (Anexo nota 16):
01: parafiscal levy (contribución parafiscal).02: Red Cross stamp (timbre de la Cruz Roja).03: Fire Department stamp (timbre del Benemérito Cuerpo de Bomberos).04: amount collected on behalf of a third party (cobro de un tercero).05: export costs.06: 10% service charge (impuesto de servicio), the usual restaurant surcharge.07: professional association stamp (timbre de colegios profesionales).08: security deposit.09: fine or penalty.10: late-payment interest (intereses moratorios).99: any other charge, described intipoDocumentoOtros.
A document may have no lines only when every charge uses 04, 08, 09 or 10; otherwise the API answers OTHER_CHARGES_REQUIRES_LINE.
What kind of charge it is when tipoDocumento is 99, emitted as <TipoDocumentoOTROS>. Required for 99 (5–100 characters, otherwise OTHER_CHARGES_TIPO_OTROS_REQUIRED); never emitted for any other code.
Identification type of the third party behind the charge, emitted as <IdentificacionTercero><Tipo>: 01 cédula física (individual), 02 cédula jurídica (legal entity), 03 DIMEX (foreign resident), 04 NITE (number issued by the tax administration), 05 non-domiciled foreigner, 06 non-taxpayer. The identification is emitted only when this and terceroIdentificationNumber are both present; Hacienda requires them, and nombreTercero, for code 04.
Identification number of the third party, emitted as <IdentificacionTercero><Numero>: 1–20 digits, no dashes (OTHER_CHARGES_TERCERO_NUMBER_INVALID otherwise). Required when terceroIdentificationType is set (OTHER_CHARGES_TERCERO_NUMBER_REQUIRED). For code 04 Hacienda checks its length against the type: 9 digits for a cédula física, 10 for a cédula jurídica or a NITE, 11 or 12 for a DIMEX.
Name or business name of the third party, emitted as <NombreTercero> (5–100 characters). Optional, except that Hacienda requires it for code 04.
Description of the charge as the document shows it, emitted as <Detalle>.
Percentage the charge was computed with, when it has one, emitted as <PorcentajeOC>: a percent written as a number (10 for 10%, 0.5 for 0.5%), zero or more, up to 5 decimals. Informational: the API does not recompute montoCargo from it.
Amount of the charge in the document currency, greater than zero, up to 5 decimals; emitted as <MontoCargo>. The charges add up to totals.totalOtrosCargos (<TotalOtrosCargos>), which is added to <TotalComprobante> and to none of the sales or tax subtotals.
Free-text remarks, emitted as <Otros><OtroTexto> and printed on the PDF from there. At most 500 characters (INVOICE_NOTES_TOO_LONG). Not accepted on a payment receipt (10), whose schema has no such element (NOTES_NOT_ALLOWED_FOR_DOCTYPE).
Code of the branch (sucursal) that issues the document, 1–3 digits, zero-padded (1 is 001): digits 1–3 of its consecutivo. It must be one of the company's branches; omitted, the default branch is used.
Code of the terminal (point of sale) within that branch, 1–5 digits, zero-padded: digits 4–8 of the consecutivo. It must exist in the branch; omitted, the branch's default terminal is used. Each branch, terminal and document type keeps its own numbering.
Economic activity, registered by the company with Hacienda, under which the document is issued, in its dotted form (6201.0); emitted as <CodigoActividadEmisor>. It must be one of the company's registered activities; omitted, its default activity is used. On a purchase invoice (08) and a note over one, where the company is the XML receiver, it is emitted as <CodigoActividadReceptor> instead, unless economicActivityCodeReceptor is sent. A payment receipt (10) carries no activity.
The receiver's economic activity for this purchase, in the same dotted form, emitted as <CodigoActividadReceptor>; Hacienda uses it when the receiver needs the document for a tax credit or a deductible expense. Not written on a ticket (04), an export invoice (09) or a payment receipt (10), whose schemas lack it. On a purchase invoice (08) it is the company's own activity for the purchase and defaults to economicActivityCode.
The documents this one refers to, each emitted as an <InformacionReferencia> (1 to 10). Required on a debit note (02), a credit note (03), a purchase invoice (08) and a payment receipt (10) (REFERENCES_REQUIRED); an FE with sale condition 12 to a non-domiciled receiver must name its supporting document (REFERENCE_REQUIRED_FOR_EXTRANJERO_FE); an FE or TE with situacion 2 names the provisional receipt it replaces (SITUACION_2_REQUIRES_PROVISIONAL_REFERENCE); an FE, a TE or an FEE may name, by invoiceId, the document of ours it replaces (07, 15, 16, see codigo); any other reference is refused (REFERENCES_FORBIDDEN). Notes and payment receipts name the company's own documents by invoiceId; a purchase invoice names the supplier's document with tipoDocIR, numero and fechaEmisionIR (or, by invoiceId, the earlier purchase invoice it replaces).
object
Internal reference: the id of one of the company's own documents in the same environment, already numbered. It is what a credit or debit note adjusts, what a payment receipt pays (an accepted FE) and the earlier purchase invoice an FEC replaces; notes and payment receipts accept only this form (REFERENCE_INVOICE_REQUIRED). The API writes that document's clave as <Numero>, its emission date as <FechaEmisionIR> and derives <TipoDocIR> from its type: FE → 01, ND → 02, NC → 03, TE → 04; over an FEC, a credit note declares 17, a debit note 18 and an FEC that replaces it 15; over an FEE, a note declares 19. Send it alone, without tipoDocIR, tipoDocRefOTRO, numero or fechaEmisionIR (REFERENCE_SHAPE_AMBIGUOUS).
External reference: the type of a document that is not one of the company's, emitted as <TipoDocIR> (Anexo nota 10). Required when there is no invoiceId; with invoiceId the API derives it. The accepted types:
05: dispatch note (nota de despacho).06: contract.07: procedure (procedimiento).08: document issued in contingency (comprobante emitido en contingencia): the paper provisional receipt an FE or TE withsituacion2replaces, always withcodigo05(PROVISIONAL_REFERENCE_INVALID).13: billing of the past month (facturación mes vencido), e.g. utilities billed in the first days of a month for income of the month before.14: document provided by a taxpayer under a special regime (comprobante aportado por contribuyente de régimen especial).16: document of a non-domiciled supplier (comprobante de proveedor no domiciliado); purchase invoices only.99: any other document, described intipoDocRefOTRO.
Only a purchase invoice (08), an FE with sale condition 12 and an FE or TE with situacion 2 (its provisional receipt, 08) accept external references (REFERENCE_EXTERNAL_NOT_ALLOWED_FOR_DOCTYPE). A purchase invoice references the supplier's document with 14, 16 or 99 (REFERENCE_TIPO_DOC_NOT_ALLOWED_FOR_DOCTYPE), and 16 exactly when the supplier is a non-domiciled foreigner (05) (FEC_REFERENCE_TIPO_MISMATCH).
What kind of document it is when tipoDocIR is 99, emitted as <TipoDocRefOTRO>: required then, 5–100 characters (REFERENCE_TIPO_DOC_OTRO_REQUIRED).
External reference: the number of the document as its issuer gave it, emitted as <Numero>. Required when there is no invoiceId (REFERENCE_NUMERO_REQUIRED); with invoiceId the API writes that document's clave.
External reference: when that document was issued, emitted as <FechaEmisionIR>. Required when there is no invoiceId (REFERENCE_FECHA_REQUIRED); it cannot fall after today in Costa Rica nor be more than 10 years old (REFERENCE_FECHA_INVALID). With tipoDocIR 13 it is the date of the fiscal period the income belongs to. For a provisional receipt (08) it is the date and time the receipt was issued, at most 30 days back (PROVISIONAL_FECHA_OUT_OF_RANGE): it counts as the emission date of the document that replaces it, which carries its own date of generation.
What this document does to the one it references, emitted as <Codigo> (Anexo nota 9):
01: annuls it (anula). A credit note annuls a document that is not a credit note, and a debit note annuls a credit note (ANNUL_TARGET_INVALID); the note must equal the total of that document (ANNUL_AMOUNT_MISMATCH), only once (INVOICE_ALREADY_ANNULLED) and not after partial credits (ANNUL_AFTER_PARTIAL_CREDIT).02: corrects the amount (corrige monto).04: refers to another document.05: replaces a provisional receipt issued in contingency; only withtipoDocIR08, on an FE or TE withsituacion2.06: return of goods (devolución de mercancía).07: replaces an electronic document. On an FE, a TE or an FEE, it names, byinvoiceId, a document of ours annulled with01; the Anexo makes it mandatory on the document issued in place of an annulled one (REFERENCE_NOT_ANNULLED).08: endorsed invoice (factura endosada).09: financial credit note.10: financial debit note.11: non-domiciled supplier.12: financial credit note for an exoneration approved after the sale; credit notes only (REFERENCE_CODE_NOT_ALLOWED_FOR_DOCTYPE).13: annuls it because of a material error (anula por error material): the same rules as01, and a document annulled with one cannot be annulled with the other. Its effect is declared in the period of the annulled document, not in the note's; notes only.14: corrects the amount because of a material error (corrige monto por error material), declared in the period of the corrected document; notes only.15: replaces a document annulled with13(sustituye por error material); on an FE, a TE or an FEE the document must be annulled with13(REFERENCE_NOT_ANNULLED).16: replaces a document Hacienda rejected (sustituye comprobante rechazado); the referenced document must be rejected (REFERENCE_NOT_REJECTED).17: pays it (pago a comprobante electrónico); payment receipts (10) only.99: any other reason, described incodigoReferenciaOTRO.
13 to 17 are the codes Hacienda added on 2026-04-22, mandatory from 2026-11-01. A note cannot carry 15, 16 or 17, nor any other document 13 or 14 (REFERENCE_CODE_NOT_ALLOWED_FOR_DOCTYPE). A note with more than one reference must use 09 (credit note) or 10 (debit note) on all of them (REFERENCE_MULTIPLE_REQUIRES_FINANCIERA). Every credit note, and a debit note with 01 or 13, requires the invoices:void scope (INVOICE_REVERSAL_SCOPE_REQUIRED).
An FE, a TE or an FEE that replaces a document of ours (07, 15, 16) may replace an FE, a TE or an FEE (REFERENCE_TARGET_NOT_ALLOWED), and a document is replaced once: a live replacement, a draft included, blocks another (REFERENCE_ALREADY_SUBSTITUTED). The detail of a document says which code its replacement declares (substituteCode). A debit note cannot eliminate the annulment of a document that a live document replaces (ANNULMENT_HAS_SUBSTITUTE).
Description of the reason when codigo is 99, emitted as <CodigoReferenciaOTRO>: required then, 5–100 characters (REFERENCE_CODIGO_OTRO_REQUIRED).
Why this document references the other one, in free text (1–180 characters), emitted as <Razon>. Hacienda's schema marks it optional, but Hacienda rejects a reference without it (error -131).
A future instant (ISO 8601) at which the API signs the new draft and sends it to Hacienda by itself; a past instant is refused (SCHEDULED_SEND_IN_PAST). The sweep that sends it runs every 5 minutes. The same as creating the draft and then calling POST /v1/invoices/{id}/schedule-send.
Ids of the company's fixed email attachments to leave out of this document's email. A mandatory fixed attachment is always sent, and unknown ids are dropped; omitted, every fixed attachment is sent.
Your own identifier of the sale this document records (e.g. the uuid of a POS ticket), 1–128 characters, unique per company and environment with no time limit — unlike the 24-hour Idempotency-Key. Creating again with the same value answers 409 INVOICE_EXTERNAL_REFERENCE_EXISTS naming the existing invoice, so a retry never issues the sale twice; to issue it again on purpose (after a rejection), append an attempt suffix such as :2. Filter by it with GET /v1/invoices?externalReference=.
Situation of the document, digit 42 of its clave:
1: normal. Use it also when Hacienda does not answer: the API keeps the document and delivers it later.2: contingency (contingencia): the electronic document that replaces a paper provisional receipt, handed out while the billing system could not be used — for a system in the cloud, also while the business had no internet. Only an FE or a TE (SITUACION_2_NOT_ALLOWED_FOR_DOCTYPE), and always with one reference to that receipt:tipoDocIR08,codigo05, its number and date (SITUACION_2_REQUIRES_PROVISIONAL_REFERENCE).3: no internet (sin internet): generated and signed at the moment of the sale by a system that could not reach the internet, and sent once it can. A system that signs in the cloud, as this API does, cannot generate a document without internet: it hands out a provisional receipt and uses2.
Only 3 accepts fechaEmision.
When a document with situacion 3 was generated and signed (ISO 8601): it sets the date in the clave and <FechaEmision> instead of the moment of signing here. Refused with any other situacion (FECHA_EMISION_REQUIRES_SITUACION): a document with 2 is generated now, and the date of the provisional receipt it replaces goes in its reference. Refused more than 30 days back or in the future (FECHA_EMISION_OUT_OF_RANGE).
Internal note about the schedule; null when none. Not copied into the invoices.
When the schedule was created (ISO 8601 instant).
When the schedule last changed (ISO 8601 instant): an edit, a pause or resume, or a processed occurrence.
Example
{ "environment": "sandbox", "status": "active", "name": "Renta oficina — mensual", "docType": "01", "frequency": "daily", "interval": 1, "dayOfMonth": 15, "endOfMonthRule": "last_day_when_missing", "weekday": 1, "startDate": "2026-06-01", "endDate": "2027-06-01", "maxOccurrences": 12, "occurrenceCount": 3, "nextRunDate": "2026-11-01", "template": { "docType": "01", "receiver": { "id": "01a00c73-5c09-7bb5-8b9e-d91c43bd61dc", "identificationType": "01", "identificationNumber": "3101234567", "name": "Futurabyte CR S.A.", "commercialName": "Futurabyte", "economicActivityCode": "6201.0", "location": { "provincia": "1", "canton": "01", "distrito": "01", "barrio": "Carmen", "otrasSenas": "50 metros norte de la iglesia, edificio azul" }, "phoneCountryCode": "506", "phoneNumber": "22223333", "phone": "50622223333", "email": "ventas@emite.cr", "notificationEmail": "notificaciones@emite.cr", "otrasSenasExtranjero": "1234 Ocean Ave, Miami, FL 33101, USA" }, "receiverId": "01a00c73-5c07-7bb5-8b9e-d20f16537e42", "selfConsumption": true, "currency": "AED", "exchangeRate": 540, "saleCondition": "01", "condicionVentaOtros": "Permuta de activos", "creditTermDays": 30, "paymentMethods": [ { "type": "01", "amount": 12500, "otherDescription": "Crypto — USDT TRC-20" } ], "lines": [ { "lineNumber": 1, "code": "8399000000000", "partidaArancelaria": "850431200090", "vinNumbers": [ "1HGCM82633A004352" ], "pharmacyRegistry": "CR-MED-2024-1234", "pharmaceuticalForm": "01", "quantity": 1, "unitOfMeasure": "Unid", "transactionType": "01", "commercialUnitOfMeasure": "Caja de 12", "commercialCodes": [ { "tipo": "01", "codigo": "SKU-IMP-350" } ], "description": "Servicio de consultoría TI — bloque mensual", "unitPrice": 10000, "discounts": [ { "monto": 500, "codigoDescuento": "01", "naturaleza": "Descuento por volumen" } ], "subtotal": 10000, "taxes": [ { "codigo": "01", "codigoTarifa": "01", "tarifa": 13, "factor": 0.13, "monto": 1300, "exoneracion": { "tipoDocumento": "01", "tipoDocumentoOtro": "Resolución especial 2024-001", "numeroDocumento": "AL-001-2024", "articulo": "15", "inciso": "a", "nombreInstitucion": "01", "nombreInstitucionOtros": "Caja Costarricense de Seguro Social", "fechaEmision": "2024-01-15T10:00:00-06:00", "tarifaExonerada": 13, "montoExoneracion": 1300 }, "datosEspecifico": { "cantidadUnidadMedida": 355, "porcentaje": 5, "proporcion": 17.75, "volumenUnidadConsumo": 355, "impuestoUnidad": 18.5, "esJabonTocador": false } } ], "surtido": [ { "cabysCode": "2310100000000", "commercialCodes": [ { "tipo": "01", "codigo": "SKU-IMP-350" } ], "cantidad": 1, "unidadMedida": "Unid", "unidadMedidaComercial": "Caja", "detalle": "Arroz 1kg", "precioUnitario": 1000, "montoTotal": 1000, "discounts": [ { "monto": 100, "codigo": "01", "otros": "Descuento de temporada" } ], "subtotal": 1000, "ivaCobradoFabrica": "01", "baseImponible": 1000, "taxes": [ { "codigo": "01", "codigoTarifa": "08", "tarifa": 13, "datosEspecifico": { "cantidadUnidadMedida": 355, "porcentaje": 5, "proporcion": 17.75, "volumenUnidadConsumo": 355, "impuestoUnidad": 18.5, "esJabonTocador": false }, "monto": 130 } ] } ], "total": 11300 } ], "otherCharges": [ { "tipoDocumento": "01", "tipoDocumentoOtros": "Cargo por embalaje especial", "terceroIdentificationType": "01", "terceroIdentificationNumber": "3101234567", "nombreTercero": "Cruz Roja Costarricense", "detalle": "Impuesto de servicio 10% sobre subtotal de servicios", "porcentajeOc": 10, "montoCargo": 5000 } ], "notes": "Pago a 30 días — gracias por su compra.", "branchCode": "001", "terminalCode": "00001", "economicActivityCode": "6201.0", "economicActivityCodeReceptor": "6201.0", "references": [ { "invoiceId": "01a00c73-5c07-7bb5-8b9e-d20f16537e42", "tipoDocIR": "05", "tipoDocRefOTRO": "Recibo de compra de bien usado", "numero": "REC-2026-0417", "fechaEmisionIR": "2026-09-15T00:00:00-06:00", "codigo": "01", "codigoReferenciaOTRO": "Motivo personalizado para la referencia", "razon": "Anulación por error en datos del receptor" } ], "scheduledSendAt": "2026-07-03T20:00:00.000Z", "omittedFixedAttachmentIds": [ "b0a1…", "c2d3…" ], "externalReference": "0197fa2e-1111-7abc-8000-3f5de1a2b3c4", "situacion": 1, "fechaEmision": "2026-07-12T19:30:00.000Z" }}Missing or invalid JWT / API key