Create Order
POST /v1/orders
Creates an energy order and returns a deposit address. The user must send exactly amount TRX from address_from to deposit_address to trigger delivery.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
referral_code | string | no* | Your referral code. Commission for this order is credited to its owner. Max 64 chars. |
address_from | string | yes | TRON address that will send the TRX payment. |
address_to | string | yes | TRON address that will receive the energy and bandwidth. |
resources.duration | integer | yes | Resource rental duration in hours. Must be 1. |
resources.energy | integer | no** | Amount of energy to deliver. |
resources.bandwidth | integer | no** | Amount of bandwidth to deliver. |
address_to_activation | boolean | no | If true, activates address_to on-chain. Defaults to false. |
* Required for partner commission. Without a valid referral_code, the order is not attributed to any partner account.
** At least one of resources.energy or resources.bandwidth must be greater than zero.
Always include referral_code
Pass referral_code in every POST /v1/orders call. Missing or empty referral_code means no commission is earned — even if the order completes successfully.
Examples
bash
curl -X POST https://api.tronzap.com/v1/orders \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"referral_code": "YOUR_CODE",
"address_from": "TKzxdSv2FZKQrEqkKVgp5DcwEXBEKMg2Ax",
"address_to": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
"resources": {
"duration": 1,
"energy": 65000
}
}'javascript
const response = await fetch('https://api.tronzap.com/v1/orders', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
},
body: JSON.stringify({
referral_code: 'YOUR_CODE',
address_from: 'TKzxdSv2FZKQrEqkKVgp5DcwEXBEKMg2Ax',
address_to: 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',
resources: { duration: 1, energy: 65000 },
}),
})
const { result } = await response.json()
// result.deposit_address — send result.amount TRX here
// result.order_id — save for pollingphp
$response = file_get_contents('https://api.tronzap.com/v1/orders', false, stream_context_create([
'http' => [
'method' => 'POST',
'header' => "Content-Type: application/json\r\nAccept: application/json",
'content' => json_encode([
'referral_code' => 'YOUR_CODE',
'address_from' => 'TKzxdSv2FZKQrEqkKVgp5DcwEXBEKMg2Ax',
'address_to' => 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',
'resources' => ['duration' => 1, 'energy' => 65000],
]),
],
]));
$data = json_decode($response, true)['result'];
// $data['deposit_address'] — send $data['amount'] TRX herepython
import requests
resp = requests.post('https://api.tronzap.com/v1/orders', json={
'referral_code': 'YOUR_CODE',
'address_from': 'TKzxdSv2FZKQrEqkKVgp5DcwEXBEKMg2Ax',
'address_to': 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',
'resources': {'duration': 1, 'energy': 65000},
})
result = resp.json()['result']
# result['deposit_address'] — send result['amount'] TRX hereResponse
json
{
"code": 0,
"request_id": "550e8400-e29b-41d4-a716-446655440000",
"result": {
"order_id": "01HZX5N6Q9TY3K2P0VWB7HRD4M",
"status": "new",
"deposit_address": "TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7",
"amount": 2.69,
"currency": "TRX",
"expires_at": "2026-05-18T16:07:05+00:00",
"ttl": 3600
}
}Response fields
| Field | Type | Description |
|---|---|---|
order_id | string | ULID of the created order. Use for check and cancel. |
status | string | Always new for a freshly created order. |
deposit_address | string | The user must send TRX from address_from to this address. |
amount | number | Exact TRX amount to send. Any deviation will not match the order. |
currency | string | Always TRX. |
expires_at | string | ISO-8601 timestamp. Order auto-transitions to expired after this. |
ttl | integer | Seconds remaining until expires_at. Typically 3600 (1 hour). |
Exact amount and sender required
The TRX transfer must originate from address_from and be exactly amount TRX. Any other amount or sender address will not match the order.
