Skip to content

Error codes

Every error carries a stable, machine-readable code plus a localized messageKey. The response shape:

{
"error": {
"code": "LINE_DISCOUNT_FULL_REQUIRED",
"messageKey": "errors.LINE_DISCOUNT_FULL_REQUIRED",
"message": "Royalty/Bonus discounts must equal 100% of the line total.",
"params": { "lineNumber": 2 },
"details": { "fields": [] },
"retryAfterSeconds": 60
},
"requestId": "5f8a-…",
"timestamp": "2026-05-13T12:00:00Z",
"path": "/v1/invoices"
}
  • code — the canonical identifier. Branch on this; it’s stable across i18n changes.
  • messageKey — the errors.<CODE> i18n key.
  • message — debug-only fallback. Don’t render it to end users.
  • params — values that complete the error (the missing scope, the amount available…). Present only when the error has them.
  • details — for VALIDATION_ERROR, details.fields[] names each field that failed and why.
  • retryAfterSeconds — on some 429s. Most carry the wait in the Retry-After header and/or params.retryAfterSeconds instead.

Quote the requestId when you report a problem: it finds the request in EmiteCR’s logs.

The tables below list the main codes, not every one the API can return: branch on the codes you handle, and treat any other by its HTTP status.

Code Status When Recover
CABYS_INVALID 400 code isn’t exactly 13 digits Use a valid CAByS (GET /v1/cabys/search)
TAX_REQUIRED 400 Line has no tax entries Add ≥1 <Impuesto> (IVA at 0% for exento)
SPECIFIC_TAX_DATA_REQUIRED 400 An excise tax 03, 04, 05 or 06 without datosEspecifico Send its per-unit data — see Excise taxes
SPECIFIC_TAX_FIELD_REQUIRED 400 datosEspecifico without the field its code needs: porcentaje on 04, volumenUnidadConsumo on 05 Send that field
TOO_LONG 400 Free-text field exceeded its XSD max length Truncate the field
POSITIVE_REQUIRED 400 quantity or unitPrice ≤ 0 Pass strictly positive values
NATURALEZA_REQUIRED 400 Discount codigoDescuento: '99' without naturaleza Provide naturaleza (5–80 chars)
LINE_DISCOUNT_FULL_REQUIRED 400 A 01/02/03 discount ≠ qty × unitPrice Set monto = qty × unitPrice
LINE_DISCOUNT_FULL_EXCLUSIVE 400 A 01/02/03 discount combined with another Make it the only discount on the line
EXONERACION_TIPO_DOCUMENTO_OTRO_REQUIRED 400 tipoDocumento: '99' without tipoDocumentoOtro Provide the description
EXONERACION_NOMBRE_INSTITUCION_OTROS_REQUIRED 400 nombreInstitucion: '99' without nombreInstitucionOtros Provide the description
PAYMENT_METHOD_REQUIRED 400 No payment method on a non-credit sale condition Send ≥1. Only saleCondition 02, 08, 10 may omit it (Hacienda -517)
PAYMENT_METHODS_MAX_EXCEEDED 400 More than 4 payment methods ≤4
PAYMENT_OTHER_DESCRIPTION_REQUIRED 400 type: '99' without otherDescription Provide it (3–100 chars)
PAYMENT_AMOUNT_REQUIRED 400 Multi-method invoice missing an amount Every entry needs amount > 0
PAYMENT_METHODS_SUM_MISMATCH 400 Σ amounts ≠ totalComprobante (±0.01) Make the amounts sum to the total
RECEIVER_REQUIRED_FOR_FE 400 FE without receiver/receiverId FE always needs a receiver; TE doesn’t
RECEIVER_BOTH_PROVIDED 400 Both receiver and receiverId Pick one
CREDIT_TERM_REQUIRED 400 saleCondition: '02' without creditTermDays Pass creditTermDays (1–365)
EXCHANGE_RATE_REQUIRED 400 Non-CRC, non-USD without exchangeRate Pass exchangeRate, or use USD
PARTIDA_ARANCELARIA_REQUIRED 400 Export invoice (09) line for goods (CAByS starting 0–4) without a 12-character partidaArancelaria Send the customs tariff heading
LINE_NOT_ALLOWED_FOR_DOCTYPE 400 A line that document type’s schema can’t express — params.reason: exoneration, no_iva, excise_data, assumed_tax, surtido, discount, non_iva_tax, export_tariff, transaction_type or commercial_unit (e.g. an exoneración on an export invoice, any IVA tariff other than the exempt 10 on an export line, a transaction type on a ticket, or a discount on a payment receipt line) See Document types
LINE_TRANSACTION_TYPE_TAX_MISMATCH 400 A transactionType that says exempt on a line with IVA, or taxed on a line without IVA (params.expected: exempt or taxed) Fix the line’s IVA or its transaction type; see Transaction type and self-consumption
SELF_CONSUMPTION_RECEIVER_PROVIDED 400 A self-consumption invoice (selfConsumption: true) with a receiver or receiverId: its receiver is the company itself Drop the receiver; the API writes it
SELF_CONSUMPTION_NOT_ALLOWED_FOR_DOCTYPE 400 selfConsumption: true on a document that is not an electronic invoice nor a credit or debit note Declare self-consumption on an electronic invoice (01)
TRANSACTION_TYPE_INVALID 400 A transactionType outside Anexo nota 22 Use a code from 01 to 13
LINE_CABYS_REQUIRED 400 A line without code (CAByS) on any document but the REP, whose lines name a payment Send the 13-digit CAByS code
INVOICE_NOTES_TOO_LONG 400 notes longer than 500 characters, what <OtroTexto> holds Shorten the text
NOTES_NOT_ALLOWED_FOR_DOCTYPE 400 notes on a REP, whose schema has no <Otros> Send the REP without notes
REFERENCE_INVOICE_REQUIRED 400 A note (NC/ND) or a REP with a reference that has no invoiceId Reference the document of yours by invoiceId
REFERENCE_EXTERNAL_NOT_ALLOWED_FOR_DOCTYPE 400 An external reference (tipoDocIR + numero + fechaEmisionIR) on a document that carries none — only the FEC and an FE with sale condition 12 do Drop it, or use invoiceId
REFERENCE_TIPO_DOC_NOT_ALLOWED_FOR_DOCTYPE 400 An FEC’s supplier document with a type other than 14, 16 or 99 Use one of those; 99 needs tipoDocRefOTRO
REFERENCE_FECHA_INVALID 400 An external reference dated in the future or more than 10 years ago Send the document’s real date
FEC_REFERENCE_MUST_BE_FEC 400 An FEC referencing, by invoiceId, a document of yours that is not a previous FEC it replaces Describe the supplier’s document, or reference a previous FEC
REFERENCE_TARGET_NOT_ALLOWED 400 The document referenced by invoiceId has no nota 10 code for this type of document (for example, a note over a REP); params: docType, targetDocType Adjust the invoice the receipt pays, not the receipt
FEC_REFERENCE_TIPO_MISMATCH 400 A 05 (non-domiciled) supplier without a 16 document, or a 16 document on another supplier Match the type to the supplier: 05 ⇔ 16
SUPPLIER_FOREIGN_ADDRESS_REQUIRED 400 An FEC whose 05 supplier has no otrasSenasExtranjero (5–300 chars) Complete the supplier’s address abroad
SUPPLIER_LOCATION_REQUIRED 400 An FEC whose inscribed (01–04) supplier has no location Complete the supplier’s provincia/cantón/distrito
SUPPLIER_NO_CONTRIBUYENTE_REQUIRES_CC_13 400 An FEC whose 06 (no contribuyente) supplier is not under sale condition 13 (used goods) Use saleCondition: '13'
REP_RECEIVER_MISMATCH 400 A REP whose receptor is not the receptor of the invoice it pays Send the invoice’s receptor
PARTY_NOT_CUSTOMER 400 A receiverId party not flagged as a customer, on a document whose receptor is a customer Flag the party as a customer, or pick another
PARTY_NOT_SUPPLIER 400 A receiverId party not flagged as a supplier, on an FEC or on a note over an FEC (their “receiver” is the supplier) Flag the party as a supplier, or pick another
REP_EXCEEDS_INVOICE 422 The payment receipts over an invoice (drafts included) plus this one would exceed its total (total, paid, available, requested) Collect at most available
RECEIVER_PARTY_NOT_FOUND 404 The receiverId contact does not exist in the company Use the id of one of the company’s contacts
BRANCH_NOT_FOUND 404 No branch has that branchCode Use the code of one of the company’s branches
TERMINAL_NOT_FOUND 404 No terminal of that branch has that terminalCode Use the code of a terminal of that branch
ECONOMIC_ACTIVITY_NOT_REGISTERED 404 The economicActivityCode is not a registered activity of the company Register it first, or use a registered one
VALIDATION_ERROR 400 Generic validation failure — including a field the endpoint doesn’t define Inspect details.fields[]
Code Status Params When Recover
INVOICE_TOTALS_MISMATCH 422 lineNumber, field, expected, received A line/invoice total ≠ the server recomputation Recompute with the rules in Create an invoice
Code Status When Recover
CURRENCY_INVALID 400 Not an ISO 4217 code Use a valid code
CURRENCY_NOT_ENABLED 400 Currency not enabled on the tenant Enable it in settings first
CURRENCY_HAS_DRAFTS 409 Disabling a currency with draft invoices Resolve the drafts first
SURTIDO_COMPONENT_CURRENCY_MISMATCH 400 Surtido components don’t share the same currency coverage Price every component in the same set of currencies
SURTIDO_PRICE_DERIVED 422 Direct price write on a surtido variant — the price derives from the composition Update the surtido’s components instead
REFERENCE_CURRENCY_MISMATCH 400 NC/ND (or REP) currency differs from the referenced document’s Use the reference’s currency; its exchange rate is inherited unless you send one
EXCISE_NOT_SUPPORTED_FOR_CURRENCY 422 Excise tax on a non-CRC line Issue in CRC, or remove the excise

