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,
    "key": "auth",
    "request_id": "99d8b507-0bca-4d5a-9542-cc2a2f2e3639",
    "error": "Incorrect token or signature"
}

Error Code List ​

CodeKeyDescriptionResolution
0—SuccessNot an error. The request was successful.
1authAuthentication errorCheck your API token and ensure your signature is calculated correctly.
2invalid_service_or_paramsInvalid service or parametersCheck that the service name and parameters are correct.
5wallet_not_foundWallet not foundVerify the wallet address or contact support if you believe this is an error.
6insufficient_fundsInsufficient fundsAdd funds to your account or reduce the amount of energy you're requesting.
10invalid_tron_addressInvalid TRON addressCheck the TRON address format. It should be a valid 34-character TRON address.
11invalid_energy_amountInvalid energy amountEnsure the requested energy amount is valid.
12invalid_durationInvalid durationCheck that the duration parameter is valid.
50invalid_bandwidth_amountInvalid bandwidth amountEnsure the requested bandwidth amount is valid.
20subscription_not_foundSubscription not foundVerify the subscription ID or external ID is correct.
21cannot_stop_subscriptionCannot stop subscriptionReview subscription limits; adjust the transaction limit or complete pending transactions.
24address_not_activatedAddress not activatedActivate the address first by making an address activation transaction.
25address_already_activatedAddress already activatedThe address is already activated. No action needed.
30aml_check_not_foundAML check not foundRe-run the AML check or contact support to confirm the verification status.
35service_unavailableService not availableThe service is temporarily unavailable for use.
500internal_server_errorInternal server errorContact support if this error persists.

Sub-keys ​

Some errors may include a more specific sub-key that provides additional context. Sub-keys use dot notation (e.g., invalid_tron_address.from_address).

Base KeySub-keyDescription
invalid_tron_addressinvalid_tron_address.from_addressInvalid from address
invalid_tron_addressinvalid_tron_address.to_addressInvalid to address
invalid_tron_addressinvalid_tron_address.contract_addressInvalid contract address
invalid_tron_addressinvalid_tron_address.already_subscribedAddress already has an active subscription
invalid_service_or_paramsinvalid_service_or_params.networkUnsupported network
invalid_service_or_paramsinvalid_service_or_params.addressInvalid address provided
invalid_service_or_paramsinvalid_service_or_params.hashHash is required for hash checks
invalid_service_or_paramsinvalid_service_or_params.directionDirection is missing or invalid (required for hash checks)
invalid_service_or_paramsinvalid_service_or_params.pageInvalid page
invalid_service_or_paramsinvalid_service_or_params.per_pageInvalid per_page
invalid_service_or_paramsinvalid_service_or_params.statusInvalid status
invalid_service_or_paramsinvalid_service_or_params.idInvalid id / Either id or external_id is required
invalid_service_or_paramsinvalid_service_or_params.external_idInvalid external_id
invalid_service_or_paramsinvalid_service_or_params.address_ownerAddress belongs to another user
invalid_service_or_paramsinvalid_service_or_params.internal_creditInternal credit not allowed
invalid_service_or_paramsinvalid_service_or_params.amountAmount out of range
invalid_service_or_paramsinvalid_service_or_params.exchange_finalizedExchange finalized
invalid_service_or_paramsinvalid_service_or_params.exchange_stateExchange in invalid state
invalid_energy_amountinvalid_energy_amount.energy_amountInvalid energy amount
invalid_energy_amountinvalid_energy_amount.bandwidth_amountInvalid bandwidth amount
invalid_durationinvalid_duration.durationDuration must be equal to 1 (1 hour)
address_not_activatedaddress_not_activated.subscriptionAddress must be activated before purchasing subscription
subscription_not_foundsubscription_not_found.transactionTransaction not found

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