Docs

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-energy

Authentication

Public endpoints:

  • POST /auth/register
  • POST /auth/login
  • POST /auth/login/2fa
  • POST /auth/verify-email/request
  • POST /auth/verify-email/confirm
  • GET /quote

Protected endpoints require the bearer token returned by one of the following successful flows:

  • POST /auth/register
  • POST /auth/login when status=authenticated
  • POST /auth/login/2fa

POST /auth/login is branch-aware. A successful credential check can return one of the following statuses:

  • authenticated
  • two_factor_required
  • email_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_identifier

If 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 status field when you call POST /auth/login.
  • orderId is your business identifier for create requests.
  • energyOrderId is the canonical identifier for later status and history calls.
  • idempotencyKey is recommended for retriable order creation calls.
  • Prefer period for new integrations. duration is available for compatibility.

Integration Flow

Recommended integration sequence:

  1. Call POST /auth/register or POST /auth/login.
  2. If POST /auth/login returns two_factor_required, call POST /auth/login/2fa.
  3. If POST /auth/login returns email_verification_required, complete the email verification flow and then sign in again.
  4. Call GET /auth/profile to load the authenticated account state.
  5. Call GET /wallet/summary.
  6. If the wallet balance is low, call GET /wallet/deposit-instructions.
  7. Use GET /wallet/history when you need a unified balance activity feed.
  8. After the on-chain TRX transfer is confirmed, optionally call POST /wallet/topups/reconcile.
  9. Call GET /quote.
  10. Call POST /orders.
  11. Poll GET /orders/:energyOrderId or read GET /orders until a terminal status is reached.

Order Status

StatusTerminalDescription
pending_confirmationNoThe order request is accepted and is waiting for final confirmation.
processingNoThe order is actively being processed.
completedYesThe order completed successfully.
refundedYesThe charged amount was returned to the wallet.
failedYesThe order could not be completed.

Integration rules:

  • stop polling after a terminal status is returned
  • branch on status, not on the free-text message
  • preserve energyOrderId exactly as returned

Endpoint Summary

MethodPathPurpose
POST/auth/registerRegister a new customer account, return a bearer token, and send an account verification email
POST/auth/loginAuthenticate a customer and return the next sign-in step
POST/auth/login/2faComplete a pending two-factor sign-in challenge
POST/auth/verify-email/requestRequest a new account verification email
POST/auth/verify-email/confirmConfirm an email verification token
GET/auth/profileGet the authenticated customer profile and security state
GET/wallet/summaryGet the authenticated wallet balance
GET/wallet/deposit-instructionsGet the TRX deposit address for wallet top-up
GET/wallet/historyList sanitized wallet balance activity
GET/wallet/topupsList wallet top-up records
POST/wallet/topups/reconcileReconcile a confirmed TRX transfer into the wallet
GET/quoteGet a TRON energy quote
POST/ordersCreate a TRON energy order billed from wallet balance
GET/ordersList authenticated TRON energy orders
GET/orders/:energyOrderIdGet 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/register

Request Body

FieldTypeRequiredDescription
emailstringYesCustomer email address.
passwordstringYesPassword with at least 6 characters.
referralCodestringNoOptional 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/login

Request Body

FieldTypeRequiredDescription
emailstringYesCustomer email address.
passwordstringYesCustomer 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/2fa

Request Body

FieldTypeRequiredDescription
challengeTokenstringYesChallenge token returned by POST /auth/login.
codestringYesCurrent 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/request

Request Body

FieldTypeRequiredDescription
emailstringYesAccount 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/confirm

Request Body

FieldTypeRequiredDescription
tokenstringYesVerification 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/profile

Example 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/summary

Example 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-instructions

Example 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=20

Example 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=20

Example 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/reconcile

Request Body

FieldTypeRequiredDescription
txHashstringYes64-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 /quote

Query Parameters

FieldTypeRequiredDescription
receiverstringYesDestination TRON wallet that should receive rented energy.
energyintegerYesRequested energy amount. Minimum: 10000.
periodstringNoPreferred lease period. Example: 1H, 1D, 3D, 30D.
durationintegerNoCompatibility 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 /orders

Request Body

FieldTypeRequiredDescription
orderIdstringYesYour business identifier for this order.
receiverstringYesDestination TRON wallet.
energyintegerYesRequested energy amount.
periodstringNoPreferred lease period.
durationintegerNoCompatibility field.
notestringNoOptional internal customer note.
callbackUrlstringNoOptional webhook URL to receive order callbacks.
idempotencyKeystringNoRecommended 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=20

Example 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/:energyOrderId

Example 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:

StatusExample messageMeaning
400Order request is invalid.Validation failed or the payload is inconsistent.
400Insufficient wallet balance for this order.The wallet balance does not cover the requested order.
400Two-factor login challenge is invalid or expired.The sign-in challenge token or submitted code is invalid, expired, or no longer usable.
400Email verification token is invalid or expired.The verification token is invalid or has expired.
401Authentication is required.The endpoint needs a valid bearer token.
401Email or password is incorrect.Login credentials were rejected.
404Order not found.The requested energyOrderId does not belong to the authenticated user.
409An order with this idempotency key is already being processed.Reuse the same key later instead of sending a new create request.
429Too many requests. Please try again shortly.Temporary rate limit.
503TRON energy service is temporarily unavailable.Temporary upstream or service availability issue.

Reference Notes

  • Use GET /wallet/summary after create or reconcile calls if your UI needs a fresh balance snapshot.
  • If you set callbackUrl, continue to poll GET /orders/:energyOrderId until the order reaches a terminal status.
  • Keep orderId unique inside your own business domain and keep idempotencyKey stable across retries of the same create request.
2AML2AML

2AML is a technology and integration platform for digital asset workflows, built to provide clear service flows, transaction visibility, and support tools.

© 2026 2AML. All rights reserved. Use of this platform is subject to our Terms of Service.

Trustpilot