Skip to content

Energy Change PRO Rental API Documentation

Complete documentation for the Energy Rental API that allows you to rent energy for TRON blockchain addresses programmatically.

Table of Contents

Overview

The Energy Rental API is a RESTful service that enables developers to:

  • Rent energy for TRON addresses
  • Manage orders and track their status
  • Check pricing for different rental periods
  • Validate addresses before renting

Base URL

All API requests should be made to:

Text Only
https://api.change.pro

Supported Rental Periods

Period Duration Use Case
1 hour Short-term Quick transactions
24 hours Daily Regular usage
72 hours 3 days Weekend projects
720 hours 30 days Long-term applications

Important note

To receive energy, it is necessary that the wallet balance be at least 1 TRX.

Authentication

The Energy Rental API uses API keys to authenticate requests. You need to include your API key in the header X-AUTH-KEY of every request.

Getting Your API Key

Get API Key

  1. Sign in to your account at change.pro/sign-in
  2. Navigate to account settings
  3. Copy your API key

Warning: Your API key carries many privileges, so be sure to keep it secure! Do not share your API key in publicly accessible areas such as GitHub, client-side code, and so forth.

Using Your API Key

Include your API key in the X-AUTH-KEY header for all requests:

Bash
curl "https://api.change.pro/energy/orders" \
  -H "X-AUTH-KEY: your_api_key_here"

Authentication Examples

PHP
<?php
$api_key = 'your_api_key_here';

$headers = [
    'X-AUTH-KEY: ' . $api_key,
    'Content-Type: application/json'
];

$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => 'https://api.change.pro/energy/orders',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => $headers
]);

$response = curl_exec($curl);
curl_close($curl);
?>
Python
import requests

api_key = 'your_api_key_here'

headers = {
    'X-AUTH-KEY': api_key,
    'Content-Type': 'application/json'
}

response = requests.get(
    'https://api.change.pro/energy/orders',
    headers=headers
)

Authentication Errors

Status Code Error Description
401 Unauthorized API key is missing or invalid
403 Forbidden API key doesn't have required permissions

Example error response:

JSON
{
    "result": false,
    "error": {
        "code": "UNAUTHORIZED",
        "message": "Invalid or missing API key"
    }
}

Quick Start

This guide will help you make your first API call to rent energy for a TRON address.

Prerequisites

Before you begin, make sure you have:

  • A valid API key
  • A TRON address that needs energy
  • Your preferred programming language setup

Step 1: Check Address Eligibility

First, verify that your TRON address can receive rented energy:

Bash
curl "https://api.change.pro/check-address?address=TMb92HnV4J9d794VA5R7A5EeXxqY5f4Yi6" \
  -H "X-AUTH-KEY: your_api_key_here"
PHP
<?php
$api_key = 'your_api_key_here';
$address = 'TMb92HnV4J9d794VA5R7A5EeXxqY5f4Yi6';

$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => "https://api.change.pro/check-address?address={$address}",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["X-AUTH-KEY: {$api_key}"]
]);

$response = curl_exec($curl);
$data = json_decode($response, true);
curl_close($curl);

if ($data['data']['can_rent']) {
    echo "Address is eligible for energy rental!";
}
?>
Python
import requests

api_key = 'your_api_key_here'
address = 'TMb92HnV4J9d794VA5R7A5EeXxqY5f4Yi6'

response = requests.get(
    f'https://api.change.pro/check-address?address={address}',
    headers={'X-AUTH-KEY': api_key}
)

data = response.json()
if data['data']['can_rent']:
    print("Address is eligible for energy rental!")

Expected Response:

JSON
{
    "result": true,
    "data": {
        "can_rent": true
    }
}

Step 2: Check Current Pricing

Let's see the current pricing for energy rental:

Bash
curl "https://api.change.pro/energy/pricing" \
  -H "X-AUTH-KEY: your_api_key_here"
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => 'https://api.change.pro/energy/pricing',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["X-AUTH-KEY: {$api_key}"]
]);

$response = curl_exec($curl);
$pricing = json_decode($response, true);
curl_close($curl);

echo "1-hour rental costs: {$pricing['data']['period_hours']['1']['USDT']} USDT";
?>
Python
response = requests.get(
    'https://api.change.pro/energy/pricing',
    headers={'X-AUTH-KEY': api_key}
)

pricing = response.json()
print(f"1-hour rental costs: {pricing['data']['period_hours']['1']['USDT']} USDT")

Step 3: Create Your First Energy Rental Order

Now let's rent energy for 1 hour:

