TF Fiscal

Error handling

Determining the cause of a failure by code and deciding whether to retry

Order of evaluation

  • HTTP status 400 or 401: authentication failure; see "Authentication & signing".
  • HTTP status 429: too many requests from the same IP; code is RATE_LIMITED. Retry later.
  • HTTP status 200 with success false: handled according to code in the table below. Internal platform errors are also returned in this form, with code INTERNAL_ERROR; the same request can be retried later, and if the error persists, TF is contacted with the id and time of the request.

The text in message changes between versions and must not be used for programmatic decisions. New error codes are only added; the meaning of existing error codes does not change.

Error codes

codeMeaningHandling
AUTH_TOKEN_MISSINGNo token was sentAdd the token header
AUTH_TOKEN_INVALIDThe token does not exist or is no longer validCheck the token; company endpoints require the company token
AUTH_APP_DISABLEDThe integrator account is disabledContact TF
AUTH_SIGN_INVALIDSignature mismatchSee the common causes in "Authentication & signing"
AUTH_TIMESTAMP_MISSINGtimestamp was not sentAdd the header
AUTH_TIMESTAMP_INVALIDtimestamp is not an integer number of secondsUse Unix seconds
AUTH_TIMESTAMP_EXPIREDDiffers from the server time by more than 300 secondsSynchronize the server clock and generate a new value for each request
RATE_LIMITEDCall rate limit exceededRetry later
PRODUCT_UNAVAILABLEThe endpoint product is not yet availableContact TF
SUBSCRIPTION_REQUIREDThe endpoint requires a subscriptionActivate it in the subscription center
SUBSCRIPTION_NO_BALANCEInsufficient subscription balanceTop up or activate a plan in the subscription center
FIELD_REQUIREDA required field is missingAdd the field named in message
FIELD_INVALIDInvalid field value or lengthCorrect it according to the value range on the endpoint page
CEP_INVALIDThe postal code could not be foundCheck the cep of the buyer or address
TAX_CATEGORY_NOT_FOUNDThe tax category does not exist, or it contains no rule applicable to this transaction (buyer type, intrastate or interstate)Check category_id, or add the corresponding scenario to the tax category
TAX_REGIME_MISMATCHThe ICMS tax code type does not match the tax regime of the companySimples Nacional uses three-digit CSOSN; the normal regime uses two-digit CST
TAX_CODE_UNSUPPORTEDThe tax code is not supported, or a rate required by the tax code is missingCorrect it according to "Fields by scenario" in "Issue a new invoice"
TAX_AUTHORITY_REJECTEDRejected by the tax authority; the reason is in data.motivoCorrect the data according to the rejection reason before resubmitting; do not resubmit the same error unchanged
TAX_AUTHORITY_UNAVAILABLECommunication with the tax authority failed or timed out; the invoice status may be unknownRetry later with the same id; changing the id may result in two invoices
INTERNAL_ERRORInternal platform errorRetry later; if the error persists, contact TF
UNCLASSIFIEDA failure not yet classifiedHandle according to message and notify TF so that it can be classified

Common rejection reasons from the tax authority

Rejection codeMeaningCommon cause
539The number is already used by another invoiceThe same number was used for an invoice issued in another system; contact TF to adjust the numbering
590 / 591CST and CSOSN used incorrectlyThe tax code type does not match the tax regime of the company
656Excessive call frequencyThe same error was submitted repeatedly; service resumes after a suspension of about one hour
868Vehicle and trailer information must not be providedvehicle_info or trailer_info was provided for interstate transport (the API now rejects this in advance)

The diagnosis of further rejection codes is described in "XML Troubleshooting" in the knowledge base.