Skip to content

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

FieldTypeRequiredDescription
referral_codestringno*Your referral code. Commission for this order is credited to its owner. Max 64 chars.
address_fromstringyesTRON address that will send the TRX payment.
address_tostringyesTRON address that will receive the energy and bandwidth.
resources.durationintegeryesResource rental duration in hours. Must be 1.
resources.energyintegerno**Amount of energy to deliver.
resources.bandwidthintegerno**Amount of bandwidth to deliver.
address_to_activationbooleannoIf 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 polling
php
$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 here
python
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 here

Response

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

FieldTypeDescription
order_idstringULID of the created order. Use for check and cancel.
statusstringAlways new for a freshly created order.
deposit_addressstringThe user must send TRX from address_from to this address.
amountnumberExact TRX amount to send. Any deviation will not match the order.
currencystringAlways TRX.
expires_atstringISO-8601 timestamp. Order auto-transitions to expired after this.
ttlintegerSeconds 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.

TronZap Partner Documentation