Skip to main content

Energy Agent API

Every Energy Agent action in the workspace is also available over REST.

Basics​

  • Base path: https://tronagg.ai/api/v1/agent
  • Auth: header X-API-Key: <your key>, the same key as the rest of the programmatic API. Create one in the workspace.
  • Money: every amount is an integer in SUN (1 TRX = 1,000,000 SUN), in fields ending in _sun.
  • Timestamps: ISO-8601, UTC.
  • Errors: the HTTP status plus a body of the form {"detail": {"error": "<slug>", ...}}. See Error slugs.
MethodPathPurpose
GET/summaryProgram limits, your balance, the 65,000-Energy price range and your totals.
GET/quote?energy=TRONAgg's price range for an amount of Energy.
GET/configsYour configurations.
POST/configsCreate a configuration.
PATCH/configs/{id}Change title, Energy, base payment or limit.
POST/configs/{id}/pausePause a configuration.
POST/configs/{id}/resumeResume a configuration.
DELETE/configs/{id}Delete an own-wallet configuration.
GET/paymentsYour sales feed.
GET/api/v1/pay/{public_id}Public pay-page data. No auth.

GET /summary​

curl https://tronagg.ai/api/v1/agent/summary -H "X-API-Key: ta_your_key_here"
{
"enabled": true,
"min_balance_sun": 10000000,
"balance_sun": 48250000,
"can_activate": true,
"max_configs": 10,
"max_generated": 3,
"max_units_cap": 50,
"energy_min": 65000,
"energy_max": 1000000,
"quote_65k": {
"energy": 65000,
"cost_now_sun": 1950000,
"cost_min_sun": 1560000,
"cost_max_sun": 2340000,
"timezone": "UTC"
},
"totals": {
"sales": 128,
"energy": 9100000,
"revenue_sun": 420000000,
"cost_sun": 275000000
}
}
FieldMeaning
enabledWhether the program is currently accepting configurations.
min_balance_sunThe activation threshold: the balance needed to create or resume a configuration.
balance_sun / can_activateYour balance and whether it meets the threshold.
max_configs / max_generatedHow many configurations, and how many dedicated TRONAgg addresses, you can have.
max_units_capThe highest allowed max_units.
energy_min / energy_maxOrder size limits for one payment (energy_max is null when there is no maximum).
quote_65kTRONAgg's price for 65,000 Energy: now, lowest and highest hour of the schedule.
totalsLifetime sales. Profit is revenue_sun − cost_sun.

All figures in the examples on this page are illustrative.

GET /quote​

The price range for any amount of Energy, computed exactly like a real purchase (your VIP discount included). Use cost_max_sun as the lowest base payment you can set for that Energy per unit.

curl "https://tronagg.ai/api/v1/agent/quote?energy=131000" -H "X-API-Key: ta_your_key_here"
{
"energy": 131000,
"cost_now_sun": 3930000,
"cost_min_sun": 3144000,
"cost_max_sun": 4716000,
"timezone": "UTC"
}

Configurations​

A configuration object:

{
"id": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"public_id": "k7Qm2xPa",
"mode": "generated",
"address": "TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE",
"title": "Night Shift Energy",
"energy_per_unit": 65000,
"base_payment_sun": 3000000,
"max_units": 10,
"status": "active",
"pause_reason": null,
"created_at": "2026-09-29T10:00:00Z",
"updated_at": "2026-09-29T10:00:00Z",
"stats": {
"sales": 12,
"energy": 1040000,
"revenue_sun": 48000000,
"cost_sun": 31200000,
"last_sale_at": "2026-09-29T12:41:07Z"
}
}
FieldMeaning
public_idThe pay page id: https://tronagg.ai/pay/<public_id>.
modeown (your wallet) or generated (a dedicated TRONAgg address).
statusactive or paused.
pause_reasonuser, insufficient_balance, admin (paused by TRONAgg support), or null when active.
statsSales for this configuration. Profit is revenue_sun − cost_sun.

List configurations​

GET /configs returns { "items": [ ...configurations ] }. Deleted configurations are not listed.

Create a configuration​

POST /configs returns 201 with the new configuration.

curl -X POST https://tronagg.ai/api/v1/agent/configs \
-H "X-API-Key: ta_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"mode": "own",
"address": "TXYZ...yourAddress",
"title": "Night Shift Energy",
"energy_per_unit": 65000,
"base_payment_sun": 3000000,
"max_units": 10
}'
FieldRules
modeown or generated. Can't be changed later.
addressRequired for own, omitted for generated. Can't be changed later.
titleOptional, up to 40 characters.
energy_per_unitBetween energy_min and energy_max from the summary.
base_payment_sunAt least cost_max_sun for energy_per_unit, and a multiple of 1000 (0.001 TRX).
max_units1 to max_units_cap; energy_per_unit × max_units must not exceed energy_max.