Bash
curl -X POST "https://api.change.pro/energy/orders" \
  -H "X-AUTH-KEY: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "receive_address": "TMb92HnV4J9d794VA5R7A5EeXxqY5f4Yi6",
    "period_hours": 1,
    "energy_amount": 65000
  }'
PHP
<?php
$order_data = [
    'receive_address' => 'TMb92HnV4J9d794VA5R7A5EeXxqY5f4Yi6',
    'period_hours' => 1,
    'energy_amount' => 65000
];

$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => 'https://api.change.pro/energy/orders',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => json_encode($order_data),
    CURLOPT_HTTPHEADER => [
        "X-AUTH-KEY: {$api_key}",
        'Content-Type: application/json'
    ]
]);

$response = curl_exec($curl);
$order = json_decode($response, true);
curl_close($curl);

echo "Order created! ID: {$order['data']['id']}";
echo "Status: {$order['data']['status']}";
?>
Python
order_data = {
    'receive_address': 'TMb92HnV4J9d794VA5R7A5EeXxqY5f4Yi6',
    'period_hours': 1,
    'energy_amount': 65000
}

response = requests.post(
    'https://api.change.pro/energy/orders',
    headers={
        'X-AUTH-KEY': api_key,
        'Content-Type': 'application/json'
    },
    json=order_data
)

order = response.json()
print(f"Order created! ID: {order['data']['id']}")
print(f"Status: {order['data']['status']}")

Expected Response:

JSON
{
    "result": true,
    "data": {
        "id": "01960f81-4349-7ecd-bbba-82142a5c643f",
        "status": "pending",
        "receive_address": "TMb92HnV4J9d794VA5R7A5EeXxqY5f4Yi6",
        "period_hours": 1,
        "energy_amount": 65000,
        "price": {
            "amount": "1.13",
            "currency": "USDT"
        },
        "transaction": [],
        "created_at": "2025-04-07T16:07:31+07:00",
        "updated_at": null
    }
}

API Reference

Orders API

The Orders API allows you to create, retrieve, and manage energy rental orders.

List All Orders

Retrieve a paginated list of all your energy rental orders.

Endpoint: GET /energy/orders

Parameters:

Parameter Type Required Default Description
page integer No 1 Page number for pagination

Example Request:

Bash
curl "https://api.change.pro/energy/orders?page=1" \
  -H "X-AUTH-KEY: your_api_key_here"

Response:

JSON
{
    "data": [
        {
            "id": "01960f81-4349-7ecd-bbba-82142a5c643f",
            "status": "pending",
            "receive_address": "TMb92HnV4J9d794VA5R7A5EeXxqY5f4Yi6",
            "period_hours": 1,
            "energy_amount": 65000,
            "price": {
                "amount": "1.13",
                "currency": "USDT"
            },
            "transaction": [],
            "created_at": "2025-04-07T16:07:31+07:00",
            "updated_at": null
        }
    ],
    "pagination": {
        "total_items": 6,
        "current_page": 1,
        "total_pages": 1,
        "items_per_page": 30
    }
}

Get Specific Order

Retrieve detailed information about a specific order.

Endpoint: GET /energy/orders/{id}

URL Parameters:

Parameter Type Required Description
id string Yes Unique order identifier

Example Request:

Bash
curl "https://api.change.pro/energy/orders/01960f81-4349-7ecd-bbba-82142a5c643f" \
  -H "X-AUTH-KEY: your_api_key_here"

Response:

JSON
{
    "result": true,
    "data": {
        "id": "01960f81-4349-7ecd-bbba-82142a5c643f",
        "status": "pending",
        "receive_address": "TMb92HnV4J9d794VA5R7A5EeXxqY5f4Yi6",
        "period_hours": 1,
        "energy_amount": 65000,
        "price": {
            "amount": "1.13",
            "currency": "USDT"
        },
        "transaction": [],
        "created_at": "2025-04-07T16:07:31+07:00",
        "updated_at": null
    }
}

Create Energy Rental Order

Create a new energy rental order for a TRON address.

Endpoint: POST /energy/orders

Request Body:

Parameter Type Required Validation Description
receive_address string Yes ^T[a-km-zA-HJ-NP-Z1-9]{33}$ TRON address to receive energy
period_hours integer Yes 1, 24, 72, 720 Rental period in hours
energy_amount integer Yes 65000-1000000 Amount of energy to rent

Example Request:

Bash
curl -X POST "https://api.change.pro/energy/orders" \
  -H "X-AUTH-KEY: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "receive_address": "TMb92HnV4J9d794VA5R7A5EeXxqY5f4Yi6",
    "period_hours": 1,
    "energy_amount": 65000
  }'

