Docs menu

Subscriptions — API reference

Auto-refill for an address.

MethodPathSummary
GET/v1/subscriptions/plansSubscription presets, limits and the fee rule
GET/v1/subscriptionsList subscriptions
POST/v1/subscriptionsAuto-refill an address
GET/v1/subscriptions/{subscriptionId}Read a subscription
PATCH/v1/subscriptions/{subscriptionId}Change or pause a subscription
DELETE/v1/subscriptions/{subscriptionId}Cancel a subscription

Generated from openapi.yaml at build time. Base URL https://api.tenergy.me/v1, or https://api-nile.tenergy.me/v1 on Nile (Environments). Every request below is signed as in Authentication unless its Auth line says otherwise.

Subscription presets, limits and the fee rule

GET /v1/subscriptions/plans · listSubscriptionPlans

Auth: Public — no credentials.

Public; an API key is verified when presented. A preset only fills reserve, low and high; any rule inside limits is accepted (PlanSubscriptionRequest). Fee per day = ceil(reserve × fee_rule.trx_per_unit / fee_rule.unit_energy) whole TRX. Refills in every plan are priced at the 1 h grid of the current day-part (per_use). average_price is computed server-side for 10/50/200/1,000 uses a day.

Responses

StatusMeaning
200Active plans, smallest reserve first.

Response fields

FieldTypeRequiredDescription
availablebooleanyesFalse while subscriptions are switched off on this deployment; the plans are shown, not sold.
dataarray of object (SubscriptionPlan)yes
data[].slugstringyes
data[].namestringyes
data[].reserveintegeryesEnergy kept delegated to the address at most.
data[].lowintegeryesRefill when available energy falls below this.
data[].highintegeryesRefill up to this.
data[].fee_sun_per_dayintegeryes
data[].fee_trx_per_daynumberyes
data[].throughput_rulestringyes
data[].uses_within_reserve_per_dayintegeryes
data[].average_pricearray of objectyesAverage price per use = daily fee / N + per-use price, for N = 10, 50, 200, 1,000.
data[].average_price[].uses_per_dayintegeryes
data[].average_price[].average_suninteger | nullyes
data[].average_price[].average_trxnumber | nullyes
data[].average_price[].within_reservebooleanyes
per_useobjectyes
per_use.modeenum: gridyesThe 1 h energy price of the current day-part × 65,000.
per_use.energy_per_useintegeryes
per_use.price_suninteger | nullyesnull while 1 h energy is paused.
per_use.price_trxnumber | nullyes
per_use.day_partstring | nullyesDay-part window id.
limitsobjectyes131,000 ≤ reserve ≤ 5,240,000; each number a multiple of step; low ≥ low_min; low < high ≤ reserve; high − low ≥ gap_min. Exception: low = high = reserve = 131,000 (Basic).
limits.reserve_minintegeryes
limits.reserve_maxintegeryes
limits.stepintegeryes
limits.low_minintegeryes
limits.gap_minintegeryes
fee_ruleobjectyes
fee_rule.trx_per_unitintegeryes
fee_rule.unit_energyintegeryes
fee_rule.roundingenum: ceil_whole_trxyes
atstring (date-time)yes

List subscriptions

GET /v1/subscriptions · listSubscriptions

Auth: API key (HMAC).

Scope subscriptions.read, or a dashboard session with member role viewer.

Parameters

NameInTypeRequiredDescription
statusqueryenum: active, paused, suspended, cancelled
receiverquerystring
limitqueryinteger
cursorquerystringOpaque cursor from a previous response’s next_cursor.

Responses

StatusMeaning
200OK
401Missing, malformed or rejected credentials.
429Too many requests.
500Something broke on our side.

Response fields

