Comprehensive overview of the standardized error response model used by the API

When integrating with our API, robust error handling is essential for a seamless user experience and resilient application performance. By addressing errors effectively, your application can gracefully manage issues, minimize disruptions, and maintain responsiveness.

Key steps include:

  • Leveraging our standardized error response model.
  • Keeping your error-handling logic up-to-date to adapt to any API changes.

Error Response Model


Our API returns a structured error object for all 4xx errors to simplify issue diagnosis. The format is as follows:

{  
   "code":"<error_code>",  
   "title":"<error_title>",  
   "message":"<error_message>"  
}

Field Definitions:

  • code: A unique, stable identifier for the error.
  • title: A brief summary of the issue.
  • message: Detailed guidance for resolving the error.

Field-Level Error Details

For issues specific to individual fields, a fields object provides additional context.

Examples:

{  
   "code":"0009",  
   "title":"Missing Fields in Request",  
   "message":"Your request is missing one or more required fields. Please refer to the documentation to ensure all necessary fields are included in your request.",  
   "fields": {  
      "{{field}}": "{{field}} is a required field"  
   }  
} 
{  
   "code":"0047",  
   "title":"Bad Request",  
   "message":"The server could not understand the request due to malformed syntax. Please check the listed fields and try again.",  
   "fields":{  
      "legalName": "legalName is a required field.",  
      "parentOrganizationId":"parentOrganizationId must be a valid UUID"  
   }  
}  
{  
   "code":"0053",  
   "title":"Unexpected Fields in the Request",  
   "message":"The request body contains more fields than expected. Please send only the allowed fields as per the documentation. The unexpected fields are listed in the fields object.",  
   "fields":{  
      "{{field}}":"{{error_message}}"  
   }  
}

Error Code Reference


Refer to the following table for error codes and their descriptions:

