Create an auto-refill rule (energy)
const url = 'https://trongas.ai/api/v1/automations';const options = { method: 'POST', headers: {'X-Api-Key': '<X-Api-Key>', 'Content-Type': 'application/json'}, body: '{"targetAddress":"example","minimal":1,"volume":1,"duration":"example","autoResume":false}'};
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/automations \ --header 'Content-Type: application/json' \ --header 'X-Api-Key: <X-Api-Key>' \ --data '{ "targetAddress": "example", "minimal": 1, "volume": 1, "duration": "example", "autoResume": false }'Required API-key scope: purchase
Keep an address topped up: whenever its energy falls below minimal, volume energy is delivered for duration.
Each delivery is charged to your TRX balance at your price — there is no prepaid budget. A threshold on an empty address is reached right away, so creating the rule requires enough free balance for one delivery (volume for duration), otherwise 402 wallet.insufficient_balance and nothing is created. Free balance is your TRX balance minus what your other active rules already hold for their next firing, so one balance can’t fund several new rules at once. If the balance can no longer cover the next delivery the rule is paused automatically; set autoResume to have it come back by itself once you top up.
Energy only — bandwidth has no automations.
503 pricing.unavailable — the price is temporarily unknown; no rule was created, retry shortly.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
object
object
Responses
Section titled “ Responses ”OK
object
object
Examplegenerated
{ "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "type": "example", "resource": "example", "targetAddress": "example", "minimal": 1, "volume": 1, "duration": "example", "spentTrx": "example", "status": "example", "pauseReason": "example", "autoResume": true, "createdAt": "2026-04-15T12:00:00Z", "updatedAt": "2026-04-15T12:00:00Z"}object
Examplegenerated
{ "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "type": "example", "resource": "example", "targetAddress": "example", "minimal": 1, "volume": 1, "duration": "example", "spentTrx": "example", "status": "example", "pauseReason": "example", "autoResume": true, "createdAt": "2026-04-15T12:00:00Z", "updatedAt": "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"}Service Unavailable