FieldTypeRequiredDescription
dataarray of object (Subscription)yes
data[].idstringyes
data[].receiverstringyesBase58Check TRON address (starts with T, 34 characters).
data[].resourceenum: energy, bandwidthyes
data[].modeenum: refill, renewalyes
data[].tierenum: 5m, 15m, 1h, 1d, 3d, 30dyesRental period. The API sells 5m and 1h; 1d exists but is switched off. 15m, 3d and 30d are retired and never sold — they stay in the enum only so old orders parse. Check available on each GET /v1/prices row; a tier that is not available is rejected with 2003 tier_unavailable.
data[].threshold_amountinteger
data[].refill_amountinteger
data[].max_price_suninteger (int64) | null
data[].max_refills_per_dayinteger | null
data[].daily_fee_suninteger (int64)Watch fee charged per calendar day while the subscription is not cancelled.
data[].statusenum: active, paused, suspended, cancelledyespaused is set by you; suspended is set by the platform when the balance cannot cover the next refill and clears itself after a deposit; cancelled is terminal.
data[].labelstring | null
data[].last_refill_atstring (date-time) | null
data[].last_order_idstring | null
data[].refills_todayinteger
data[].created_atstring (date-time)yes
data[].updated_atstring (date-time)
data[].addressstringSame as receiver. Present only on plan subscriptions, with the fields below.
data[].presetstring | nullPreset slug; null for a custom rule.
data[].reserveinteger | nullEnergy kept delegated at most.
data[].lowinteger | nullRefill when available energy falls below this.
data[].highinteger | nullRefill up to this.
data[].fee_trx_per_daynumber
data[].delegated_energyintegerEnergy delegated to the address now.
data[].next_billing_atstring (date-time) | null
data[].grace_untilstring (date-time) | nullSet while a failed daily charge keeps the energy delegated (reported as suspended).
data[].eventsarray of object (SubscriptionEvent)GET /v1/subscriptions/{id} of a plan subscription only: the last 20 events, newest first.
data[].events[].idstringyes
data[].events[].kindenum: refill, charge, pause, resume, cancel, top_up_failedyes
data[].events[].energy_deltainteger | null
data[].events[].amount_suninteger | null
data[].events[].txidstring | null
data[].events[].tsstring (date-time)yes
next_cursorstring | nullyes

Auto-refill an address

POST /v1/subscriptions · createSubscription

Auth: API key (HMAC).

Keeps an address supplied with energy. A subscription is three numbers (PlanSubscriptionRequest): {address, preset} or {address, reserve, low, high}.

  • reserve (R) — the energy held for the address; 131,000 ≤ R ≤ 5,240,000, step 1,000.
  • low — refill when the address’s free energy drops below it; low ≥ 65,000.
  • high — refill up to it; high − low ≥ 65,000 and high ≤ R. The basic preset (low = high = R) is the one exception.
PresetReserveDaily fee
basic131,0006 TRX
1.3m1,300,00060 TRX
2.62m2,620,000120 TRX
5.24m5,240,000240 TRX

Billing: the daily fee is ceil(R × 6 / 131,000) whole TRX. The first day is charged when the subscription starts, then every 24 hours. Each refill is charged at the live 1h price. A rule outside the limits of GET /v1/subscriptions/plans is 422 3020 subscription_rule_invalid with details.violations. PATCH takes {reserve, low, high}, {preset} or {status} (PlanSubscriptionPatch).

While GET /v1/subscriptions/plans → available is false this call is 409 3021 subscriptions_unavailable.

One address may have at most one subscription per resource. A second one is rejected with 3011 subscription_exists.

Legacy body: mode: "refill" / mode: "renewal" with threshold_amount is still accepted for existing integrations; new integrations use the three numbers above. The 201 example shows a legacy subscription; its numbers are illustrative.

Scope subscriptions.write, or a dashboard session with member role editor and X-CSRF-Token.

Parameters

NameInTypeRequiredDescription
Idempotency-KeyheaderstringClient-chosen key making this mutating request safe to retry, 8–128 characters of A-Z a-z 0-9 . _ : -. A repeat with the same key and the same body returns the original result; the same key with a different body is rejected with 3010 idempotency_conflict. Records live for 24 hours.

Request body

JSON (SubscriptionRequest), required.

FieldTypeRequiredDescription
receiverstringyesBase58Check TRON address (starts with T, 34 characters).
resourceenum: energy, bandwidthyes
modeenum: refill, renewalyesrefill tops up when the address falls below the threshold; renewal keeps a standing rental alive by re-ordering as it expires.
tierenum: 5m, 15m, 1h, 1d, 3d, 30dyesRental period. The API sells 5m and 1h; 1d exists but is switched off. 15m, 3d and 30d are retired and never sold — they stay in the enum only so old orders parse. Check available on each GET /v1/prices row; a tier that is not available is rejected with 2003 tier_unavailable.
threshold_amountintegeryesRefill when free resource on the address drops below this.
refill_amountintegeryesHow much to buy on each refill.
max_price_suninteger (int64)Skip a refill whose total would exceed this rather than paying a spike price. A skipped refill produces no order and no webhook; the next check tries again.
max_refills_per_dayintegerHard stop against a runaway address draining the balance. Once reached, refills pause until the next UTC day. Strongly recommended.
labelstring | null

Example request body, from the contract (illustrative values):

json
{"address":"TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE","preset":"basic"}

Responses

StatusMeaning
201Created
400Malformed request — bad JSON, unknown field, wrong type.
401Missing, malformed or rejected credentials.
402Not enough balance to cover the order.
409The request contradicts the current state of the object.
422Syntactically valid but semantically impossible.
429Too many requests.
500Something broke on our side.

Response fields (Subscription)