See Notas de Crédito / Débito for the rules.

Code Status When Recover
INVOICE_REVERSAL_SCOPE_REQUIRED 403 A credit note, or a note that annuls (code 01 or 13), from a caller without invoices:void Use a key or role that holds invoices:void (admin, owner; not issuer)
REFERENCE_CODE_NOT_ALLOWED_FOR_DOCTYPE 400 A reference code that document cannot carry (params: docType, codigo, reason, index): 17 outside a payment receipt, 12 outside a credit note, 13 or 14 outside a note, 15 or 16 on a note Use the code that fits the document
REFERENCE_NOT_REJECTED 422 Code 16 (replaces a rejected document) over a document Hacienda did not reject (params.status) Use 07 or 15, depending on how the earlier one was annulled
REFERENCE_NOT_ANNULLED 422 An invoice, a ticket or an export invoice with 07 or 15 over a document not annulled with 01 or with 13, respectively (params: codigo, annulmentCodigo, expected, the code that does fit, or none) Use params.expected; if it is none, annul the document with a credit note first
REFERENCE_ALREADY_SUBSTITUTED 409 Another document, a draft or issued, already replaces that one (params.substituteInvoiceId) A document is replaced once: correct the replacement with a note, or replace it instead
ANNULMENT_HAS_SUBSTITUTE 409 A debit note that eliminates the annulment of a document another one already replaces (params.substituteInvoiceId) Annul the document that replaces it first
CREDIT_NOTE_CODIGO_INVALID 400 POST /v1/invoices/:id/credit-note with a codigo other than 01 or 13 Leave codigo out (it is 01) or send 13
REFERENCE_NOT_ACCEPTED 422 The referenced document is not accepted by Hacienda (draft, pending, rejected) Wait for the verdict; a rejected document is replaced, not adjusted
REFERENCE_INVOICE_NOT_FOUND 404 The referenced document does not exist in this environment Use the id of a document of the same environment: a sandbox one is not referenced from production
REFERENCE_MULTIPLE_REQUIRES_FINANCIERA 400 More than one reference without code 09 (NC) / 10 (ND) on every one — Hacienda -451 Use the financial code, or issue one note per document
REFERENCE_DUPLICATED 400 The same document appears twice in the references Reference it once
ANNUL_TARGET_INVALID 400 An NC annulling an NC, or an ND annulling anything but an NC Eliminate a credit note with a debit note (01)
REFERENCE_RECEIVER_MISMATCH 400 The note’s receptor differs from the referenced document’s Issue the note to the same receptor
ANNUL_AMOUNT_MISMATCH 422 An annulment whose total is not exactly the document’s Copy the document’s lines
INVOICE_ALREADY_ANNULLED 409 The document already has an annulment in force Nothing to do — or eliminate that annulment with a debit note first
ANNUL_AFTER_PARTIAL_CREDIT 409 Annulling a document that already has partial credit notes Credit what is left (params.available) with another code
CREDIT_EXCEEDS_AVAILABLE 422 Credit notes over the document would add up to more than its total Credit at most params.available
Code Status When Recover
IDEMPOTENCY_KEY_REUSED_DIFFERENT_PAYLOAD 422 Same key, changed payload (or another endpoint) Rotate the key
IDEMPOTENCY_REQUEST_IN_PROGRESS 409 Concurrent retry mid-flight Wait 1–2s, retry
INVOICE_EXTERNAL_REFERENCE_EXISTS 409 externalReference already used The named invoice exists — resume, or use a :2 suffix
Code Status When Recover
INVOICE_ENVIRONMENT_MISMATCH 409 Signing or submitting a document of the other environment (params.invoiceEnvironment) Use a key of the document’s environment
ASYNC_SUBMIT_PARTNER_ONLY 403 ?submit=async with a key that a partner didn’t mint Sign, then call POST /v1/hacienda/submit/:id yourself — see Two-phase emit
INVALID_SUBMIT_MODE 400 ?submit= with a value other than async Omit it, or send async
ISSUER_ALPHANUMERIC_ID_UNSUPPORTED 422 Signing a document that has no number yet for a company whose identification does not fit the clave’s 12 issuer positions (params.identificationNumber). An alphanumeric cédula jurídica fits since the Anexo of 22 April 2026. Nothing is numbered Fix the company’s identification; a partner sees it beforehand in readiness.issuerIdSupported
ACCEPTANCE_ALPHANUMERIC_ID_UNSUPPORTED 422 Answering a received document with a MensajeReceptor as a company with an alphanumeric cédula jurídica (params.identificationNumber): the XSD’s NumeroCedulaReceptor still takes digits only. Nothing is numbered Don’t retry. Without an answer, the purchase is presumed accepted once the deadline passes
Code Status When Recover
XML_GENERATION_FAILED 400 XML couldn’t be built Fix the persisted invoice
XML_VALIDATION_FAILED 400 Generated XML failed XSD Usually a bug — report the requestId
CERTIFICATE_INVALID 400 .p12 malformed or wrong PIN Re-upload credentials
TOKEN_REQUEST_FAILED 424/502 424: Hacienda’s IdP refused the stored ATV credentials (its own OAuth verdict). The document keeps its number and waits signed; the credentials are marked and no further login attempt is made with them — retrying gets the same answer without reaching Hacienda. 502: the IdP did not answer, or answered something that is not a verdict on the credentials (messageKey errors.HACIENDA_IDP_UNAVAILABLE) 424: someone updates the credentials in the web app (Company → Certificate), or presses Verify again there if they were fixed at Hacienda — everything that waited goes out on its own. An API key can’t change credentials. 502: retry with backoff
ATV_NETWORK_ERROR 502/424 502: ATV did not answer (network, 30 s timeout, 5xx, 408, 429). 424: ATV answered with a refusal (messageKey errors.ATV_REQUEST_REJECTED; the reason ATV gave is in message) 502: retry with backoff. 424: don’t retry — read the reason
ACCEPTANCE_PENDING_DELIVERY 502 A MensajeReceptor was numbered and signed, but Hacienda did not answer Nothing: it is delivered automatically with the same number. Don’t send another
INVOICE_HAS_FISCAL_NUMBER 409 DELETE of a draft that already has a consecutivo (its signature failed after the number was allocated; params.consecutivo) Sign/submit it; if unwanted, void it afterwards with a credit note
ATV_REJECTED 422 ATV permanently rejected the document Read haciendaDetailMessage; emit a NEW corrected document

