Production API
Create an order
Create an idempotent Energy rental and receive its fixed amount and polling URL.
POST
/v1/energy/ordersOn this page
Every business event needs a stable unique client_request_id. This is the required duplicate protection for network retries.
Request body
{"client_request_id":"order-1042","address":"TXYZ","energy":65000,"duration_hours":1,"expected_total_trx":"3.200000"}
| Field | Type | Required | Description |
|---|---|---|---|
client_request_id |
string | yes | Your unique operation ID. Reuse it only for this exact order. |
address |
string | yes | Valid TRON destination address. |
energy |
integer | yes | Positive amount divisible by the portion size. |
duration_hours |
integer | yes | Allowed duration from options. |
expected_total_trx |
string | yes | Exact six-decimal total_trx from the latest quote. |
Unknown JSON properties are rejected. Send Content-Type: application/json.
Response 201 or 200
{"id":"7c0c9a54-517c-4bbb-a946-bf14bf86c113","client_request_id":"order-1042","address":"TXYZ","energy":65000,"duration_hours":1,"total_trx":"3.200000","status":"created","lifecycle_final":false,"delivery_final":false,"created_at":1784376000,"updated_at":1784376000,"failure":null}
201 Created— a new order;Locationcontains/v1/energy/orders/{id}.200 OK— an exact idempotent replay returned the existing order.409 Conflictwithcode: energy_order_idempotency_conflict— the sameclient_request_idwas used with a different address, amount, or duration.409 Conflictwithcode: energy_price_changed— fetch a new quote and submit again. No order was created and no TRX was held.
Idempotency
After a timeout, do not generate a new ID. Replay the same body and client_request_id. Generate a new ID only for a new business event.
State fields
status describes the current stage. Automation should use lifecycle_final and delivery_final, not a hard-coded status list. See get an order.
Errors
Possible statuses are 400, 401, 409, 413, 415, 429, and 503. Do not automatically retry 400, 401, 409, 413, or 415 without correcting the cause.
Rentron