Response:

JSON
{
    "result": true,
    "data": {
        "id": "01960f81-4349-7ecd-bbba-82142a5c643f",
        "status": "pending",
        "receive_address": "TMb92HnV4J9d794VA5R7A5EeXxqY5f4Yi6",
        "period_hours": 1,
        "energy_amount": 65000,
        "price": {
            "amount": "1.13",
            "currency": "USDT"
        },
        "transaction": [],
        "created_at": "2025-04-07T16:07:31+07:00",
        "updated_at": null
    }
}

Order Object Reference

Order Properties:

Property Type Description
id string Unique order identifier (UUID)
status string Current order status
receive_address string TRON address receiving the energy
period_hours integer Rental duration in hours
energy_amount integer Amount of energy in the order
price object Price information
price.amount string Price amount as decimal string
price.currency string Currency (USDT or TRX)
transaction array/object Transaction details when completed
created_at string ISO 8601 timestamp of creation
updated_at string ISO 8601 timestamp of last update

Order Statuses:

Status Description
pending Order created, awaiting processing
completed Energy successfully delivered to address
failed Order failed due to an error

Address Validation API

The Address Validation API allows you to check if a TRON address is eligible to receive rented energy before creating an order.

Check Address Eligibility

Validate whether a TRON address can receive rented energy.

Endpoint: GET /check-address

Parameters:

Parameter Type Required Description
address string Yes TRON address to validate

Example Request:

Bash
curl "https://api.change.pro/check-address?address=TMb92HnV4J9d794VA5R7A5EeXxqY5f4Yi6" \
  -H "X-AUTH-KEY: your_api_key_here"

Response:

JSON
{
    "result": true,
    "data": {
        "can_rent": true
    }
}

Address Format Requirements

TRON addresses must meet these criteria:

Format Pattern:

Text Only
^T[a-km-zA-HJ-NP-Z1-9]{33}$

Valid Characters: - Must start with 'T' - Followed by 33 characters from the set: a-k, m-z, A-H, J-N, P-Z, 1-9 - Total length: 34 characters

Valid TRON Addresses:

Text Only
TMb92HnV4J9d794VA5R7A5EeXxqY5f4Yi6
TRWBqiqoFZysoAeyR1J35ibuyc8EvhUAoY
TPYmHEhy5n8TCEfYGqW2rPxsghSfzghPDn

Invalid Addresses:

Text Only
0x742d35Cc6634C0532925a3b8D437C5dFABBbC9f96  // Ethereum address
TMb92HnV4J9d794VA5R7A5EeXxqY5f4Yi        // Too short
TB92HnV4J9d794VA5R7A5EeXxqY5f4Yi6        // Invalid character 'B'
TMb92HnV4J9d794VA5R7A5EeXxqY5f4Yi60       // Too long

Pricing API

The Pricing API provides current pricing information for energy rental across different periods and currencies.

Get Current Pricing

Retrieve the latest pricing for energy rental packages.

Endpoint: GET /energy/pricing

Example Request:

Bash
curl "https://api.change.pro/energy/pricing" \
  -H "X-AUTH-KEY: your_api_key_here"

Response:

JSON
{
    "result": true,
    "data": {
        "energy_amount": 65000,
        "period_hours": {
            "1": {
                "TRX": 5.125,
                "USDT": 1.47
            },
            "24": {
                "TRX": 11.95,
                "USDT": 3.42
            },
            "72": {
                "TRX": 25.08,
                "USDT": 7.18
            },
            "720": {
                "TRX": 234.25,
                "USDT": 67.09
            }
        }
    }
}

Pricing Object Reference

Pricing Properties:

Attribute Type Description
energy_amount integer Standard energy amount (65,000)
period_hours object Pricing for different rental periods
period_hours.1 object 1-hour rental prices
period_hours.24 object 24-hour rental prices
period_hours.72 object 72-hour rental prices
period_hours.720 object 720-hour (30-day) rental prices

Each period contains pricing in both TRX and USDT currencies.

Error Handling

The API uses conventional HTTP response codes to indicate the success or failure of an API request.

HTTP Status Codes

Code Meaning
200 OK -- Your request was successful
400 Bad Request -- Your request is invalid
401 Unauthorized -- Your API key is wrong
403 Forbidden -- You don't have permission to access this resource
404 Not Found -- The specified resource could not be found
429 Too Many Requests -- You're making too many requests
500 Internal Server Error -- We had a problem with our server
503 Service Unavailable -- We're temporarily offline for maintenance

Error Response Format

