Rent TRON Energy API
Public API reference for customer authentication, wallet top-up, quotes, and TRON energy order management.
Rent TRON Energy API
This document describes the public TRON Energy API for website and external integrations.
All endpoints in this document are published under the following namespace:
/external/tron-energy/*Base URL
https://back.2aml.com/external/tron-energyAuthentication
Public endpoints:
POST /auth/registerPOST /auth/loginPOST /auth/login/2faPOST /auth/verify-email/requestPOST /auth/verify-email/confirmGET /quote
Protected endpoints require the bearer token returned by one of the following successful flows:
POST /auth/registerPOST /auth/loginwhenstatus=authenticatedPOST /auth/login/2fa
POST /auth/login is branch-aware. A successful credential check can return one of the following statuses:
authenticatedtwo_factor_requiredemail_verification_required
Recommended headers:
Content-Type: application/json
Accept: application/json
Authorization: Bearer <accessToken>Optional register, login, two-factor completion, and order-attribution header:
x-fingerprint: fp_browser_or_device_identifierIf you send x-fingerprint on POST /auth/login and receive two_factor_required, send the same header again on POST /auth/login/2fa.
General Conventions
- All TRX amounts are returned as decimal strings.
- All timestamps are returned as ISO 8601 strings.
- Authentication responses are controlled by the
statusfield when you callPOST /auth/login. orderIdis your business identifier for create requests.energyOrderIdis the canonical identifier for later status and history calls.idempotencyKeyis recommended for retriable order creation calls.- Prefer
periodfor new integrations.durationis available for compatibility.
Integration Flow
Recommended integration sequence:
- Call
POST /auth/registerorPOST /auth/login. - If
POST /auth/loginreturnstwo_factor_required, callPOST /auth/login/2fa. - If
POST /auth/loginreturnsemail_verification_required, complete the email verification flow and then sign in again. - Call
GET /auth/profileto load the authenticated account state. - Call
GET /wallet/summary. - If the wallet balance is low, call
GET /wallet/deposit-instructions. - Use
GET /wallet/historywhen you need a unified balance activity feed. - After the on-chain TRX transfer is confirmed, optionally call
POST /wallet/topups/reconcile. - Call
GET /quote. - Call
POST /orders. - Poll
GET /orders/:energyOrderIdor readGET /ordersuntil a terminal status is reached.
Order Status
| Status | Terminal | Description |
|---|---|---|
pending_confirmation | No | The order request is accepted and is waiting for final confirmation. |
processing | No | The order is actively being processed. |
completed | Yes | The order completed successfully. |
refunded | Yes | The charged amount was returned to the wallet. |
failed | Yes | The order could not be completed. |
Integration rules:
- stop polling after a terminal status is returned
- branch on
status, not on the free-textmessage - preserve
energyOrderIdexactly as returned
Endpoint Summary
| Method | Path | Purpose |
|---|---|---|
POST | /auth/register | Register a new customer account, return a bearer token, and send an account verification email |
POST | /auth/login | Authenticate a customer and return the next sign-in step |
POST | /auth/login/2fa | Complete a pending two-factor sign-in challenge |
POST | /auth/verify-email/request | Request a new account verification email |
POST | /auth/verify-email/confirm | Confirm an email verification token |
GET | /auth/profile | Get the authenticated customer profile and security state |
GET | /wallet/summary | Get the authenticated wallet balance |
GET | /wallet/deposit-instructions | Get the TRX deposit address for wallet top-up |
GET | /wallet/history | List sanitized wallet balance activity |
GET | /wallet/topups | List wallet top-up records |
POST | /wallet/topups/reconcile | Reconcile a confirmed TRX transfer into the wallet |
GET | /quote | Get a TRON energy quote |
POST | /orders | Create a TRON energy order billed from wallet balance |
GET | /orders | List authenticated TRON energy orders |
GET | /orders/:energyOrderId | Get the latest status of one TRON energy order |
1. Register
Creates a customer account, starts a session, and sends an account verification email.
Endpoint
POST /auth/registerRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
email | string | Yes | Customer email address. |
password | string | Yes | Password with at least 6 characters. |
referralCode | string | No | Optional inviter referral code. |
Example Request
curl --request POST \
--url 'https://back.2aml.com/external/tron-energy/auth/register' \
--header 'Content-Type: application/json' \
--data '{
"email": "[email protected]",
"password": "secret123",
"referralCode": "REF000123"
}'Example Response
{
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": 17,
"email": "[email protected]",
"isActive": true,
"role": "user",
"referralCode": "REF123ABC",
"referredByUserId": 12,
"firstName": null,
"lastName": null,
"displayName": null,
"emailVerifiedAt": null,
"pendingEmail": null,
"pendingEmailRequestedAt": null,
"twoFactorEnabled": false,
"twoFactorEnabledAt": null,
"twoFactorPendingSetup": false
},
"emailVerificationRequired": true,
"verificationEmailSent": true,
"message": "Account created. Verify your email address to complete sign-in on future sessions."
}2. Login
Authenticates an existing customer and returns the next sign-in step.
Endpoint
POST /auth/loginRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
email | string | Yes | Customer email address. |
password | string | Yes | Customer password. |
Example Request
curl --request POST \
--url 'https://back.2aml.com/external/tron-energy/auth/login' \
--header 'Content-Type: application/json' \
--data '{
"email": "[email protected]",
"password": "secret123"
}'Example Response: authenticated
{
"status": "authenticated",
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": 17,
"email": "[email protected]",
"isActive": true,
"role": "user",
"referralCode": "REF123ABC",
"referredByUserId": null,
"firstName": null,
"lastName": null,
"displayName": null,
"emailVerifiedAt": "2026-05-03T10:20:00.000Z",
"pendingEmail": null,
"pendingEmailRequestedAt": null,
"twoFactorEnabled": false,
"twoFactorEnabledAt": null,
"twoFactorPendingSetup": false
},
"message": "Authenticated successfully."
}Example Response: two_factor_required
{
"status": "two_factor_required",
"loginChallengeToken": "c4c3d0a2f97b...",
"loginChallengeExpiresAt": "2026-05-03T10:40:00.000Z",
"message": "Two-factor authentication code is required to complete sign-in."
}Example Response: email_verification_required
{
"status": "email_verification_required",
"verificationEmailSent": true,
"message": "Email verification is required before sign-in can complete."
}Always evaluate the status field before attempting to use the response as an authenticated session.
3. Complete Two-Factor Login
Completes a pending two-factor sign-in challenge and returns a bearer token.
Endpoint
POST /auth/login/2faRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
challengeToken | string | Yes | Challenge token returned by POST /auth/login. |
code | string | Yes | Current authenticator app code or one-time recovery code. |
Example Response
{
"status": "authenticated",
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": 17,
"email": "[email protected]",
"isActive": true,
"role": "user",
"referralCode": "REF123ABC",
"referredByUserId": null,
"firstName": null,
"lastName": null,
"displayName": null,
"emailVerifiedAt": "2026-05-03T10:20:00.000Z",
"pendingEmail": null,
"pendingEmailRequestedAt": null,
"twoFactorEnabled": true,
"twoFactorEnabledAt": "2026-05-01T08:00:00.000Z",
"twoFactorPendingSetup": false
},
"message": "Authenticated successfully."
}4. Request Email Verification
Requests a new email verification message for an account that still needs verification.
Endpoint
POST /auth/verify-email/requestRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
email | string | Yes | Account email address. |
Example Response
{
"success": true,
"message": "If an active account exists and still needs verification, a verification message has been sent."
}5. Confirm Email Verification
Confirms an email verification token.
Endpoint
POST /auth/verify-email/confirmRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
token | string | Yes | Verification token received by email. |
Example Response
{
"success": true,
"message": "Email address has been verified successfully.",
"purpose": "verify_email",
"email": "[email protected]",
"sessionsRevoked": false
}If sessionsRevoked is true, sign in again before making further authenticated requests.
6. Profile
Returns the authenticated customer profile and the current email-verification and two-factor state.
Endpoint
GET /auth/profileExample Request
curl --request GET \
--url 'https://back.2aml.com/external/tron-energy/auth/profile' \
--header 'Authorization: Bearer <accessToken>'Example Response
{
"id": 17,
"email": "[email protected]",
"isActive": true,
"role": "user",
"referralCode": "REF123ABC",
"referredByUserId": null,
"firstName": null,
"lastName": null,
"displayName": null,
"emailVerifiedAt": "2026-05-03T10:20:00.000Z",
"pendingEmail": null,
"pendingEmailRequestedAt": null,
"twoFactorEnabled": true,
"twoFactorEnabledAt": "2026-05-01T08:00:00.000Z",
"twoFactorPendingSetup": false
}7. Wallet Summary
Returns the wallet balance used for TRON energy billing.
Endpoint
GET /wallet/summaryExample Response
{
"availableBalanceTrx": "40.000000",
"reservedBalanceTrx": "0.000000",
"status": "active",
"currency": "TRX"
}8. Deposit Instructions
Returns the TRX deposit route for topping up the authenticated wallet.
Endpoint
GET /wallet/deposit-instructionsExample Response
{
"network": "tron",
"depositAddress": "TNYmcW4cAyczQzj5QXHBa4FwxMPRw4DgiD",
"depositMemo": null,
"memoRequired": false,
"minDepositTrx": "1.000000",
"minConfirmations": 1,
"confirmationPolicy": "Credit after 1 on-chain confirmation(s)."
}9. Wallet History
Returns a sanitized wallet activity feed for top-ups, TRON energy reservations, TRON energy charges, and refunds.
Endpoint
GET /wallet/history?page=1&limit=20Example Response
{
"data": [
{
"type": "topup",
"direction": "credit",
"status": "completed",
"amountTrx": "25.00000000",
"availableBalanceTrx": "40.00000000",
"reservedBalanceTrx": "0.00000000",
"description": "TRX top-up credited to the wallet.",
"createdAt": "2026-04-15T12:03:00.000Z"
},
{
"type": "energy_charge",
"direction": "debit",
"status": "completed",
"amountTrx": "14.52000000",
"availableBalanceTrx": "25.48000000",
"reservedBalanceTrx": "0.00000000",
"orderId": "ORD-20260413-TRON-0001",
"energyOrderId": "ITRX-ORDER-0001",
"description": "TRON energy order charged from wallet balance.",
"createdAt": "2026-04-15T12:00:01.000Z"
}
],
"total": 2,
"page": 1,
"limit": 20
}10. List Wallet Top-Ups
Returns paginated top-up history sorted from newest to oldest.
Endpoint
GET /wallet/topups?page=1&limit=20Example Response
{
"data": [
{
"txHash": "6c1a7b4bfe2d7d84b4eb58a9f1e0f5bb0a5f1f9a9d406b6fd4c0f5e9f4f6a001",
"amountTrx": "25.00000000",
"status": "credited",
"senderAddress": "TT3m4Kx8s4bqWfQ2TzN9G17wF3yYhE3o6S",
"createdAt": "2026-04-15T12:00:00.000Z",
"creditedAt": "2026-04-15T12:03:00.000Z"
}
],
"total": 1,
"page": 1,
"limit": 20
}11. Reconcile Top-Up
Use this endpoint after the TRX transfer is confirmed on-chain and you already know the transaction hash.
Endpoint
POST /wallet/topups/reconcileRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
txHash | string | Yes | 64-character TRON transaction hash. |
Example Request
curl --request POST \
--url 'https://back.2aml.com/external/tron-energy/wallet/topups/reconcile' \
--header 'Authorization: Bearer <accessToken>' \
--header 'Content-Type: application/json' \
--data '{
"txHash": "6c1a7b4bfe2d7d84b4eb58a9f1e0f5bb0a5f1f9a9d406b6fd4c0f5e9f4f6a001"
}'Example Response
{
"topup": {
"txHash": "6c1a7b4bfe2d7d84b4eb58a9f1e0f5bb0a5f1f9a9d406b6fd4c0f5e9f4f6a001",
"amountTrx": "25.00000000",
"status": "credited",
"senderAddress": "TT3m4Kx8s4bqWfQ2TzN9G17wF3yYhE3o6S",
"createdAt": "2026-04-15T12:00:00.000Z",
"creditedAt": "2026-04-15T12:03:00.000Z"
},
"wallet": {
"availableBalanceTrx": "40.000000",
"reservedBalanceTrx": "0.000000",
"status": "active",
"currency": "TRX"
}
}12. Quote
Returns a public quote for a TRON energy order.
Endpoint
GET /quoteQuery Parameters
| Field | Type | Required | Description |
|---|---|---|---|
receiver | string | Yes | Destination TRON wallet that should receive rented energy. |
energy | integer | Yes | Requested energy amount. Minimum: 10000. |
period | string | No | Preferred lease period. Example: 1H, 1D, 3D, 30D. |
duration | integer | No | Compatibility field. 0 means 1H, 1-30 means 1D-30D. |
Example Request
curl --request GET \
--url 'https://back.2aml.com/external/tron-energy/quote?receiver=TGzz8gjYiYRqpfmDwnLxfgPuLVNmpCswVp&energy=65000&period=1D'Example Response
{
"receiver": "TGzz8gjYiYRqpfmDwnLxfgPuLVNmpCswVp",
"energy": 65000,
"duration": 1,
"period": "1D",
"amountTrx": "14.520000",
"currency": "TRX",
"orderingAvailable": true
}13. Create Order
Creates a wallet-billed TRON energy order for the authenticated customer.
Endpoint
POST /ordersRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
orderId | string | Yes | Your business identifier for this order. |
receiver | string | Yes | Destination TRON wallet. |
energy | integer | Yes | Requested energy amount. |
period | string | No | Preferred lease period. |
duration | integer | No | Compatibility field. |
note | string | No | Optional internal customer note. |
callbackUrl | string | No | Optional webhook URL to receive order callbacks. |
idempotencyKey | string | No | Recommended key for safe retries. |
Example Request
curl --request POST \
--url 'https://back.2aml.com/external/tron-energy/orders' \
--header 'Authorization: Bearer <accessToken>' \
--header 'Content-Type: application/json' \
--data '{
"orderId": "ORD-20260413-TRON-0001",
"receiver": "TGzz8gjYiYRqpfmDwnLxfgPuLVNmpCswVp",
"energy": 65000,
"period": "1D",
"idempotencyKey": "tron-rent-create-0001"
}'Example Response
{
"energyOrderId": "ITRX-ORDER-0001",
"orderId": "ORD-20260413-TRON-0001",
"status": "processing",
"receiver": "TGzz8gjYiYRqpfmDwnLxfgPuLVNmpCswVp",
"energy": 65000,
"duration": 1,
"period": "1D",
"amountTrx": "14.520000",
"chargedAmountTrx": "14.520000",
"walletAvailableBalanceTrx": "25.480000",
"idempotencyStatus": "completed",
"message": "Order has been accepted and is being processed.",
"createdAt": "2026-04-15T12:00:00.000Z",
"updatedAt": "2026-04-15T12:00:01.000Z"
}If you retry a request with the same idempotencyKey, the API can return the previously stored result with idempotencyStatus: replayed or a temporary pending state while the original request is being finalized.
14. List Orders
Returns paginated TRON energy order history sorted from newest to oldest by latest update.
Endpoint
GET /orders?page=1&limit=20Example Response
{
"data": [
{
"energyOrderId": "ITRX-ORDER-0001",
"orderId": "ORD-20260413-TRON-0001",
"status": "completed",
"receiver": "TGzz8gjYiYRqpfmDwnLxfgPuLVNmpCswVp",
"energy": 65000,
"duration": 1,
"period": "1D",
"amountTrx": "14.520000",
"chargedAmountTrx": "14.520000",
"transactionHash": "aabbccddeeff001122...",
"message": "Order completed successfully.",
"createdAt": "2026-04-15T12:00:00.000Z",
"updatedAt": "2026-04-15T12:30:00.000Z"
}
],
"total": 1,
"page": 1,
"limit": 20
}15. Get Order
Returns the latest status for one order.
Endpoint
GET /orders/:energyOrderIdExample Request
curl --request GET \
--url 'https://back.2aml.com/external/tron-energy/orders/ITRX-ORDER-0001' \
--header 'Authorization: Bearer <accessToken>'Example Response
{
"energyOrderId": "ITRX-ORDER-0001",
"orderId": "ORD-20260413-TRON-0001",
"status": "completed",
"receiver": "TGzz8gjYiYRqpfmDwnLxfgPuLVNmpCswVp",
"energy": 65000,
"duration": 1,
"period": "1D",
"amountTrx": "14.520000",
"chargedAmountTrx": "14.520000",
"transactionHash": "aabbccddeeff001122...",
"message": "Order completed successfully.",
"createdAt": "2026-04-15T12:00:00.000Z",
"updatedAt": "2026-04-15T12:30:00.000Z"
}Error Responses
Errors use the following envelope:
{
"statusCode": 400,
"timestamp": "2026-04-15T12:00:00.000Z",
"path": "/external/tron-energy/orders",
"error": {
"message": "Order request is invalid."
}
}Common messages:
| Status | Example message | Meaning |
|---|---|---|
400 | Order request is invalid. | Validation failed or the payload is inconsistent. |
400 | Insufficient wallet balance for this order. | The wallet balance does not cover the requested order. |
400 | Two-factor login challenge is invalid or expired. | The sign-in challenge token or submitted code is invalid, expired, or no longer usable. |
400 | Email verification token is invalid or expired. | The verification token is invalid or has expired. |
401 | Authentication is required. | The endpoint needs a valid bearer token. |
401 | Email or password is incorrect. | Login credentials were rejected. |
404 | Order not found. | The requested energyOrderId does not belong to the authenticated user. |
409 | An order with this idempotency key is already being processed. | Reuse the same key later instead of sending a new create request. |
429 | Too many requests. Please try again shortly. | Temporary rate limit. |
503 | TRON energy service is temporarily unavailable. | Temporary upstream or service availability issue. |
Reference Notes
- Use
GET /wallet/summaryafter create or reconcile calls if your UI needs a fresh balance snapshot. - If you set
callbackUrl, continue to pollGET /orders/:energyOrderIduntil the order reaches a terminal status. - Keep
orderIdunique inside your own business domain and keepidempotencyKeystable across retries of the same create request.