Fixed by a person in the web app or, for a tenant a partner manages, by the partner through the partner API. An API key can’t change the company’s configuration or credentials.

Code Status When Recover
TENANT_NOT_CONFIGURED 412 The company lacks something issuing needs (params.missing): a default branch, terminal or economic activity when creating a draft, or Hacienda credentials for that environment when signing Complete it in the web app (Company)
TENANT_LOCATION_MISSING 422 Signing while the company has no fiscal address (provincia, cantón, distrito) Complete it in Company → Tax details
CERT_IDENTIFICATION_MISMATCH 400 Saving credentials: the .p12’s cédula is not the company’s Upload the company’s certificate
ATV_USER_IDENTIFICATION_MISMATCH 400 Saving credentials: the identification in the ATV username is not the company’s (params.userNumber, params.tenantNumber) Use the ATV username of the company’s cédula
ATV_CREDENTIALS_REJECTED 400 Saving credentials: Hacienda refused the username/password (if Hacienda did not answer you get a 502 instead, never this) Check the ATV credentials
CREDENTIALS_VERIFY_COOLDOWN 429 Re-verifying refused credentials less than a minute after the last try — each try is a login at Hacienda (params.retryAfterSeconds) Wait and try again
SEQUENCE_CANNOT_DECREASE 409 Seeding a production numbering counter with a nextConsecutive below params.current: one more than the counter or than the highest number already used, whichever is greater — rejected and deleted documents count (params.requested is the value sent). A batch is all or nothing Re-read the counters (a terminal may have issued meanwhile) and send at least params.current — see Consecutivo sequences
Code Status When Recover
UNAUTHORIZED 401 No credential, or the API key is malformed, unknown or carries the wrong secret (always the same answer) Check the whole key
API_KEY_REVOKED 401 The API key, with its correct secret, was revoked Create a new one, or use the one that replaced it when it was rotated
API_KEY_EXPIRED 401 The API key, with its correct secret, expired (expiresAt) Create a new one
INSUFFICIENT_SCOPE 403 The API key — or the user’s role — lacks a scope the endpoint requires (params.required) Give the key that scope (create a new key; scopes can’t be edited) — see Scopes
SESSION_EXPIRED 401 The JWT session reached its maximum (params.cause: platform, tenant_policy or upgrade) Sign in again
SESSION_IDLE_TIMEOUT 401 The session was not renewed within the company’s inactivity window Sign in again; renew on user activity (POST /v1/auth/sessions/renew)
SESSION_REVOKED 401 The session was signed out, closed from the session list, or ended by a security event Sign in again
SESSION_INVALID 401 Not a token we signed, or the account is gone or deactivated Sign in again
TENANT_REQUIRED 403 JWT without a tenant scope Create/select a tenant
TENANT_REQUIRES_REAUTH 403 Switching into a company whose session rules no longer admit this sign-in (params.reason: tenant_policy or sessions_revoked) Sign in again to enter it
AUTH_RATE_LIMITED 429 Too many sign-in attempts Wait Retry-After seconds
TOO_MANY_ATTEMPTS 429 Too many wrong email codes Wait, then request a new code

