Skip to content

Overview

EmiteCR is a multi-tenant electronic-invoicing platform for Costa Rica, built to Hacienda’s v4.4 specification. The API was designed API-first; the web app is one of many possible clients, and so is your product.

https://api.emite.cr/v1

Sandbox and production share it: the API key decides the environment (ec_test_… or ec_live_…).

Endpoints in these docs are written with their version prefix: POST /v1/invoices is a POST to https://api.emite.cr/v1/invoices. Requests and responses are JSON unless noted (PDF/XML downloads return binary; credential/logo uploads use multipart/form-data).

Issuing a document is three steps, and the API exposes each one:

  1. POST /v1/invoices — persist a draft. It has no clave nor consecutivo yet: fiscal numbers are never spent on a draft.
  2. POST /v1/invoices/:id/sign — allocate the consecutivo and the 50-digit clave, and XAdES-sign the XML with the company’s .p12. No call to Hacienda, so the number comes back fast.
  3. POST /v1/hacienda/submit/:id — send the signed XML to Hacienda’s ATV (signing first if step 2 was skipped).

Hacienda then processes asynchronously: the submit response means “ATV received it”, not “accepted”. The document later reaches a final state (accepted / rejected) which you learn about by polling or webhooks.

The quickstart walks the whole path with curl; Create an invoice has the full payload.

  • Success — the resource directly (InvoiceResponseDto, PartyDto, …); no envelope. Lists return { items, total, page, pageSize }.
  • Error — a structured envelope:
{
"error": {
"code": "RECEIVER_REQUIRED_FOR_FE",
"messageKey": "errors.RECEIVER_REQUIRED_FOR_FE",
"message": "A receiver is required for Factura Electrónica."
},
"requestId": "5f8a…",
"timestamp": "2026-05-13T12:00:00.000Z",
"path": "/v1/invoices"
}

Branch on error.code — it’s the canonical, stable identifier. Some errors add params (values for the message, such as the missing scope) or details (the fields that failed validation). The main codes, by area, are in the error reference.

Many field names are Hacienda’s own terms, in Spanish: clave, consecutivo, and in a line’s taxes codigo, codigoTarifa, tarifa and monto. They are domain terms, not UI labels, and they stay Spanish even in this English documentation. Other fields carry an English name for an XSD concept — saleCondition (CondicionVenta), paymentMethods (MedioPago), exchangeRate (TipoCambio) — so take each name from the API reference, not from the XSD. Payloads never get “translated”.