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;
codeisRATE_LIMITED. Retry later. - HTTP status 200 with
successfalse: handled according tocodein the table below. Internal platform errors are also returned in this form, withcodeINTERNAL_ERROR; the same request can be retried later, and if the error persists, TF is contacted with theidand 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
| code | Meaning | Handling |
|---|---|---|
| AUTH_TOKEN_MISSING | No token was sent | Add the token header |
| AUTH_TOKEN_INVALID | The token does not exist or is no longer valid | Check the token; company endpoints require the company token |
| AUTH_APP_DISABLED | The integrator account is disabled | Contact TF |
| AUTH_SIGN_INVALID | Signature mismatch | See the common causes in "Authentication & signing" |
| AUTH_TIMESTAMP_MISSING | timestamp was not sent | Add the header |
| AUTH_TIMESTAMP_INVALID | timestamp is not an integer number of seconds | Use Unix seconds |
| AUTH_TIMESTAMP_EXPIRED | Differs from the server time by more than 300 seconds | Synchronize the server clock and generate a new value for each request |
| RATE_LIMITED | Call rate limit exceeded | Retry later |
| PRODUCT_UNAVAILABLE | The endpoint product is not yet available | Contact TF |
| SUBSCRIPTION_REQUIRED | The endpoint requires a subscription | Activate it in the subscription center |
| SUBSCRIPTION_NO_BALANCE | Insufficient subscription balance | Top up or activate a plan in the subscription center |
| FIELD_REQUIRED | A required field is missing | Add the field named in message |
| FIELD_INVALID | Invalid field value or length | Correct it according to the value range on the endpoint page |
| CEP_INVALID | The postal code could not be found | Check the cep of the buyer or address |
| TAX_CATEGORY_NOT_FOUND | The 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_MISMATCH | The ICMS tax code type does not match the tax regime of the company | Simples Nacional uses three-digit CSOSN; the normal regime uses two-digit CST |
| TAX_CODE_UNSUPPORTED | The tax code is not supported, or a rate required by the tax code is missing | Correct it according to "Fields by scenario" in "Issue a new invoice" |
| TAX_AUTHORITY_REJECTED | Rejected by the tax authority; the reason is in data.motivo | Correct the data according to the rejection reason before resubmitting; do not resubmit the same error unchanged |
| TAX_AUTHORITY_UNAVAILABLE | Communication with the tax authority failed or timed out; the invoice status may be unknown | Retry later with the same id; changing the id may result in two invoices |
| INTERNAL_ERROR | Internal platform error | Retry later; if the error persists, contact TF |
| UNCLASSIFIED | A failure not yet classified | Handle according to message and notify TF so that it can be classified |
Common rejection reasons from the tax authority
| Rejection code | Meaning | Common cause |
|---|---|---|
| 539 | The number is already used by another invoice | The same number was used for an invoice issued in another system; contact TF to adjust the numbering |
| 590 / 591 | CST and CSOSN used incorrectly | The tax code type does not match the tax regime of the company |
| 656 | Excessive call frequency | The same error was submitted repeatedly; service resumes after a suspension of about one hour |
| 868 | Vehicle and trailer information must not be provided | vehicle_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.