Handling errors
Error response structure, errors overview
Requests made to our APIs can result in several different error responses. The following document describes a list of error values with a map to the most common recovery tactic to use.
Error Responses
TEOS API is using HTTP status codes as a highest level of response codes. Following status codes can be returned by TEOS API:
HTTP 4xx - error on the client side
HTTP 400 - request body error(incorrect parameters, failed preconditions)
HTTP 401/403 - error with authentication/authorization
HTTP 404 - error in resource URI
HTTP 500 - internal server error
The following json-structure represents a common error response body resulting from a failed API request:
Where
code
: high-level error codemessage
: a message, describing the issuetarget
: the path requesteddetails
: depending on the error, may be present or not. They specify the details of the error.code
: the subcode of the issuemessage
: a message, describing the details of the issuearguments
: if a message contains any data (strings, decimals etc), that need to be used for i18n of the error message, this field contains the names and the values of the data
clTraceId
: Internal support identifier. When reporting a bug related to a TEOS API call, include theclTraceId
to help us find log data for debugging.
Error codes 1xxxx
indicate non-business logic related issues with input (auth issues, issues with parsing input data, rate limiting etc.). These errors are mostly 'technical', related to the problems in the TEOS API consumer's code.
Error codes 2xxxx
indicate business logic related issues with input (failed preconditions, validations etc.).
400
the user '{userId}' does not own asset ('uniqueAssetId') issuer's address '{assetIssuerAddress}'
400
not enough sparks on the balance. Address: {signerAddress}, uniqueAssetId: {uniqueAssetId}, required amount: {requiredAmount}, actual amount: {actualAmount}
400
the instance is configured to operate on assets from ledger {configuredLedgerId}, but the requested asset '{uniqueAssetId}' is from ledger {assetLedgerId}
400
The source asset with Id '{sourceUniqueAssetId}' is already linked to asset with id '{targetUniqueAssetId}'
400
The source asset with Id '{sourceUniqueAssetId}' is not linked to asset with id '{targetUniqueAssetId}'
400
The number of sections in asset custom definition item's SectionsPathNames differs from SectionsPath
Last updated