Place an order
const url = 'https://trongas.ai/api/v1/orders';const options = { method: 'POST', headers: { 'Idempotency-Key': 'example', 'X-Api-Key': '<X-Api-Key>', 'Content-Type': 'application/json' }, body: '{"resource":"example","targetAddress":"example","volume":1,"duration":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://trongas.ai/api/v1/orders \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: example' \ --header 'X-Api-Key: <X-Api-Key>' \ --data '{ "resource": "example", "targetAddress": "example", "volume": 1, "duration": "example" }'Required API-key scope: purchase
Buy energy or bandwidth for an address, paid from your TRX balance.
Requires an Idempotency-Key header: retrying with the same key returns the original order instead of charging twice — always send one, and reuse it on retry.
The order settles asynchronously; it is Created on return and becomes Filled once the provider delivers. Subscribe to the order.filled / order.failed webhooks rather than polling.
402 wallet.insufficient_balance — not enough TRX. 502 — provider failed and your balance was refunded.
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Header Parameters
Section titled “Header Parameters”Unique string per logical order (e.g. a UUID). Retrying with the same key returns the original order instead of charging twice. Required.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Examplegenerated
{ "resource": "example", "targetAddress": "example", "volume": 1, "duration": "example"}object
Examplegenerated
{ "resource": "example", "targetAddress": "example", "volume": 1, "duration": "example"}object
Examplegenerated
{ "resource": "example", "targetAddress": "example", "volume": 1, "duration": "example"}Responses
Section titled “ Responses ”OK
object
object
Examplegenerated
{ "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "resource": "example", "targetAddress": "example", "volume": 1, "duration": "example", "priceTrx": "example", "activationTrx": "example", "totalTrx": "example", "status": "example", "txId": "example", "createdAt": "2026-04-15T12:00:00Z"}object
Examplegenerated
{ "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "resource": "example", "targetAddress": "example", "volume": 1, "duration": "example", "priceTrx": "example", "activationTrx": "example", "totalTrx": "example", "status": "example", "txId": "example", "createdAt": "2026-04-15T12:00:00Z"}Payment Required
object
Machine-readable error code, e.g. wallet.insufficient_balance. Branch on this, not on title. Always present: validation_failed for request validation (400, with per-field errors), unauthorized for 401, domain codes otherwise.
object
Machine-readable error code, e.g. wallet.insufficient_balance. Branch on this, not on title. Always present: validation_failed for request validation (400, with per-field errors), unauthorized for 401, domain codes otherwise.
Examplegenerated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example", "code": "example"}object
Machine-readable error code, e.g. wallet.insufficient_balance. Branch on this, not on title. Always present: validation_failed for request validation (400, with per-field errors), unauthorized for 401, domain codes otherwise.
Examplegenerated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example", "code": "example"}