Skip to content

Error Codes

This page provides information about the error codes that can be returned by the TronZap API.

Error Response Format

When an error occurs, the API will return a response with a non-zero error code and an error message:

json
{
    "code": 1,
    "error": "Error message description"
}

Error Code List

CodeDescriptionResolution
0SuccessNot an error. The request was successful.
1Authentication errorCheck your API token and ensure your signature is calculated correctly.
2Invalid service or parametersCheck that the service name and parameters are correct.
5Wallet not foundVerify the wallet address or contact support if you believe this is an error.
6Insufficient fundsAdd funds to your account or reduce the amount of energy you're requesting.
10Invalid TRON addressCheck the TRON address format. It should be a valid 34-character TRON address.
11Invalid energy amountEnsure the requested energy amount is valid.
12Invalid durationCheck that the duration parameter is valid.
20Transaction not foundVerify the transaction ID or external ID is correct.
24Address not activatedActivate the address first by making an address activation transaction.
25Address already activatedThe address is already activated. No action needed.
500Internal server errorContact support if this error persists.

Handling Errors

When consuming the API, you should implement error handling logic for all possible error codes. Here are some recommendations:

Authentication Errors (Code 1)

Authentication errors indicate issues with your API credentials or signature calculation. You should:

  • Verify your API token is correct
  • Check your signature calculation logic
  • Ensure your API secret is not exposed in client-side code

Resource Errors (Codes 5, 6, 10, 20)

Resource errors indicate issues with the provided resources. You should:

  • Validate TRON addresses before sending them to the API
  • Check account balance before making transactions
  • Verify transaction IDs when checking status

Business Logic Errors (Codes 24, 25)

Business logic errors indicate issues with the requested operation. You should:

  • Implement address activation check before attempting energy purchase
  • Skip address activation if already activated

Tron Energy API Documentation