Returned when creating or rotating a key (a person signed in to the web app, or a JWT).

Code Status When Recover
API_KEY_SCOPES_REQUIRED 400 No scopes — a key must say what it may do Send at least one scope
API_KEY_SCOPE_INVALID 400 A scope that doesn’t exist or can’t be given to a key Use the scopes in Authentication
API_KEY_NAME_TAKEN 409 Another active key of that environment has that name (params.name) Choose another name, or revoke the old key
API_KEY_NAME_REQUIRED · API_KEY_NAME_TOO_LONG 400 Name missing, or longer than 80 characters Send a name of 1–80 characters
API_KEY_ENVIRONMENT_INVALID 400 environment is not sandbox or production Send one of the two
API_KEY_EXPIRES_AT_INVALID 400 expiresAt is not a valid date Send an ISO 8601 instant, or omit it
Code Status When Recover
PARTNER_KEY_INVALID 401 Bad/expired x-partner-key Check the credential / rotate
PARTNER_TENANT_CEDULA_CONFLICT 409 Cédula owned by another tenant The tenant already exists elsewhere
PARTNER_TENANT_HAS_FISCAL_HISTORY 409 Releasing a tenant (DELETE /v1/partner/tenants/:id) that has a production document with a number, deleted ones included, or a production MensajeReceptor (params.documents counts them). Sandbox documents don’t count Offboard it with detach instead — see Releasing a tenant provisioned by mistake
PARTNER_PRODUCTION_NOT_ENABLED 403 Production action on a sandbox-only partner Production must be enabled first
PARTNER_RATE_LIMITED 429 More than 30 control-plane requests a minute Wait Retry-After seconds
Code Status When Recover
SUBSCRIPTION_INACTIVE 402 A production API key whose company has no plan in force tried anything but a read (params.status). Without a plan a company keeps read-only access: GET and HEAD still work, so documents, XML and PDFs can be downloaded Renew the plan; reads need nothing
DOCUMENT_QUOTA_EXCEEDED 402 Signing in production with the plan’s documents for the month used up (params.used, params.limit, params.period). Nothing is numbered The company upgrades its plan, enables overage or buys prepaid documents; keep the sale queued
OVERAGE_CAP_REACHED 402 The month’s overage reached its cap (params.cap) As above
PREPAID_BALANCE_EMPTY 402 A prepaid company with no documents left The company buys more
FEATURE_NOT_IN_PLAN 402 The endpoint belongs to a feature the plan doesn’t include (params.feature, params.requiredPlan) — reports, the audit log… The company changes its plan