Creating a configuration needs your balance at or above the activation threshold. A generated address is permanent: it can be paused but never deleted.

Update a configuration​

PATCH /configs/{id} with any of title, energy_per_unit, base_payment_sun, max_units. The same rules as on create apply. Returns the updated configuration.

curl -X PATCH https://tronagg.ai/api/v1/agent/configs/0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b \
-H "X-API-Key: ta_your_key_here" \
-H "Content-Type: application/json" \
-d '{"base_payment_sun": 3500000}'

Pause and resume​

POST /configs/{id}/pause and POST /configs/{id}/resume return the updated configuration. Resuming needs your balance at or above the activation threshold; a configuration paused by support (pause_reason: "admin") returns 409 admin_paused.

Delete a configuration​

DELETE /configs/{id} returns 204. Only own configurations can be deleted; a generated one returns 409 generated_not_deletable.

GET /payments​

Your sales feed, newest first. Optional filters: config_id, status, page (default 1), page_size (default 20).

curl "https://tronagg.ai/api/v1/agent/payments?status=skipped&page=1&page_size=20" \
-H "X-API-Key: ta_your_key_here"
{
"items": [
{
"id": "0199a1b2-d4e5-7f60-9a1b-2c3d4e5f6a7b",
"config_id": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"tx_hash": "5c8f0d6b1e9a...",
"payer": "TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7",
"amount_sun": 2500000,
"units": 0,
"energy": 0,
"cost_sun": null,
"status": "skipped",
"skip_reason": "below_base",
"order_id": null,
"created_at": "2026-09-29T12:44:19Z"
}
],
"page": 1,
"page_size": 20,
"has_more": false
}
FieldMeaning
payerThe customer address that sent the TRX and receives the Energy.
amount_sunWhat the customer paid.
units / energyUnits counted and Energy delivered.
cost_sunWhat TRONAgg charged your balance, null when nothing was charged.
statusprocessing, delivering, completed, failed (charge refunded to your balance) or skipped.
skip_reasonSet when status is skipped. See Skipped payments.
order_idThe Energy order behind the sale, when one was placed.

Public pay-page data​

GET https://tronagg.ai/api/v1/pay/{public_id} needs no authentication. It returns what a pay page shows, and 404 for an unknown or deleted configuration.

{
"public_id": "k7Qm2xPa",
"title": "Night Shift Energy",
"address": "TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE",
"energy_per_unit": 65000,
"base_payment_sun": 3000000,
"max_units": 10,
"available": true,
"referral_code": "nightshift"
}

available is false when the configuration can't take payments right now, for example while it is paused. Payments sent then are skipped.

Error slugs​

StatuserrorMeaning
403program_disabledThe program is not accepting changes right now.
422below_min_balanceYour balance is below the activation threshold. Extra fields: min_balance_sun, balance_sun.
422address_invalidNot a valid TRON address.
409address_takenThe address already belongs to an active configuration.
422address_reservedThe address can't be used for an own-wallet configuration.
422base_below_costThe base payment is below TRONAgg's highest hourly price. Extra field: cost_max_sun.
422base_not_mtrxThe base payment is not a multiple of 0.001 TRX.
422energy_out_of_boundsEnergy per unit, or Energy × max units, is outside the order limits.
422units_out_of_boundsmax_units is outside 1..max_units_cap.
422config_limitYou already have the maximum number of configurations.
422generated_limitYou already have the maximum number of dedicated TRONAgg addresses.
409generated_not_deletableA dedicated TRONAgg address can't be deleted; pause it instead.
409admin_pausedPaused by TRONAgg support; contact support to resume.
404not_foundNo such configuration on your account.

Webhook events​

Two events report agent activity through Telegram and webhooks. Both are on by default for new webhooks.

agent.sale​

Fires when a payment is turned into an Energy order.

{
"config_id": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"public_id": "k7Qm2xPa",
"title": "Night Shift Energy",
"payer": "TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7",
"amount_sun": 6000000,
"units": 2,
"energy": 130000,
"cost_sun": 3900000,
"order_id": "0199a1b2-e5f6-7a8b-9c0d-1e2f3a4b5c6d",
"tx_hash": "8e1a4f2c7b3d..."
}

Your profit on the sale is amount_sun − cost_sun. Track the delivery itself with order.status_changed or GET /order/{id}.

agent.payment_skipped​

Fires when a payment is skipped.

{
"config_id": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"public_id": "k7Qm2xPa",
"title": "Night Shift Energy",
"payer": "TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7",
"amount_sun": 3000000,
"reason": "insufficient_balance",
"paused": true,
"tx_hash": "3b7d9e0f1a2c..."
}
FieldMeaning
reasonOne of the skip reasons. Treat it as an open set.
pausedtrue when this payment also paused your configurations (insufficient_balance).