JSON
{
    "result": false,
    "error": {
        "code": "INVALID_ADDRESS",
        "message": "The provided address is not a valid TRON address"
    }
}

Common Error Codes

Invalid Address

JSON
{
    "result": false,
    "error": {
        "code": "INVALID_ADDRESS",
        "message": "The provided address is not a valid TRON address"
    }
}

Invalid Period

JSON
{
    "result": false,
    "error": {
        "code": "INVALID_PERIOD",
        "message": "Period must be one of: 1, 24, 72, 720 hours"
    }
}

Invalid Energy Amount

JSON
{
    "result": false,
    "error": {
        "code": "INVALID_AMOUNT",
        "message": "Energy amount must be between 65000 and 1000000"
    }
}

Order Not Found

JSON
{
    "result": false,
    "error": {
        "code": "ORDER_NOT_FOUND",
        "message": "Order with the specified ID was not found"
    }
}

Rate Limiting

API requests are subject to rate limiting to ensure fair usage and system stability. If you exceed the rate limit, you'll receive a 429 Too Many Requests response.

Complete Example

Here's a complete working example that combines all the steps:

PHP Implementation

PHP
<?php
class EnergyRentalAPI {
    private $api_key;
    private $base_url = 'https://api.change.pro';

    public function __construct($api_key) {
        $this->api_key = $api_key;
    }

    private function makeRequest($endpoint, $method = 'GET', $data = null) {
        $curl = curl_init();
        $headers = ["X-AUTH-KEY: {$this->api_key}"];

        $options = [
            CURLOPT_URL => $this->base_url . $endpoint,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_HTTPHEADER => $headers
        ];

        if ($method === 'POST') {
            $options[CURLOPT_POST] = true;
            if ($data) {
                $options[CURLOPT_POSTFIELDS] = json_encode($data);
                $headers[] = 'Content-Type: application/json';
                $options[CURLOPT_HTTPHEADER] = $headers;
            }
        }

        curl_setopt_array($curl, $options);
        $response = curl_exec($curl);
        curl_close($curl);

        return json_decode($response, true);
    }

    public function checkAddress($address) {
        return $this->makeRequest("/check-address?address={$address}");
    }

    public function getPricing() {
        return $this->makeRequest('/energy/pricing');
    }

    public function createOrder($address, $period_hours, $energy_amount) {
        $data = [
            'receive_address' => $address,
            'period_hours' => $period_hours,
            'energy_amount' => $energy_amount
        ];
        return $this->makeRequest('/energy/orders', 'POST', $data);
    }

    public function getOrder($order_id) {
        return $this->makeRequest("/energy/orders/{$order_id}");
    }
}

// Usage
$api = new EnergyRentalAPI('your_api_key_here');
$address = 'TMb92HnV4J9d794VA5R7A5EeXxqY5f4Yi6';

// Check if address can rent energy
$check = $api->checkAddress($address);
if (!$check['data']['can_rent']) {
    die('Address cannot rent energy');
}

// Create order
$order = $api->createOrder($address, 1, 65000);
echo "Order created: {$order['data']['id']}\n";
?>

Python Implementation

Python
import requests

class EnergyRentalAPI:
    def __init__(self, api_key):
        self.api_key = api_key
        self.base_url = 'https://api.change.pro'
        self.session = requests.Session()
        self.session.headers.update({'X-AUTH-KEY': api_key})

    def check_address(self, address):
        response = self.session.get(f'{self.base_url}/check-address?address={address}')
        return response.json()

    def get_pricing(self):
        response = self.session.get(f'{self.base_url}/energy/pricing')
        return response.json()

    def create_order(self, address, period_hours, energy_amount):
        data = {
            'receive_address': address,
            'period_hours': period_hours,
            'energy_amount': energy_amount
        }
        response = self.session.post(f'{self.base_url}/energy/orders', json=data)
        return response.json()

    def get_order(self, order_id):
        response = self.session.get(f'{self.base_url}/energy/orders/{order_id}')
        return response.json()

# Usage
api = EnergyRentalAPI('your_api_key_here')
address = 'TMb92HnV4J9d794VA5R7A5EeXxqY5f4Yi6'

# Check if address can rent energy
check = api.check_address(address)
if not check['data']['can_rent']:
    raise Exception('Address cannot rent energy')

# Create order
order = api.create_order(address, 1, 65000)
print(f"Order created: {order['data']['id']}")

Support

If you need help with the API:

  1. Check the error handling guide above
  2. Verify your API key is correct
  3. Ensure the TRON address format is valid
  4. Contact support at change.pro

For API key management, visit your account settings.