API Tutorial
Integrate TRON Energy Rental services into your applications with our REST API.
Getting Started
Our REST API allows you to programmatically access TRON energy rental services. The API provides authentication-based access to product listings, energy transfers, and account management.
Features
- 🔑 Authentication - User-based authentication system
- 📦 Product Management - List available energy products
- ⚡ Energy Transfer - Transfer energy to user accounts
- 💰 Account Balance - Check user account balances
- 🏥 Health Monitoring - API health check endpoints
Authentication
Authentication for the TRON Energy Rental API is handled via a Bearer token provided in the Authorization
header of each request.
To obtain your API token, please use our official . After completing the authentication process in Telegram, the bot will provide you with a session token.
Include your token in the Authorization
header for all API requests:
API Endpoints
Get Product List
GET /product/getEnergyProduct
Retrieve a list of available energy products
Request Parameters
Example Request
curl -X GET "https://{host}/product/getEnergyProduct" \
-H "Authorization: AUTH_TOKEN"
Response
{
"code": 200,
"message": "Success",
"data": [
{
"id": 1,
"name": "2.0 TRX - 6500 Energy",
"description": "Purchase energy. Transfer TRX to receive energy instantly. Minimum purchase is 65000 energy. 2.5 TRX = 65000 energy, 5 TRX = 131000 energy. Maximum transfer 50 TRX = 1310000 energy. Program runs 24/7 with millisecond response.",
"duration": 1,
"trx_amount": 2.0,
"engery": 6500.0
},
{
"id": 2,
"name": "5 TRX - 131,000 Energy",
"description": "Purchase energy. Transfer TRX to receive energy instantly. 5 TRX = 131000 energy. Program runs 24/7 with millisecond response.",
"duration": 2,
"trx_amount": 5.0,
"engery": 131000.0
},
{
"id": 3,
"name": "6 TRX - 195000 Energy",
"description": "Purchase energy. Transfer TRX to receive energy instantly. 50 TRX = 1310000 energy. Program runs 24/7 with millisecond response.",
"duration": 3,
"trx_amount": 6.0,
"engery": 195000.0
}
]
}
GET /product/getTransactionProduct
Retrieve a list of available Transaction based products
Request Parameters
Example Request
curl -X GET "https://{host}/product/getTransactionProduct" \
-H "Authorization: AUTH_TOKEN"
Response
{
"code": 200,
"message": "Success",
"data": [
{
"id": 5,
"name": "1 笔",
"description": "1笔 65,000能量",
"duration": 1,
"trx_amount": 4.4,
"engery": 65000.0
},
{
"id": 6,
"name": "2 笔",
"description": "1笔 65,000能量",
"duration": 1,
"trx_amount": 4.4,
"engery": 130000.0
},
{
"id": 7,
"name": "3 笔",
"description": "1笔 65,000能量",
"duration": 1,
"trx_amount": 4.4,
"engery": 195000.0
}
]
}
GET /product/getSmartProduct
Retrieve a list of available Smart products
Request Parameters
Example Request
curl -X GET "https://{host}/product/getSmartProduct" \
-H "Authorization: AUTH_TOKEN"
Response
{
"code": 200,
"message": "Success",
"data": [
{
"id": 19,
"name": "1 time",
"description": "1 time",
"duration": 0,
"trx_amount": 2.0,
"engery": 0.0
},
{
"id": 20,
"name": "2 time",
"description": "2 time",
"duration": 0,
"trx_amount": 4.0,
"engery": 0.0
},
{
"id": 21,
"name": "6 times",
"description": "6 times",
"duration": 0,
"trx_amount": 12.0,
"engery": 0.0
},
{
"id": 22,
"name": "4 time",
"description": "4 time",
"duration": 0,
"trx_amount": 12.0,
"engery": 0.0
}
]
}
Transfer Energy
POST /rental/getEnergy
Transfer energy to the authenticated user's account based on the selected product.
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
productId | Long | Yes | ID of the product to purchase |
Example Request
curl -X POST "https://api.tron-energy-rental.com/rental/getEnergy" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Authorization: AUTH_TOKEN" \
-d "productId=1"
Response
{
"code": 200,
"message": "Success",
"data": null
}
Get Account Balance
GET /account/balance
Retrieve the current balance of the authenticated user's account.
Example Request
curl -X GET https://api.tron-energy-rental.com/account/balance \
-H "Authorization: AUTH_TOKEN"
Response
{
"code": 200,
"message": "Success",
"data": {
"balance": 150.75
}
}
Response Format
All API responses follow a consistent format:
{
"code": 200,
"message": "Success",
"data": {}
}
Response Fields
Field | Type | Description |
---|---|---|
code | integer | HTTP status code (200 for success) |
message | string | Human-readable status message |
data | object | Response data (varies by endpoint) |
Error Handling
The API returns standard HTTP status codes and detailed error messages:
Status Code | Description |
---|---|
200 | Success |
401 | Unauthorized - User not authenticated |
404 | Not Found - Resource not found |
500 | Internal Server Error |
Error Response Format
{
"code": 401,
"message": "Unauthorized: Invalid or missing API key"
}
Authentication Flow
- Telegram Bot: Users authenticate through our official
- Token Generation: After successful authentication, the bot provides an AUTH_TOKEN
- API Access: Use the AUTH_TOKEN in the Authorization header for API requests
- User Context: The API automatically identifies the user from the token
Testing
Use our development environment for testing:
- Test URL: Get our test url from our
- Production URL: Get our Production url from our
- Authentication: Get your AUTH_TOKEN from our
Support
Need help with API integration?
- 📧 Email: api-support@tron-energy-rental.com
- 💬 Telegram:
- 📚 Documentation: Full API Reference
Ready to integrate? Contact Support to get started with API access.