FieldTypeRequiredDescription
idstringyes
receiverstringyesBase58Check TRON address (starts with T, 34 characters).
resourceenum: energy, bandwidthyes
modeenum: refill, renewalyes
tierenum: 5m, 15m, 1h, 1d, 3d, 30dyesRental period. The API sells 5m and 1h; 1d exists but is switched off. 15m, 3d and 30d are retired and never sold — they stay in the enum only so old orders parse. Check available on each GET /v1/prices row; a tier that is not available is rejected with 2003 tier_unavailable.
threshold_amountinteger
refill_amountinteger
max_price_suninteger (int64) | null
max_refills_per_dayinteger | null
daily_fee_suninteger (int64)Watch fee charged per calendar day while the subscription is not cancelled.
statusenum: active, paused, suspended, cancelledyespaused is set by you; suspended is set by the platform when the balance cannot cover the next refill and clears itself after a deposit; cancelled is terminal.
labelstring | null
last_refill_atstring (date-time) | null
last_order_idstring | null
refills_todayinteger
created_atstring (date-time)yes
updated_atstring (date-time)
addressstringSame as receiver. Present only on plan subscriptions, with the fields below.
presetstring | nullPreset slug; null for a custom rule.
reserveinteger | nullEnergy kept delegated at most.
lowinteger | nullRefill when available energy falls below this.
highinteger | nullRefill up to this.
fee_trx_per_daynumber
delegated_energyintegerEnergy delegated to the address now.
next_billing_atstring (date-time) | null
grace_untilstring (date-time) | nullSet while a failed daily charge keeps the energy delegated (reported as suspended).
eventsarray of object (SubscriptionEvent)GET /v1/subscriptions/{id} of a plan subscription only: the last 20 events, newest first.
events[].idstringyes
events[].kindenum: refill, charge, pause, resume, cancel, top_up_failedyes
events[].energy_deltainteger | null
events[].amount_suninteger | null
events[].txidstring | null
events[].tsstring (date-time)yes

Example 201 response, from the contract (illustrative values — live numbers come from the API):

json
{
  "id": "sub_01J9Z7R4Y2AB",
  "receiver": "TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE",
  "resource": "energy",
  "mode": "refill",
  "tier": "1h",
  "threshold_amount": 65000,
  "refill_amount": 131000,
  "max_price_sun": 3000000,
  "max_refills_per_day": 48,
  "daily_fee_sun": 3930000,
  "status": "active",
  "last_refill_at": null,
  "last_order_id": null,
  "refills_today": 0,
  "created_at": "2026-09-11T18:30:00.000Z",
  "updated_at": "2026-09-11T18:30:00.000Z"
}

Read a subscription

GET /v1/subscriptions/{subscriptionId} · getSubscription

Auth: API key (HMAC).

Scope subscriptions.read, or a dashboard session with member role viewer. Another account’s subscription answers 404.

Parameters

NameInTypeRequiredDescription
subscriptionIdpathstringyes

Responses

StatusMeaning
200OK
401Missing, malformed or rejected credentials.
404No such object, or it belongs to another account. The two are not distinguished.
500Something broke on our side.

Response fields (Subscription)

FieldTypeRequiredDescription
idstringyes
receiverstringyesBase58Check TRON address (starts with T, 34 characters).
resourceenum: energy, bandwidthyes
modeenum: refill, renewalyes
tierenum: 5m, 15m, 1h, 1d, 3d, 30dyesRental period. The API sells 5m and 1h; 1d exists but is switched off. 15m, 3d and 30d are retired and never sold — they stay in the enum only so old orders parse. Check available on each GET /v1/prices row; a tier that is not available is rejected with 2003 tier_unavailable.
threshold_amountinteger
refill_amountinteger
max_price_suninteger (int64) | null
max_refills_per_dayinteger | null
daily_fee_suninteger (int64)Watch fee charged per calendar day while the subscription is not cancelled.
statusenum: active, paused, suspended, cancelledyespaused is set by you; suspended is set by the platform when the balance cannot cover the next refill and clears itself after a deposit; cancelled is terminal.
labelstring | null
last_refill_atstring (date-time) | null
last_order_idstring | null
refills_todayinteger
created_atstring (date-time)yes
updated_atstring (date-time)
addressstringSame as receiver. Present only on plan subscriptions, with the fields below.
presetstring | nullPreset slug; null for a custom rule.
reserveinteger | nullEnergy kept delegated at most.
lowinteger | nullRefill when available energy falls below this.
highinteger | nullRefill up to this.
fee_trx_per_daynumber
delegated_energyintegerEnergy delegated to the address now.
next_billing_atstring (date-time) | null
grace_untilstring (date-time) | nullSet while a failed daily charge keeps the energy delegated (reported as suspended).
eventsarray of object (SubscriptionEvent)GET /v1/subscriptions/{id} of a plan subscription only: the last 20 events, newest first.
events[].idstringyes
events[].kindenum: refill, charge, pause, resume, cancel, top_up_failedyes
events[].energy_deltainteger | null
events[].amount_suninteger | null
events[].txidstring | null
events[].tsstring (date-time)yes

