Maintenance
Keeping wallets topped up with energy — auto-refill rules
GET /auto-refill-rules
List auto-refill rules
Authentication: Required — an API key in Authorization: Bearer … (authentication).
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
cursor | query | optional | string | |
limit | query | optional | integer | Default: |
Responses
200
OK
Content type application/json.
| Field | Type | Required | Description |
|---|---|---|---|
data | array of MaintenanceRule | required | |
next_cursor | string or null | required |
POST /auto-refill-rules
Create an auto-refill rule
Authentication: Required — an API key in Authorization: Bearer … (authentication).
"Keep energy on this wallet": after every spend it is topped up, so no separate order per transfer is needed. Idling costs almost nothing — no spend, no top-ups.
The daily budget is mandatory: it is the rule's spending cap per UTC day; a hold for it is placed from the available balance, spending is drawn from the hold, and the remainder is released at the day boundary.
You are charged for every top-up confirmed on-chain, at the
GET /tariff price in effect at the moment of confirmation.
The address must be activated and must not be a contract. Only one active rule may exist per (account, address) pair.
201 means the daily hold is in place, not merely that the
rule was recorded: a rule without a hold is an unbacked promise
to spend.
Request body
Required.
Content type application/json.
Schema: MaintenanceRuleCreate.
| Field | Type | Required | Description |
|---|---|---|---|
address | TronAddress | required | The wallet on which energy is maintained |
daily_budget_trx | TRX | required | The rule's spending cap per UTC day. Mandatory. Reserved from the available balance like an order hold; the remainder is released at the day boundary. No less than the |
Example: wallet
{
"address": "TN3W4H6rK2ce4vX9YnFQHwKENnHjoxb3m9",
"daily_budget_trx": "20.000000"
}
Responses
422
The address is well-formed, but a rule cannot be created on it,
the budget does not cover top-ups, or as many rules already
exist as are allowed. The specific reason is in
details.reason: inactive_wallet (the wallet is not
activated — there is nowhere to delegate energy to),
contract_wallet (a contract: its energy consumption works
differently), rules_limit_reached (with limit and the
current current there),
budget_below_topup_price (the daily budget is below the
double rate — even the rule's first top-up would not fit
into it; the minimum is in details.min_daily_budget_trx).
Content type application/json.
Schema: Error.
429
Rate limit exceeded (rate_limited), or too many failed
authorizations from this credential (too_many_auth_failures). Both
are 429 and both carry Retry-After; they differ in what you
should do about it, which is why they differ in code and not only
in message. rate_limited also carries the RateLimit-* state of
the bucket it came from; too_many_auth_failures does not, because
the counter behind it is not a bucket. See "Rate limits" and
"Repeated authorization failures" above.
On POST /orders a rate_limited may also carry
details.reason = bulk_volume_cap: not requests per minute but
energy per window — a mode c order whose volumes would take
your account past the bulk allowance. details carries cap_units
(the allowance), spent_units (your volume already inside the
window), requested_units (what this order asked for) and
window_s (the width of the window, 3600). Retry-After is the
first instant at which this body can be accepted: enough of your
counted volume has to leave the window to make room for
requested_units, which is not in general the moment the oldest
position leaves — one departure frees only that position's units.
An order whose own volume is larger than the whole allowance is not
answered here at all: no waiting would help it, and it is
400 invalid_request with
details.reason = bulk_order_over_cap. It is a pace limit like the
others, so it is the same code: the order is not wrong, and the same
body sent later is accepted. It carries no RateLimit-* headers:
those describe a bucket of requests per minute, and this allowance
is energy per hour — details above is its whole state.
Content type application/json.
Schema: Error.
| Header | Type | Description |
|---|---|---|
Retry-After | integer | Seconds to wait before retrying. |
RateLimit-Limit | integer | Requests per minute in this bucket — per UTC day on
|
RateLimit-Remaining | integer | Requests left in this bucket right now. |
RateLimit-Reset | integer | Seconds until the bucket is full again. |
GET /auto-refill-rules/{rule_id}
Get a rule
Authentication: Required — an API key in Authorization: Bearer … (authentication).
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
rule_id | path | required | string |
Responses
PATCH /auto-refill-rules/{rule_id}
Update a rule
Authentication: Required — an API key in Authorization: Bearer … (authentication).
status (active ↔ paused) and the daily budget can be changed.
A rule stopped due to insufficient_balance is resumed only by
this request — it never turns back on silently.
Both changes account for what is already spent today: the hold
is re-placed for budget − spent, not the full budget — otherwise
a pause and resume would reset the daily cap. A budget lowered
below what is already spent closes the hold: the rule spends
nothing until the end of the UTC day.
A pause returns the rest of the daily hold a few minutes later
rather than at once. The rule stops at once, but when it has a
live daily hold and its wallet is connected, the hold stays until
the network has been read past the moment of the pause (typically
4–5 minutes, at most an hour). A top-up delivered before the pause,
or in the seconds right after it for a spend made while the rule
was running, is charged from that hold like any other — a charge
in GET /ledger and a maintenance.topup event; nothing delivered
later is charged to the paused rule. A pause never charges for
connecting the wallet. Resumed before the hold comes back, the rule
carries on with the same hold; deleted while it waits, the wait goes
on under the deletion's rules, from the moment of the pause.
Budget bounds are the same as at creation: below the price of a
single top-up — 422 with
details.reason = budget_below_topup_price.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
rule_id | path | required | string |
Request body
Required.
Content type application/json.
Schema: MaintenanceRulePatch.
| Field | Type | Required | Description |
|---|---|---|---|
status | MaintenanceRuleStatus or null | optional | |
daily_budget_trx | TRX or null | optional |
Responses
402
Resuming requires the daily hold, and the balance does not cover it
Content type application/json.
Schema: Error.
422
The daily budget is below the double rate
(details.reason = budget_below_topup_price; the minimum is
in details.min_daily_budget_trx).
Content type application/json.
Schema: Error.
DELETE /auto-refill-rules/{rule_id}
Delete a rule
Authentication: Required — an API key in Authorization: Bearer … (authentication).
The rule stops operating, and the remainder of the daily hold is
released. The charge history is retained. Deleting again returns
404.
The remainder may come back a few minutes later rather than at
once. The rule is deleted immediately — 404 from then on, gone
from the list, its address free for a new rule. But when it still
has a live daily hold and its wallet is connected, the hold stays
until the network has been read past the moment of deletion
(typically 4–5 minutes, at most an hour). A top-up delivered before
the deletion, or in the seconds right after it for a spend made
while the rule was running, is charged from that hold like any
other — a charge in GET /ledger and a maintenance.topup event
with the deleted rule's rule_id; nothing delivered later is
charged to it. Then the rest is released. A rule whose hold for the
day is used up, or a paused rule whose hold has already come back,
has nothing to wait with and is settled at once, but for a supplier
prepayment still in progress (below); a paused rule whose
hold still waits keeps waiting, from the moment of the pause. If what the rule still owes for connecting the
wallet (below) is more than that hold, the difference is reserved
from the available balance at the DELETE — the hold is released
and placed again, larger by it; when the available balance cannot
cover it, the deletion is refused with 402 insufficient_balance
and nothing changes.
A rule deleted before charges have covered what the supplier was
paid for its wallet pays the difference. The first pass that
finds the wallet short of a full top-up connects it with the supplier,
paid for up front; a wallet that already holds a full top-up is
connected after its first spend. The difference is the supplier cost
paid under this rule less what this rule was charged, but no more
than the supplier cost paid for the wallet less what all rules of
the wallet were charged (costs and charges from 2026-11-06 on). A
prepayment for the rule that is still in progress at the DELETE
counts at its expected cost, in the 402 check too, and that much
stays held after the DELETE until the supplier answers: its actual
cost is then charged from it and the rest released, or all of it is
released if the prepayment did not go through. The difference
is charged before the rest of the hold
is released: from the rule's daily hold first, then from the
available balance. When the two together do not cover it, the
deletion is refused with 402 insufficient_balance and the rule
stays as it was; details.required_trx is the part due from the
available balance. It shows in GET /ledger as a charge (from the
available balance, with a hold of the same amount) and is not
refundable. Pausing a rule charges nothing by itself.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
rule_id | path | required | string |
Responses
204
Deleted
No body.
402
The rule's supplier cost is not yet covered by its charges, and
its daily hold plus the available balance do not cover the
difference — a supplier prepayment still in progress counting at
its expected cost. Nothing is charged and the rule stays as it was;
details.required_trx is the part due from the available balance.
Content type application/json.
Schema: Error.
GET /maintenance-rules
List auto-refill rules (deprecated path)
Deprecated.
Authentication: Required — an API key in Authorization: Bearer … (authentication).
Deprecated path. The canonical one is /auto-refill-rules;
this alias responds identically and works until 2026-12-01, marking
successful responses with Deprecation and Sunset headers.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
cursor | query | optional | string | |
limit | query | optional | integer | Default: |
Responses
200
OK
Content type application/json.
| Field | Type | Required | Description |
|---|---|---|---|
data | array of MaintenanceRule | required | |
next_cursor | string or null | required |
POST /maintenance-rules
Create an auto-refill rule (deprecated path)
Deprecated.
Authentication: Required — an API key in Authorization: Bearer … (authentication).
Deprecated path. The canonical one is /auto-refill-rules;
this alias responds identically and works until 2026-12-01, marking
successful responses with Deprecation and Sunset headers.
Request body
Required.
Content type application/json.
Schema: MaintenanceRuleCreate.
| Field | Type | Required | Description |
|---|---|---|---|
address | TronAddress | required | The wallet on which energy is maintained |
daily_budget_trx | TRX | required | The rule's spending cap per UTC day. Mandatory. Reserved from the available balance like an order hold; the remainder is released at the day boundary. No less than the |
Responses
422
The rule cannot be created; the specific reason is in details.reason
Content type application/json.
Schema: Error.
429
Rate limit exceeded (rate_limited), or too many failed
authorizations from this credential (too_many_auth_failures). Both
are 429 and both carry Retry-After; they differ in what you
should do about it, which is why they differ in code and not only
in message. rate_limited also carries the RateLimit-* state of
the bucket it came from; too_many_auth_failures does not, because
the counter behind it is not a bucket. See "Rate limits" and
"Repeated authorization failures" above.
On POST /orders a rate_limited may also carry
details.reason = bulk_volume_cap: not requests per minute but
energy per window — a mode c order whose volumes would take
your account past the bulk allowance. details carries cap_units
(the allowance), spent_units (your volume already inside the
window), requested_units (what this order asked for) and
window_s (the width of the window, 3600). Retry-After is the
first instant at which this body can be accepted: enough of your
counted volume has to leave the window to make room for
requested_units, which is not in general the moment the oldest
position leaves — one departure frees only that position's units.
An order whose own volume is larger than the whole allowance is not
answered here at all: no waiting would help it, and it is
400 invalid_request with
details.reason = bulk_order_over_cap. It is a pace limit like the
others, so it is the same code: the order is not wrong, and the same
body sent later is accepted. It carries no RateLimit-* headers:
those describe a bucket of requests per minute, and this allowance
is energy per hour — details above is its whole state.
Content type application/json.
Schema: Error.
| Header | Type | Description |
|---|---|---|
Retry-After | integer | Seconds to wait before retrying. |
RateLimit-Limit | integer | Requests per minute in this bucket — per UTC day on
|
RateLimit-Remaining | integer | Requests left in this bucket right now. |
RateLimit-Reset | integer | Seconds until the bucket is full again. |
GET /maintenance-rules/{rule_id}
Get a rule (deprecated path)
Deprecated.
Authentication: Required — an API key in Authorization: Bearer … (authentication).
Deprecated path. The canonical one is
/auto-refill-rules/{rule_id}; this alias responds identically and
works until 2026-12-01, marking successful responses with
Deprecation and Sunset headers.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
rule_id | path | required | string |
Responses
PATCH /maintenance-rules/{rule_id}
Update a rule (deprecated path)
Deprecated.
Authentication: Required — an API key in Authorization: Bearer … (authentication).
Deprecated path. The canonical one is
/auto-refill-rules/{rule_id}; this alias responds identically and
works until 2026-12-01, marking successful responses with
Deprecation and Sunset headers.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
rule_id | path | required | string |
Request body
Required.
Content type application/json.
Schema: MaintenanceRulePatch.
| Field | Type | Required | Description |
|---|---|---|---|
status | MaintenanceRuleStatus or null | optional | |
daily_budget_trx | TRX or null | optional |
Responses
402
Resuming requires the daily hold, and the balance does not cover it
Content type application/json.
Schema: Error.
DELETE /maintenance-rules/{rule_id}
Delete a rule (deprecated path)
Deprecated.
Authentication: Required — an API key in Authorization: Bearer … (authentication).
Deprecated path. The canonical one is
/auto-refill-rules/{rule_id}; this alias responds identically and
works until 2026-12-01, marking successful responses with
Deprecation and Sunset headers.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
rule_id | path | required | string |
Responses
204
Deleted
No body.
402
The rule's supplier cost is not yet covered by its charges, and
its daily hold plus the available balance do not cover the
difference — a supplier prepayment still in progress counting at
its expected cost. Nothing is charged and the rule stays as it was;
details.required_trx is the part due from the available balance.
Content type application/json.
Schema: Error.