Machine translation, not yet reviewed.

Error codes — Integration API

The token endpoint returns errors in the standard OAuth2 format:

Token Endpoint Errors (POST /api/integration/auth/token)

The token endpoint returns errors in the standard OAuth2 format:

{
  "error": "error_code",
  "error_description": "Human-readable description"
}
HTTP StatusOAuth2 codeDescriptionHow to Resolve
400unsupported_grant_typeThe given grant_type is not supportedUse client_credentials or password
400invalid_requestRequired parameters missing or malformedCheck that client_id and grant_type are present
401invalid_clientInvalid client ID or client secretCheck the OAuth2 client credentials
401invalid_grantInvalid user credentials (username/password)Check the user's email and password
401unauthorized_clientClient is not allowed to use the requested grant typeCheck the API key configuration in IAM

Authenticated Endpoint Errors (GET /api/integration/companies)

Authenticated endpoints return errors in the standard API format:

{
  "code": "string",
  "message": "string",
  "success": false
}

HTTP Errors

HTTP StatusDescriptionCommon CauseHow to Resolve
401 UnauthorizedMissing or invalid JWT tokenAuthorization header not sent or token expiredObtain a new token via POST /api/integration/auth/token
403 ForbiddenInsufficient permissionsUser does not have the role required to access the resourceCheck the roles assigned to the API key or user in IAM
403 ForbiddenWrong customerAttempt to access another customer's dataCheck the X-Customer-Id header or the customer-id claim in the JWT
400 Bad RequestDomain rule violationInvalid parameters or business rule not metCheck the error message returned in the message field
400 Bad RequestValidation errorRequired field missing or invalid formatCheck the fields sent against the documentation
500 Internal Server ErrorInternal errorUnexpected server failureContact technical support

Domain Errors (DomainException)

Domain errors return HTTP 400 with a specific code in the code field:

{
  "code": "DOMAIN_ERROR_CODE",
  "message": "Mensagem descritiva localizada",
  "success": false
}

The message field is localized according to the Accept-Language header (supports pt-BR and en-US).

Best Practices for Error Handling

  1. Always check the success field in the response to determine whether the operation succeeded
  2. Handle expired tokens automatically: when you receive 401, obtain a new token and retry the request
  3. Do not store tokens indefinitely: respect the expires_in returned with the token
  4. Log the error codes to make troubleshooting with the support team easier

On this page