> For the complete documentation index, see [llms.txt](https://tron-energy.gitbook.io/tronzap/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tron-energy.gitbook.io/tronzap/for-developers/tron-energy-api.md).

# Tron Energy API

TronZap provides a REST API for programmatic access to TRON energy rental. Integrate energy leasing, address activation, and subscription management into your applications.

* **Base URL:** `https://api.tronzap.com`
* **Full API documentation:** <https://docs.tronzap.com/>

***

## Authentication

All API requests require a Bearer token and a SHA256 signature.

**Headers:**

| Header          | Description             |
| --------------- | ----------------------- |
| `Authorization` | `Bearer YOUR_API_TOKEN` |
| `X-Signature`   | `YOUR_SIGNATURE`        |
| `Content-Type`  | `application/json`      |

**Signature formula:**

```
Signature = SHA256(requestBody + apiSecret)
```

The signature is computed from the raw request body concatenated with your API secret. Credentials are obtained from the dashboard.

* **Authentication guide:** <https://docs.tronzap.com/api/authentication.html>
* **Obtain credentials:** <https://dash.tronzap.com/api>

***

## API Endpoints

| Category            | Method | Endpoint                    | Description                                   |
| ------------------- | ------ | --------------------------- | --------------------------------------------- |
| **Services**        | POST   | `/v1/services`              | Available services and pricing                |
| **Balance**         | POST   | `/v1/balance`               | Account balance and info                      |
| **Estimate Energy** | POST   | `/v1/estimate-energy`       | Estimate energy needed for a USDT transfer    |
| **Calculate**       | POST   | `/v1/calculate`             | Calculate cost without creating a transaction |
| **Transactions**    | POST   | `/v1/transaction/new`       | Create a new transaction                      |
|                     | POST   | `/v1/transaction/check`     | Check transaction status                      |
| **Subscriptions**   | POST   | `/v1/subscriptions`         | List subscriptions                            |
|                     | POST   | `/v1/subscription/start`    | Start a subscription                          |
|                     | POST   | `/v1/subscription/check`    | Check subscription status                     |
|                     | POST   | `/v1/subscription/stop`     | Stop a subscription                           |
|                     | POST   | `/v1/subscriptions/history` | Subscription history                          |
| **AML Checks**      | POST   | `/v1/aml-checks`            | List AML check services                       |
|                     | POST   | `/v1/aml-checks/new`        | Create AML check                              |
|                     | POST   | `/v1/aml-checks/check`      | Check AML status                              |
|                     | POST   | `/v1/aml-checks/history`    | AML check history                             |
| **Direct Recharge** | POST   | `/v1/direct-recharge-info`  | Direct recharge information                   |

**Reference links:**

* [Full API reference](https://docs.tronzap.com/api/)
* [Error codes](https://docs.tronzap.com/api/error-codes.html)
* [Transaction statuses](https://docs.tronzap.com/api/transaction-statuses.html)

***

## Official SDKs

| Language | Install Command                                       | GitHub                                                                         |
| -------- | ----------------------------------------------------- | ------------------------------------------------------------------------------ |
| PHP      | `composer require tron-energy-market/tronzap-sdk-php` | [tronzap-sdk-php](https://github.com/tron-energy-market/tronzap-sdk-php)       |
| Node.js  | `npm install tronzap-sdk`                             | [tronzap-sdk-nodejs](https://github.com/tron-energy-market/tronzap-sdk-nodejs) |
| Python   | `pip install tronzap-sdk`                             | [tronzap-sdk-python](https://github.com/tron-energy-market/tronzap-sdk-python) |

The Node.js SDK supports Node.js v16+, Deno v1.0+, and Bun v1.0+.

***

## Quick Example

```javascript
import { TronZapClient, TronZapError } from 'tronzap-sdk';

const client = new TronZapClient({
  apiToken: 'your_api_token',
  apiSecret: 'your_api_secret'
});

// Get available services
const services = await client.getServices();

// Create energy transaction
const transaction = await client.createEnergyTransaction(
  'TRON_WALLET_ADDRESS',
  65150,    // energy amount
  1,        // duration in hours
  'my-tx',  // optional external ID
  false     // activate address if needed
);

// Check transaction status
const status = await client.checkTransaction(transaction.result.transaction_id);
```

***

## SDK Features

* Automatic signature generation
* Energy transactions
* Address activation
* Subscription management
* Transaction status checking
* Balance queries

***

## API Request Flow

```mermaid
sequenceDiagram
    participant Client as Client App
    participant SDK as SDK
    participant API as TronZap API
    participant TRON as TRON Network

    Client->>SDK: Call SDK method
    SDK->>SDK: Generate signature
    SDK->>API: Authenticated request
    API->>TRON: Process transaction
    TRON-->>API: Result
    API-->>SDK: Response
    SDK-->>Client: Parsed result
```

***

## Additional Resources

* **Postman Collection:** <https://www.postman.com/tron-energy/tronzap-com/overview>
* **GitHub Organization:** <https://github.com/tron-energy-market>
* **Full API Docs:** <https://docs.tronzap.com/>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://tron-energy.gitbook.io/tronzap/for-developers/tron-energy-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