API keys have no fixed request quota. These endpoints limit how often they are called:

Code Status When Recover
AUTH_RATE_LIMITED 429 Sign-in and two-factor endpoints Wait Retry-After seconds
PARTNER_RATE_LIMITED 429 Partner control plane (30 requests a minute per partner) Wait Retry-After seconds
BILLING_RATE_LIMITED 429 Subscription changes (10 a minute per company) Wait Retry-After seconds
CREDENTIALS_VERIFY_COOLDOWN 429 Re-verifying Hacienda credentials (once a minute) Wait params.retryAfterSeconds
ARCHIVE_DOWNLOAD_BUSY 429 More than two XML backup downloads at once per company (params.max) Wait for one to finish
Behavior Codes Do
Always-retry transient Any 502, 503 or 504 — ATV_NETWORK_ERROR and TOKEN_REQUEST_FAILED with status 502, BAD_GATEWAY, FX_UNAVAILABLE Exponential backoff (1–5s → 60s)
Wait-then-retry Any 429, IDEMPOTENCY_REQUEST_IN_PROGRESS Honor Retry-After / params.retryAfterSeconds
Fix payload + new key VALIDATION_ERROR, *_INVALID, *_REQUIRED, *_MISMATCH, LINE_DISCOUNT_FULL_* Fix input; rotate Idempotency-Key
Permanent — don’t retry ATV_REJECTED, INVOICE_EXTERNAL_REFERENCE_EXISTS, IDEMPOTENCY_KEY_REUSED_DIFFERENT_PAYLOAD, ATV_NETWORK_ERROR with status 424 Read details; emit a new document
Fix the key UNAUTHORIZED, INSUFFICIENT_SCOPE Check, rotate or re-create the API key
Needs the business SUBSCRIPTION_INACTIVE, DOCUMENT_QUOTA_EXCEEDED, OVERAGE_CAP_REACHED, PREPAID_BALANCE_EMPTY, TENANT_NOT_CONFIGURED, TENANT_LOCATION_MISSING, TOKEN_REQUEST_FAILED with status 424 Retrying won’t help until someone at the company acts in the web app; keep the sale queued
Reauth SESSION_*, TENANT_REQUIRED, TENANT_REQUIRES_REAUTH, PARTNER_KEY_INVALID Sign in again / select a tenant