Skip to Content

Error Codes

Errors come in three shapes depending on which layer produced them — see General Conventions:

LayerHTTPShapeCode field
Platform gateway (authentication, quota, retirement)401 / 403 / 410 / 429Platform envelope {success, errorType, code, message}code (integer)
Issuance endpoints400 / 404Array [{codigo, mensagem}]codigo (string)
Verification and identity endpoints400Bare object {code, message}code (integer)

Messages are localized by the Language / Accept-Language headers (default Portuguese). Branch on codes, never on message text.

Code ranges by domain:

RangeDomain
10001xxxRequest field validation
10003xxxCompany and certificate
10004xxxNF-e issuance and cancellation
10005xxxTax engine
10009xxxOpen platform (authentication, quota, webhooks, retirement)
10015xxxNF-e verification
10016xxxIdentity lookup (CNPJ / CPF)

Gateway — authentication and authorization

Platform envelope shape. 401 and 403 are configuration errors — retrying without a fix is pointless and may trip rate limits; 429 is retryable with exponential backoff.

HTTPcodeMeaningAction
40110009000Missing signature headers (token / sign / timestamp)Send all three headers on every request
40110009001Timestamp invalid or clock skew beyond ±300 sSync your clock (NTP); regenerate the timestamp per request, never reuse
40110009002Invalid tokenCheck the app_secret; if rotated, update your configuration
40110009003Signature mismatchRe-derive the signature; see Troubleshooting
40310009004Application disabledContact the platform
40310009015Application not effective (pending approval or rejected)Wait for approval / contact the platform
40310009014Integrator account disabledContact the platform
40310009005API not subscribedRequest subscription for the endpoint being called
41010009034Endpoint retired; message names the replacementSwitch to the replacement — see Deprecated Endpoints; do not retry
42910009006Rate limit exceededBack off and retry (start at 1 s, double up to 30 s, add jitter); limits are per application and per endpoint group

Issuance — business and request-level errors

Array shape [{codigo, mensagem}]. codigo is a string: GW001, CER0005 and NFe0001 keep their alphanumeric values; all others are the platform error code as a numeric string. Request-body validation failures produce one entry per field.

codigoHTTPScenarioAction
GW001400Registration: city / state cannot be resolved to an IBGE code; issuance: customer IBGE municipality code does not existCheck the UF and city name / IBGE code
CER0005400Certificate password mismatchCheck the password
NFe0001404The nfeId for query / cancellation does not existCheck the id sent at issuance and the empresaId
10001001400Request field validation failed (one entry per field)Fix per mensagem
10003000404empresaId does not exist or does not belong to this applicationCheck the empresaId
10003002400CNPJ already registeredThe company exists — use the original empresaId
10003006400Registration data missing the IEProvide inscricaoEstadual
10003010400Certificate CNPJ does not match the companyUse the correct certificate
10003011400Certificate expiredUse a valid certificate
10003012400Certificate identical to the currently active oneNothing to upload
10004002400Too many pending issuance tasks for the CNPJRetry later
10004004400Company not issuable (not yet approved or certificate not ready)Wait for approval / link the certificate
10004012400Cancellation: invoice not in authorized statusQuery to confirm the status
10004013400Cancellation: outside the 24-hour windowIssue a return invoice instead
10004014400Cancellation: refused by SEFAZ (status code and reason attached)Act on the SEFAZ reason
10004030400ambienteEmissao does not match the company’s current environmentSubmit under the company environment or ask operations to switch it
10004031400Value not supported in this phase (presencaConsumidor / multiple payments / unknown payment type / tipoPessoa inconsistent with the document)Adjust to the supported range — see Issuance API
10005000400Insufficient tax parameters (e.g. a tax code that needs a rate)See Tax codes and rates
10009033400Invalid webhook registration (id mismatch / non-JSON contentType)Fix as described

Verification — request-level errors

Bare shape {code, message}, HTTP 400. The request never enters validation.

codeEndpointMeaningAction
10015000XMLEmpty request bodySend the XML in the body
10015001XMLBody exceeds 1 MBAn authentic single NF-e never exceeds this; check that you are not wrapping or double-encoding
10015002XMLDTD detected (<!DOCTYPE)Strip DTDs; they are rejected as an XXE safeguard
10015003XMLEncoding is not UTF-8Convert to UTF-8 before submitting
10015004chave lookupInvoice not found in any sourceThe chave is unknown to the platform and the official data source; verify it with its issuer
10015104chave lookupMalformed chave (length / characters / check digit)Validate locally first: 44 digits; the last digit is a mod-11 check digit

Verification — Tier-1 validation errors

Returned with HTTP 200 inside validation.errors[] of the XML verification response. These are not transport errors: the request succeeded, the document failed. All are blocking (terminal REJECTED) except PROTOCOL_MISSING, which is a warning.

errors[].codeNumericMeaning
XML_MALFORMED10015100XML syntax invalid
XSD_INVALID10015101Does not conform to the NF-e 4.00 XSD layout
SIGNATURE_INVALID10015102Digital signature verification failed (content tampered, or certificate expired at signing time)
SIGNATURE_CERT_MISMATCH10015103Signing certificate CNPJ does not match the issuer
ACCESS_KEY_INVALID10015104chave structure / check digit invalid
ACCESS_KEY_MISMATCH10015105chave segments do not match the document fields
PROTOCOL_MISMATCH10015106Protocol block inconsistent with the document
PROTOCOL_MISSING10015107No protocol node (warning, non-blocking)
XML_VERSION_UNSUPPORTED10015108Layout version is not 4.00

Tier-2 outcomes (VALIDATED / REJECTED / VALIDATION_ERROR) are not error codes; they arrive via webhook — see Verification API.

Identity — business errors

Bare shape {code, message}, HTTP 400. Format and check-digit errors are rejected locally and never reach the upstream source — they consume no quota and are not billed.

codeMeaningAction
10016000Invalid CPF format (11 digits required)Check for stray formatting characters or wrong length
10016001Invalid CPF check digitsValidate locally with the mod-11 algorithm first
10016002Invalid date of birth (valid DDMMYYYY required)Note the day-month-year order, and that the date must actually exist
10016003CPF not foundThe CPF does not exist, or the CPF and date of birth do not match (deliberately indistinguishable); also returned for protected subjects such as minors
10016010Invalid CNPJ format (14 digits required)Check for stray formatting characters
10016011Invalid CNPJ check digitsValidate locally with the mod-11 algorithm first
10016012CNPJ not foundNo such CNPJ in the official registry

Handling guidance

  • 401 / 403 — configuration errors; fix the credential, subscription or clock. Do not retry as-is.
  • 400 / 404 — the request or the business rule; fix per the code. A few codes are transient: 10004002 (retry later).
  • 410 — the endpoint is retired; switch to the replacement named in message.
  • 429 — back off with exponential delay and jitter.
  • 5xx — retry with backoff; if persistent, contact the platform with the failing timestamp and path.
  • Envelope errorType1 API error, 2 SEFAZ rejection, 3 system fault (retryable), 4 field validation failure (fix the request).
Last updated on