codetitlemessage
0001Duplicate Ledger ErrorA ledger with the name {{name}} already exists in the division {{divisionName}}. Please rename the ledger or choose a different division to attach it to.
0002Ledger Name ConflictA ledger named {{name}} already exists in your organization. Please rename the ledger, or if you want to use the same name, consider creating a new ledger for a different division.
0003Asset Name or Code DuplicateAn asset with the same name or code already exists in your ledger. Please modify the name or code of your new asset.
0004Code Uppercase RequirementThe code must be in uppercase. Please ensure that the code is in uppercase format and try again.
0005Currency Code Standard ComplianceCurrency-type assets must comply with the ISO-4217 standard. Please use a currency code that conforms to ISO-4217 guidelines.
0006Unmodifiable Field ErrorYour request includes a field that cannot be modified. Please review your request and try again, removing any uneditable fields. Please refer to the documentation for guidance.
0007Entity Not FoundNo entity was found for the given ID. Please make sure to use the correct ID for the entity you are trying to manage.
0008Action Not PermittedThe action you are attempting is not allowed in the current environment. Please refer to the documentation for guidance.
0009Missing Fields in RequestYour request is missing one or more required fields. Please refer to the documentation to ensure all necessary fields are included in your request.
0010Account Type ImmutableThe account type specified cannot be modified. Please ensure the correct account type is being used and try again.
0011Inactive Account Type ErrorThe account type specified cannot be set to INACTIVE. Please ensure the correct account type is being used and try again.
0012Account Balance Deletion ErrorAn account or sub-account cannot be deleted if it has a remaining balance. Please ensure all remaining balances are transferred to another account before attempting to delete.
0013Resource Already DeletedThe resource you are trying to delete has already been deleted. Ensure you are using the correct ID and try again.
0014Degment ID InactiveThe Segment ID you are attempting to use is inactive. Please use another Segment ID and try again.
0015Duplicate Segment Name ErrorA segment with the name {{name}} already exists for this ledger ID {{ledgerId}}. Please try again with a different ledger or name.
0016Balance Remaining Deletion ErrorThe asset cannot be deleted because there is a remaining balance. Please ensure all balances are cleared before attempting to delete again.
0017Invalid Script Format ErrorThe script provided in your request is invalid or in an unsupported format. Please verify the script format and try again.
0018Insufficient Funds ErrorThe transaction could not be completed due to insufficient funds in the account. Please add sufficient funds to your account and try again.
0019Account Ineligibility ErrorOne or more accounts listed in the transaction are not eligible to participate. Please review the account statuses and try again.
0020Alias Unavailability ErrorThe alias {{alias}} is already in use. Please choose a different alias and try again.
0021Parent Transaction ID Not FoundThe parentTransactionId {{parentTransactionId}} does not correspond to any existing transaction. Please review the ID and try again.
0022Immutable Field ErrorThe {{field}} field cannot be modified. Please remove this field from your request and try again.
0023Transaction Timing RestrictionYou can only perform another transaction using {{assetCode}} of {{amount}} from {{source}} to {{destination}} after {{timestampUnlock}}. Please wait until the specified time to try again.
0024Account Status Transaction RestrictionThe current statuses of the source and/or destination accounts do not permit transactions. Change the account status(es) and try again.
0025Insufficient Account Balance ErrorThe account {{accountId}} does not have sufficient balance. Please try again with an amount that is less than or equal to the available balance.
0026Transaction Method RestrictionTransactions involving {{assetCode}} are not permitted for the specified source and/or destination. Please try again using accounts that allow transactions with {{assetCode}}.
0027Duplicate Transaction Template Code ErrorA transaction template with the code {{code}} already exists for your ledger. Please use a different code and try again.
0028Duplicate Asset Pair ErrorA pair for the assets {{baseAssetCode}}{{counterAssetCode}} already exists with the ID {{asset_rates.id}}. Please update the existing entry instead of creating a new one.
0029Invalid Parent Account IDThe specified parent account ID does not exist. Please verify the ID is correct and try your request again.
0030Mismatched Asset CodeThe parent account ID you provided is associated with a different asset code than the one specified in your request. Please make sure the asset code matches that of the parent account, or use a different parent account ID and try again.
0031Chart Type Not FoundThe chart type {{chartType}} does not exist. Please provide a valid chart type and refer to the documentation if you have any questions.
0032Invalid Country CodeThe provided country code in the 'address.country' field does not conform to the ISO-3166 alpha-2 standard. Please provide a valid alpha-2 country code.
0033Invalid Code FormatThe 'code' field must be alphanumeric, in upper case, and must contain at least one letter. Please provide a valid code.
0034Asset Code Not FoundThe provided asset code does not exist in our records. Please verify the asset code and try again.
0035Portfolio ID Not FoundThe provided portfolio ID does not exist in our records. Please verify the portfolio ID and try again.
0036Segment ID Not FoundThe provided segment ID does not exist in our records. Please verify the segment ID and try again.
0037Ledger ID Not FoundThe provided ledger ID does not exist in our records. Please verify the ledger ID and try again.
0038Organization ID Not FoundThe provided organization ID does not exist in our records. Please verify the organization ID and try again.
0039Parent Organization ID Not FoundThe provided parent organization ID does not exist in our records. Please verify the parent organization ID and try again.
0040Invalid TypeThe provided 'type' is not valid. Accepted types are: currency, crypto, commodities, or others. Please provide a valid type.
0041Token MissingA valid token must be provided in the request header. Please include a token and try again.
0042Invalid TokenThe provided token is invalid or malformed. Please provide a valid token and try again.
0043Token ExpiredThe provided token has expired. Please provide a valid token and try again.
0044Insufficient PrivilegesYou do not have the necessary permissions to perform this action. Please contact your administrator if you believe this is an error.
0045Permission Enforcement ErrorThe enforcer is not configured properly. Please contact your administrator if you believe this is an error.
0046Internal Server ErrorThe server encountered an unexpected error. Please try again later or contact support.
0047Bad RequestThe server could not understand the request due to malformed syntax. Please check the listed fields and try again.
0048Invalid DSL File FormatThe submitted DSL file {{fileName}} is in an incorrect format. Please ensure that the file follows the expected structure and syntax.
0049Empty DSL FileThe submitted DSL file {{fileName}} is empty. Please provide a valid file with content.
0050Metadata Key Length ExceededThe metadata key {{key}} exceeds the maximum allowed length of 100 characters. Please use a shorter key.
0051Metadata Value Length ExceededThe metadata value {{value}} exceeds the maximum allowed length of 100 characters. Please use a shorter value.
0052Account ID Not FoundThe provided account ID does not exist in our records. Please verify the account ID and try again.
0053Unexpected Fields in the RequestThe request body contains more fields than expected. Please send only the allowed fields as per the documentation. The unexpected fields are listed in the fields object.
0054No Accounts FoundNo accounts were found for the provided account IDs. Please verify the account IDs and try again.
0055Asset ID Not FoundThe provided asset ID does not exist in our records. Please verify the asset ID and try again.
0056No Assets FoundNo assets were found in the search. Please review the search criteria and try again.
0057No Segments FoundNo segments were found in the search. Please review the search criteria and try again.
0058No Portfolios FoundNo portfolios were found in the search. Please review the search criteria and try again.
0059No Organizations FoundNo organizations were found in the search. Please review the search criteria and try again.
0060No Ledgers FoundNo ledgers were found in the search. Please review the search criteria and try again.
0061Balance Update FailedThe balance could not be updated for the specified account ID. Please verify the account ID and try again.
0062No Account IDs ProvidedNo account IDs were provided for the balance update. Please provide valid account IDs and try again.
0063Failed To Retrieve Accounts By AliasesThe accounts could not be retrieved using the specified aliases. Please verify the aliases for accuracy and try again.
0064No Accounts FoundNo accounts were found in the search. Please review the search criteria and try again.
0065Invalid Path ParameterThe provided path parameter {{parameter_name}} is not in the expected format. Please ensure the parameter adheres to the required format and try again.
0066Invalid Account TypeThe provided 'type' is not valid. Accepted types are: deposit, savings, loans, marketplace, creditCard or external. Please provide a valid type.
0067Invalid Metadata NestingThe metadata object cannot contain nested values. Please ensure that the value {{value}} is not nested and try again.
0068Operation ID Not FoundThe provided operation ID does not exist in our records. Please verify the operation ID and try again.
0069No Operations FoundNo operations were found in the search. Please review the search criteria and try again.
0070Transaction ID Not FoundThe provided transaction ID does not exist in our records. Please verify the transaction ID and try again.
0071No Transactions FoundNo transactions were found in the search. Please review the search criteria and try again.
0072Invalid Transaction TypeOnly one transaction type ('amount', 'share', or 'remaining') must be specified in the '{{field}}' field for each entry. Please review your input and try again.
0073Transaction Value MismatchThe values for the source, the destination, or both do not match the specified transaction amount. Please verify the values and try again.
0074External Account Modification ProhibitedAccounts of type 'external' cannot be deleted or modified as they are used for traceability with external systems. Please review your request and ensure operations are only performed on internal accounts.
0075Audit Record Not RetrievedThe record {{id}} could not be retrieved for audit. Please verify that the submitted data is correct and try again.
0076Audit Tree Record Not FoundThe record {{id}} does not exist in the audit tree. Please ensure the audit tree is available and try again.
0077Invalid Date Format ErrorThe 'initialDate', 'finalDate', or both are in the incorrect format. Please use the 'yyyy-mm-dd' format and try again.
0078Invalid Final Date ErrorThe 'finalDate' cannot be earlier than the 'initialDate'. Please verify the dates and try again.
0079Date Range Exceeds Limit ErrorThe range between 'initialDate' and 'finalDate' exceeds the permitted limit of {{limit}} months. Please adjust the dates and try again.
0080Pagination Limit ExceededThe pagination limit exceeds the maximum allowed of {{pageLimit}} items per page. Please verify the limit and try again.
0081Invalid Sort OrderThe 'sort_order' field must be 'asc' or 'desc'. Please provide a valid sort order and try again.
0082Invalid Query ParameterOne or more query parameters are in an incorrect format. Please check the following parameters '{{parameter}}' and ensure they meet the required format before trying again.
0083Invalid Sort OrderBoth 'initialDate' and 'finalDate' fields are required and must be in the 'yyyy-mm-dd' format. Please provide valid dates and try again.
0084Duplicate Idempotency KeyThe idempotency key '{{key}}' is already in use. Please provide a unique key and try again.

Best Practices for Handling API Errors


1. Focus on Error Codes

  • Error codes are stable and ideal for reliable handling logic.
  • Map error codes to specific resolutions to ensure compatibility with API updates.

2. Log and Inform

  • Log errors for monitoring and troubleshooting.
  • Provide clear, actionable feedback to users with suggestions for resolution.

3. Stay Updated

  • Regularly review error code documentation to align with new or updated conditions.
  • Keep error-handling logic adaptable to future changes.

Adhering to these practices ensures a robust integration and an exceptional user experience.