Change or pause a subscription

PATCH /v1/subscriptions/{subscriptionId} · updateSubscription

Auth: API key (HMAC).

Send any subset of the mutable fields. status accepts active and paused only — suspended is set by the platform when funds run out and clears itself, and cancelled is reached through DELETE. An empty body is rejected with 2002 empty_patch.

While subscriptions are switched off, a patch that changes the rule, preset or refill parameters is 409 3021 subscriptions_unavailable; status, label, reads and DELETE keep working so existing subscriptions can be managed.

Scope subscriptions.write, or a dashboard session with member role editor and X-CSRF-Token.

Parameters

NameInTypeRequiredDescription
subscriptionIdpathstringyes

Request body

JSON (SubscriptionPatch), required.

FieldTypeRequiredDescription
statusenum: active, paused
tierenum: 5m, 15m, 1h, 1d, 3d, 30dRental period. The API sells 5m and 1h; 1d exists but is switched off. 15m, 3d and 30d are retired and never sold — they stay in the enum only so old orders parse. Check available on each GET /v1/prices row; a tier that is not available is rejected with 2003 tier_unavailable.
threshold_amountinteger
refill_amountinteger
max_price_suninteger (int64)An amount in SUN (1 TRX = 1 000 000 SUN). Always an integer.
max_refills_per_dayinteger
labelstring | null

Example request body, from the contract (illustrative values):

json
{"status":"paused"}

Responses

StatusMeaning
200Updated
400Malformed request — bad JSON, unknown field, wrong type.
401Missing, malformed or rejected credentials.
404No such object, or it belongs to another account. The two are not distinguished.
409The request contradicts the current state of the object.
422Syntactically valid but semantically impossible.
500Something broke on our side.

Response fields (Subscription)

FieldTypeRequiredDescription
idstringyes
receiverstringyesBase58Check TRON address (starts with T, 34 characters).
resourceenum: energy, bandwidthyes
modeenum: refill, renewalyes
tierenum: 5m, 15m, 1h, 1d, 3d, 30dyesRental period. The API sells 5m and 1h; 1d exists but is switched off. 15m, 3d and 30d are retired and never sold — they stay in the enum only so old orders parse. Check available on each GET /v1/prices row; a tier that is not available is rejected with 2003 tier_unavailable.
threshold_amountinteger
refill_amountinteger
max_price_suninteger (int64) | null
max_refills_per_dayinteger | null
daily_fee_suninteger (int64)Watch fee charged per calendar day while the subscription is not cancelled.
statusenum: active, paused, suspended, cancelledyespaused is set by you; suspended is set by the platform when the balance cannot cover the next refill and clears itself after a deposit; cancelled is terminal.
labelstring | null
last_refill_atstring (date-time) | null
last_order_idstring | null
refills_todayinteger
created_atstring (date-time)yes
updated_atstring (date-time)
addressstringSame as receiver. Present only on plan subscriptions, with the fields below.
presetstring | nullPreset slug; null for a custom rule.
reserveinteger | nullEnergy kept delegated at most.
lowinteger | nullRefill when available energy falls below this.
highinteger | nullRefill up to this.
fee_trx_per_daynumber
delegated_energyintegerEnergy delegated to the address now.
next_billing_atstring (date-time) | null
grace_untilstring (date-time) | nullSet while a failed daily charge keeps the energy delegated (reported as suspended).
eventsarray of object (SubscriptionEvent)GET /v1/subscriptions/{id} of a plan subscription only: the last 20 events, newest first.
events[].idstringyes
events[].kindenum: refill, charge, pause, resume, cancel, top_up_failedyes
events[].energy_deltainteger | null
events[].amount_suninteger | null
events[].txidstring | null
events[].tsstring (date-time)yes

Cancel a subscription

DELETE /v1/subscriptions/{subscriptionId} · cancelSubscription

Auth: API key (HMAC).

Stops future refills. Rentals already delivered keep running until they expire; they are not reclaimed and not refunded. The subscription stays readable with status: "cancelled". Scope subscriptions.write, or a dashboard session with member role editor and X-CSRF-Token.

Parameters

NameInTypeRequiredDescription
subscriptionIdpathstringyes

Responses

StatusMeaning
204Cancelled. No body.
401Missing, malformed or rejected credentials.
404No such object, or it belongs to another account. The two are not distinguished.
500Something broke on our side.

    ↑ ↓ to move · Enter to open · Esc to close