Schemas
Every named object of the contract. Endpoint pages link here wherever a field or a body is one of these.
TRX
Amount in TRX, 6 decimal places
Type: string.
Pattern: ^\d+\.\d{6}$. Example: 2.080000.
USD
A US dollar figure, 6 decimal places — the same shape as TRX and
for the same reason. It appears in one place only, as the reference
rate trx_usd of GET /tariff; we hold no balances in USD and
charge nothing in USD.
Type: string.
Pattern: ^\d+\.\d{6}$. Example: 0.337700.
TronAddress
Type: string.
Pattern: ^T[1-9A-HJ-NP-Za-km-z]{33}$. Example: TN3W4H6rK2ce4vX9YnFQHwKENnHjoxb3m9.
TransferKind
Determined automatically and finalized when the order is created:
single — the recipient already holds USDT (~65,000 energy);
double — the recipient's USDT balance is zero, whether or not the
address is activated on chain (~131,000): what doubles the figure is
the empty balance, not a missing account — an unactivated address
that already holds USDT is single, and an activated one with a zero
balance is double;
custom — the recipient is a contract, the amount is calculated
from actual usage.
Three values and no more. This is what an address check answers
about a transfer, and a transfer is one of these three shapes;
the volume a mode c position may name instead (bulk) is not a
finding about any address, so it lives in ItemKind and never
appears here. A client switching on this enum keeps its three
branches.
Type: string.
One of: single, double, custom.
ItemKind
What an order item was sold as — the three transfer kinds
(TransferKind, with the same meanings) plus one that is not a
transfer kind at all:
bulk — a mode c position that named energy_units instead of
kind. There is no transfer behind it and therefore no standard to
derive the volume from: the number is the client's, and
energy_units carries it. Such a position may be filled from
several sources at once, which is why it is the only kind whose
energy_delivered can come back below what was ordered.
bulk occurs on items only. GET /address-check and the estimate's
per-transfer items answer with TransferKind and cannot produce it.
Type: string.
One of: single, double, custom, bulk.
EnergyKind
The volume you are buying in mode c, where no recipient is named
and there is therefore nothing to read it from: single — about
65,000 energy, enough for a transfer to an address that already
holds USDT; double — about 131,000, enough for one that does not.
custom is absent on purpose. It is the outcome of a dry-run
against a specific contract recipient, so it cannot be asked for in
advance — an order to a contract goes through mode a.
A position that wants some other volume does not use this enum at
all: it names energy_units instead of kind.
Type: string.
One of: single, double.
OrderStatus
ready occurs when every live item is delegated — the energy
confirmed on chain — and send_before is computed. While one is
still pending, the order stays in purchasing; an item that has
already failed does not hold the rest back.
In mode B the order stays ready while we broadcast.
broadcasting and broadcasted are states of a transaction in
flight, not resting places: broadcasted means a node accepted the
transaction, not that it is in a block. An order whose items are
all broadcasted is therefore still ready, and it becomes final
only when each of them reaches confirmed (or expired / failed)
— which is also when the money is settled. A mode B completed
order can hold expired items: the energy was delivered and your
transaction failed on its own (see ItemError); whether a transfer
went out is the item's confirmed, not the order's status. Any item outside the two groups
below (pending, delegated, broadcasting, broadcasted) means
the order is not final yet and leaves its status where it is.
An order is fulfilled when the energy has been delivered, not when we see the transfer: in mode A you send the transaction yourself, and the order status does not depend on it. Charging happens at the same moment; the rule is unchanged: we charge for energy provided.
The final status is determined by the mix of item statuses:
- energy delivered for all (
ready/sent/expired/confirmed) →completed; - some delivered, some
failed→partially_completed; - all
failed→failed.
expired remains in the enum for history: in mode A an order
becomes final before the send window expires.
awaiting_funds — mode b only, and only with auto_topup
enabled. Your prepaid balance did not cover the order, but the
signed transaction is already ours, so instead of a 402 the order
is parked: no hold is placed, a top-up request goes out
(topup.requested), and fund_before is the deadline for the
deposit to be credited. Pay it in time and the order becomes
funded at the price quoted in this very response — a price
recomputed before your deposit lands does not change it; from there it is
filled like any order, raise included (see "Order price" in the
introduction). Miss it and the
order goes failed with error_code = funding_window_missed: no
money moved at either end, and the signed transaction is free to be
submitted in a new order.
Type: string.
One of: created, awaiting_funds, funded, purchasing, ready, completed, partially_completed, expired, failed, canceled.
LedgerRow
One row of the money history. GET /ledger returns a page of these,
and POST /sandbox/deposit answers with the single row it wrote —
deliberately the same schema, so that one parser reads both and a
sandbox rehearsal exercises the type an integration will meet in
production. What a sandbox row narrows (type is always deposit,
txid always the sandbox-<uuid> form) is said at that endpoint, in
prose and examples: narrowing it here would give the two responses two
shapes and put the divergence back.
| Field | Type | Required | Description |
|---|---|---|---|
id | string | required | |
type | string | required | One of: |
amount_trx | TRX | required | Absolute amount; direction is defined by |
balance_after_trx | TRX | required | Full balance after the operation. Unchanged for
|
order_id | string or null | required | |
queue_session_id | string or null | required | The queue session this movement belongs to ( |
txid | string or null | required | |
created_at | string (date-time) | required |
ItemStatus
pending — the item is accepted, energy not yet delivered;
delegated — the energy is confirmed on-chain at the from
address (a provider's response alone does not grant this status);
ready — the energy is delivered and send_before is known; for
mode A this is the obligation fulfilled, and the order becomes
completed at this point;
sent — the outgoing transaction has been seen in the network
(informational: affects neither money nor order status);
broadcasting/broadcasted — mode B, the transaction is being
sent / has been accepted by the network;
confirmed — mode B, after solidification (~1 min);
expired — mode A: you did not send the transfer before
send_before; the energy was delivered, so it is charged and does
not spoil fulfillment. Mode B: the energy was delivered and
your own transaction then failed — the node refused it for what it
is (error: broadcast_failed), or it was mined and the contract
refused it or it ran out of energy having spent less than the
transfer's requirement (error: transaction_reverted); charged, and
the signed transaction stays used;
failed — the service was not delivered through our fault; no
charge, the hold is returned. This also covers a mode B item we
failed to send before send_before
(error: broadcast_window_missed): past the promised deadline we
do not broadcast, and we do not charge for what was not sent — a
mode B broadcast no node took for reasons of its own
(error: broadcast_failed), and a mode B transfer mined and run out
of energy where the shortfall is shown to be ours
(error: transaction_reverted; the signed transaction is in a block
and stays used).
Type: string.
One of: pending, delegated, ready, sent, broadcasting, broadcasted, confirmed, expired, failed.
ItemError
The reason on a failed item — a closed list — and, in mode B, on
an expired one. null for the other statuses; an expired item
of modes A and C has no reason (it is not a failure but unused
energy, and it is charged).
purchase_failed — the energy could not be purchased. It also
covers a market dearer than the position's price whose raise could
not be made — your available balance was short of the difference,
or the price would have gone above the cap (see "Order price" in the
introduction); on a bulk position, only while nothing has been
bought for it and allow_partial is off — later such a fill ends
short instead. On a bulk position it also covers "the market could
not cover the whole volume": a position that did not allow a partial
fill and could not be completed is a purchase that did not happen,
and it is refused the same way and refunded the same way;
broadcast_failed — mode B, the node rejected the transaction. On
a failed item no node took it for reasons of its own (none
answered, busy, no peers, any code not listed next) and the hold is
returned — TRANSACTION_EXPIRATION_ERROR among them: a deadline
past the node's horizon is refused at acceptance, so after delivery
it means the node's clock and ours disagree. On an expired item
the node refused the transaction itself after the energy was
delivered — TAPOS_ERROR, SIGERROR, BANDWITH_ERROR,
CONTRACT_VALIDATE_ERROR — and the item is charged;
transaction_reverted — mode B, the transaction made it into a
block and did not execute. On an expired item it is charged:
the contract refused the transfer (a REVERT — the USDT left the
wallet after the order, the wallet was blacklisted — or an
OUT_OF_TIME, the call past the network's execution time), or the
call ran out of energy (OUT_OF_ENERGY) having spent less than the
transfer's requirement — 64,285 units for a single, 130,285 for a
double, the dry run's measurement for a custom — so the energy we
delivered was not on the address when it ran. On a failed item the
call ran out of energy and the shortfall is shown to be ours: it spent
at least the requirement and still ran out (our estimate was short —
a recipient balance emptied after the dry run that doubled the cost),
or our records show the vendor revoked the delegation before your
transfer's block, or another of your transfers from the same
address — in this order or another — took its energy: your transfers
from that address whose energy was on it at the block together spent
at least what they together required;
the hold is returned. Either way the transaction is
in a block, and the same signed bytes are not accepted again;
broadcast_window_missed — mode B, we did not send it before
send_before;
window_closed_before_send — the window closed on an item that
never reached ready; this is an inconsistency on our side, the
money is returned;
funding_window_missed — mode B, the order was awaiting_funds
and the deposit was not credited before fund_before. Nothing was
ever held for it and nothing was bought, so there is no refund to
make; the signed transaction is released and may go into a new
order.
On a failed item none of these is ever charged for. The first five
return the hold in full; funding_window_missed has nothing to
return — there was none. The two mode B reasons on an expired item
are the exception, and the only one: the energy was delivered and
your own transaction failed, so the item's price is charged.
Type: string or null.
One of: purchase_failed, broadcast_failed, transaction_reverted, broadcast_window_missed, window_closed_before_send, funding_window_missed.
OrderErrorCode
The reason on a failed order — the same values as on items
(ItemError), plus multiple_causes when items failed for
different reasons. null for the other statuses.
transaction_reverted is the reason of a mode b order whose
transfers ran out of energy where the shortfall was shown to be
ours, and were refunded. A transaction the contract refused is charged
and closes its item expired, which sets no order reason.
Type: string or null.
One of: purchase_failed, broadcast_failed, transaction_reverted, broadcast_window_missed, window_closed_before_send, funding_window_missed, multiple_causes.
OrderRequestModeA
| Field | Type | Required | Description |
|---|---|---|---|
mode | string | required | Always |
transfers | array of object | required | Minimum items: |
transfers[].from | TronAddress | required | |
transfers[].to | TronAddress | required | |
duration_s | integer | optional | How long the energy is leased for, in seconds — one of the
products on sale ( It decides two things at once: the price of every position
( No Default: |
client_ref | string or null | optional | Your identifier for reconciliation Maximum length: |
OrderRequestModeB
| Field | Type | Required | Description |
|---|---|---|---|
mode | string | required | Always |
transfers | array of object | required | Minimum items: |
transfers[].signed_tx | string | required | The signed transaction in hex. The private key is never transmitted. Only a The transaction must remain valid for at least 3 minutes
at the moment the order is created — it has to survive
energy delivery and the broadcast — and for no more than
24 hours less a minute, past which no node accepts it.
Its TAPOS reference must be the usual shape: two bytes of
Its own expiry also shortens |
duration_s | integer | optional | The lease, in seconds — same rule and same allowed values as in
mode A long lease does not lengthen Default: |
client_ref | string or null | optional | Maximum length: |
OrderRequestModeC
Energy for a wallet, with no transfer named. You say which wallet and how much; there is no recipient, and so no transaction for us to see or to broadcast.
This is the mode for when the recipient is not known yet, or when
you are topping a wallet up ahead of a batch you will assemble
later. Because there is no recipient, the volume cannot be derived
and you state it yourself — as kind, which also means we cannot
correct it (single on a transfer that turns out to need double
leaves the transfer short of energy, and the difference burns TRX),
or as energy_units, a number of your own.
A position names one of the two, never both and never neither.
kind is the transfer-shaped volume, energy_units is a volume you
chose; sending both is 400 invalid_request with
details.reason = kind_and_energy_units, because the two would have
to be reconciled and there is no rule that says which wins.
Items of such an order carry to: null and never reach sent:
there is no transfer for us to match. They stand at ready for the
send_before window and become expired when it closes, which
here means the lease ran out — the normal end, not a failure.
| Field | Type | Required | Description |
|---|---|---|---|
mode | string | required | Always |
transfers | array of object | required | Minimum items: |
transfers[].from | TronAddress | required | The wallet the energy is delegated to. It must be activated on chain, or the order is refused with |
transfers[].kind | EnergyKind | optional | |
transfers[].energy_units | integer | optional | How much energy this wallet is to receive, in units —
instead of Above 131,000 the order's Outside
The per-unit price is set when the order is created.
It is the product's current price, or higher when
assembling this volume from the market at that moment costs
more than the current price covers; it is never lower than
the current price. The per-unit price can be raised while the volume is being filled (see "Order price" in the introduction): before the first piece is bought, or between pieces, when what the market sells the rest for leaves less than our minimum margin under it. The raise covers the whole position, units already delivered included, and is held from your balance before anything more is bought; a raise nothing more was bought after is taken back when the fill ends short. It never goes below the price at creation. You are billed per unit that arrives. The price you
are quoted is Minimum: |
transfers[].allow_partial | boolean | optional | Whether to start filling a volume the market visibly
cannot cover. Meaningful only beside
Neither setting can undo a delegation. Once the first
piece has been bought it is on your wallet for the lease,
so a market that moves during the fill — capacity gone, a
source refusing — ends that fill where it stands, on
It is per position. In a batch, one position may accept a short fill while another insists on the whole volume. Default: |
duration_s | integer | optional | The lease, in seconds — same rule and same allowed values as in
mode This is the mode where a long lease means most: there is no
transfer to send, so the whole product is "this wallet has
energy until A position asking for more than 131,000 Default: |
client_ref | string or null | optional | Your identifier for reconciliation Maximum length: |
OrderItem
| Field | Type | Required | Description |
|---|---|---|---|
id | string | required | |
from | TronAddress | required | |
to | TronAddress or null | required |
|
kind | ItemKind | required | |
energy_units | integer | required | The volume ordered, in units, and the basis of |
energy_delivered | integer or null | required | The energy confirmed on chain for this position, in units.
On a A measurement within half a percent of Never above |
price_trx | TRX | required | |
status | ItemStatus | required | |
txid | string or null | required | |
error | ItemError | required |
Order
| Field | Type | Required | Description |
|---|---|---|---|
id | string | required | Example: |
mode | string | required | One of: |
status | OrderStatus | required | |
duration_s | integer | required | The lease this order was sold as, in seconds — the value you sent or the default that stood in for it. Always present, on every order however old: an order created before the field existed was a five-minute one and says so. Read it rather than remembering what you asked for. It is the
product the price was taken from and the term Example: |
total_trx | TRX | required | The price of the order now — the amount the hold stands at. It is
|
quoted_total_trx | TRX | required | The order's total at creation — the amount the hold was placed
for. It never changes. Equal to |
charged_trx | TRX or null | required | What the order actually cost once it settled — the amount taken
from the hold. On The same figure the closing |
burn_cost_trx | TRX | required | Informational — what the transfer would have cost by burning
TRX. Locked at order creation using the network's burn price in
effect and never recalculated: it is the base for the savings
in |
send_before | string (date-time) or null | required | Appears with the The window is In mode |
fund_before | string (date-time) or null | required | Present only while the status is It is the sooner of two deadlines: ten minutes from acceptance,
and the expiry of your own signed transaction less the margin
the purchase and delegation need. A transaction with little
life left therefore gets a short window, and one with too
little to be worth parking is refused with the ordinary |
client_ref | string or null | required | |
items | array of OrderItem | required | |
error_code | OrderErrorCode | required | |
created_at | string (date-time) | required | |
updated_at | string (date-time) | required |
ProductTariff
One lease on sale and its price now. Products are priced
independently against the market — a day is not five minutes times
288 — so every field here is about this duration_s and nothing in it
can be derived from another entry.
The price unit is the one used everywhere else in this contract: sun per unit of energy for the whole lease. A one-day product at 110 sun/unit costs 110 sun per unit for the whole day, not per hour; nothing here is a rate to be multiplied by time.
| Field | Type | Required | Description |
|---|---|---|---|
duration_s | integer | required | The lease in seconds — the value to send as Example: |
current_price_sun | integer | required | What one unit of energy costs on this product right now, in sun, for the whole lease. This is the number an order of this duration is priced at if it is created now. Example: |
custom | boolean | required |
Example: |
typical_price_trx | object | required | Approximate price of a single transfer on this lease |
typical_price_trx.single | TRX | required | |
typical_price_trx.double | TRX | required |
Settings
AutoTopup
Whether — and how much — we should ask you to top up. Always present,
enabled: false with zeroes for an account that has never set it.
With it off, a 402 is exactly the 402 it always was and nothing is
written to GET /topup-requests. With it on, a refused order raises
a top-up request and sends topup.requested; so does a balance under
balance_low_threshold_trx, provided there is a target_trx to fill
to. How much is asked for is under target_trx and min_trx below.
| Field | Type | Required | Description |
|---|---|---|---|
enabled | boolean | required | Requires |
target_trx | TRX | required | The balance a request tops you up to. A refused order asks for
the shortfall plus
When both are set, this must be at least
|
min_trx | TRX | required | Added on top of a shortfall, so paying a request does not leave
you at zero and the next order refused again. On a low balance it
is a floor rather than an addition: the fill up to |
max_per_day_trx | TRX | required | The ceiling on everything requested within one UTC day. A request is clipped to what is left of it, and no request is made at all if the clipped amount would not cover the shortfall that prompted it — an amount that cannot unblock your order is worse than none. Cancelling a request gives its room back; letting one expire does not, because the money may still arrive. |
AutoTopupPatch
An edit of the auto-top-up policy. Only the fields you send change; a
null in any of them means "not sent", the same as leaving it out.
TopupRequestStatus
open — we are waiting for the money; fulfilled — deposits since the
request covered it (or your target_trx was reached by some other
route); expired — nobody answered within a day; canceled — you
withdrew it. Only open can be cancelled.
Type: string.
One of: open, fulfilled, expired, canceled.
TopupRequestReason
order_insufficient_balance — an order was refused just now and is
waiting on this deposit; balance_low — nothing has failed yet, the
available balance simply fell under your threshold.
This can change on a request you have already seen. It escalates
one way, balance_low → order_insufficient_balance, when an order is
refused while the request is open, and the escalation re-sends
topup.requested even if amount_trx did not move.
Type: string.
One of: order_insufficient_balance, balance_low.
TopupRequest
| Field | Type | Required | Description |
|---|---|---|---|
id | string | required | |
status | TopupRequestStatus | required | |
reason | TopupRequestReason | required | |
amount_trx | TRX | required | How much to send. Raised, never lowered, while the request is
open: a further shortfall replaces this with the larger figure and
re-sends |
deposit_address | TronAddress | required | Where to send it — your deposit address as of the moment the request was made, not a live lookup. It is the address the webhook named, and it stays the same for the life of the request. |
order_id | string or null | required | The order waiting on this money, when there is one. |
expires_at | string (date-time) | required | |
fulfilled_at | string (date-time) or null | required | |
fulfilled_txid | string or null | required | The transaction whose credit closed the request — the last one counted, not the whole story: several transfers may add up to one request. |
created_at | string (date-time) | required | |
updated_at | string (date-time) | required |
MaintenanceRuleStatus
paused — the rule neither spends nor tops up. Set by you (PATCH)
or by the system when the balance cannot cover the daily hold
(paused_reason: insufficient_balance). Resumed only by an
explicit PATCH.
Type: string.
One of: active, paused.
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 |
MaintenanceRulePatch
| Field | Type | Required | Description |
|---|---|---|---|
status | MaintenanceRuleStatus or null | optional | |
daily_budget_trx | TRX or null | optional |
MaintenanceRule
| Field | Type | Required | Description |
|---|---|---|---|
id | string | required | Example: |
address | TronAddress | required | |
daily_budget_trx | TRX | required | |
status | MaintenanceRuleStatus | required | |
paused_reason | string or null | required | Set when the rule was stopped by the system: the available
balance could not cover a new daily hold. A pause set by you
has no reason ( Always |
spent_today_trx | TRX | required | Charged against the daily budget during the current UTC day |
last_topup_at | string (date-time) or null | required | |
created_at | string (date-time) | required | |
updated_at | string (date-time) | required |
AddressBookEntryCreate
| Field | Type | Required | Description |
|---|---|---|---|
address | TronAddress | required | |
name | string | required | Trimmed of surrounding spaces; 1–64 characters after that. Minimum length: |
note | string or null | optional | Empty or blank is stored as Maximum length: |
tags | array of string | optional | Up to ten distinct tags. Each is trimmed and must then be 1–32
characters with no comma, Maximum items: |
AddressBookEntryUpdate
| Field | Type | Required | Description |
|---|---|---|---|
name | string | optional | Minimum length: |
note | string or null | optional | Maximum length: |
tags | array of string | optional | Replaces the whole array. Same rules as on creation: up to ten distinct tags, at most 50 items as sent. Maximum items: |
AddressBookEntry
| Field | Type | Required | Description |
|---|---|---|---|
id | string | required | |
address | TronAddress | required | |
name | string | required | |
note | string or null | required | |
tags | array of string | required | |
created_at | string (date-time) | required | |
updated_at | string (date-time) | required | |
usage | object | required | What this account did with the address, computed when you read it from the account's own history and nobody else's. Keyed by the address, not by the entry: an address deleted and saved again shows the same numbers. |
usage.orders_as_sender | integer | required | Order items of this account sent from the address ( |
usage.orders_as_recipient | integer | required | Order items of this account sent to the address ( |
usage.last_used_at | string (date-time) or null | required | The latest creation time among this account's order items
(either side), queue sessions (sender), queue items
(recipient) and auto-refill rules on the address. |
usage.auto_refill_rule_id | string or null | required | This account's live ( |
usage.queue_session_id | string or null | required | This account's live ( |
chain | object or null | required |
|
chain.activated | boolean | required | |
chain.holds_usdt | boolean | required | |
chain.blacklisted | boolean | required | |
chain.is_contract | boolean | required | |
chain.expected_kind | TransferKind | required |
AddressBookImport
| Field | Type | Required | Description |
|---|---|---|---|
entries | array of AddressBookEntryCreate | required | Each row has the shape of Minimum items: |
AddressBookImportResult
| Field | Type | Required | Description |
|---|---|---|---|
results | array of object | required | One per row of the body, in body order. |
results[].index | integer | required | The row's position in |
results[].status | string | required | One of: |
results[].id | string or null | required |
|
results[].reason | string or null | required | Set only when One of: |
created | integer | required | |
exists | integer | required | |
errors | integer | required |
AddressBookSuggestion
| Field | Type | Required | Description |
|---|---|---|---|
address | TronAddress | required | |
orders_as_sender | integer | required | Order items of this account sent from the address. |
orders_as_recipient | integer | required | Order items of this account sent to the address. |
last_used_at | string (date-time) | required | The latest creation time among this account's order items, queue sessions, queue items and auto-refill rules on the address. |
AddressBookTag
| Field | Type | Required | Description |
|---|---|---|---|
tag | string | required | The tag as the book spells it. |
count | integer | required | Entries carrying the tag. |
AddressBookTagRename
| Field | Type | Required | Description |
|---|---|---|---|
from | string | required | Minimum length: |
to | string | required | Minimum length: |
AddressBookTagDelete
| Field | Type | Required | Description |
|---|---|---|---|
tag | string | required | Minimum length: |
AddressBookBulkTags
At least one of add and remove must name a tag.
| Field | Type | Required | Description |
|---|---|---|---|
ids | array of string (uuid) | required | Entry ids; a repeated id counts once. Minimum items: |
add | array of string | optional | Tags to put on every listed entry, after Maximum items: |
remove | array of string | optional | Tags to take off every listed entry, before Maximum items: |
AddressBookUpdated
| Field | Type | Required | Description |
|---|---|---|---|
updated | integer | required | Entries actually changed. |
AddressBookBulkDelete
| Field | Type | Required | Description |
|---|---|---|---|
ids | array of string (uuid) | required | Entry ids; a repeated id counts once, and one that is not an entry of your book is skipped. Minimum items: |
AddressBookDeleted
| Field | Type | Required | Description |
|---|---|---|---|
deleted | integer | required | Entries this call deleted. |
USDTAmount
A USDT amount as a decimal string — no float, like TRX. Up to six
fractional digits are accepted on input ("120.5", "1000");
responses always carry six ("120.500000").
Type: string.
Pattern: ^\d+(\.\d{1,6})?$.
QueueSessionStatus
created — the queue is recorded, nothing is reserved or bought yet;
running — buying; paused — not buying until the cause clears,
which it does by itself (see QueueSessionReason); completed — the
queue was exhausted and the last delivered packet has expired;
stopped — you stopped it. The last two are final.
Type: string.
One of: created, running, paused, completed, stopped.
QueueSessionReason
Why the session is in its current status — the reason of the last
transition. Pauses: insufficient_balance — the wallet's USDT
balance is below the next transfer's amount; hold_exhausted — the
available balance could not cover even the next packet, at the price
that packet is sold at (which can be above the tariff, see
queue.packet_delivered); the session resumes by itself once a
deposit covers the difference;
service_paused — the service is not accepting orders right now.
Each pause lifts itself when its cause clears: balance_restored,
hold_restored, service_resumed. queue_exhausted closes a
session as completed; client_stop closes it as stopped;
client_start is a running session that has not paused yet.
Type: string.
One of: client_start, client_stop, insufficient_balance, hold_exhausted, service_paused, balance_restored, hold_restored, service_resumed, queue_exhausted.
QueueItemStatus
pending — waiting for your transfer; sent — your transfer to this
recipient was seen on-chain; skipped — this item was at the head of
the queue and was not seen sent within the skip window, so the queue
moved past it. A skipped item is not re-queued.
Type: string.
One of: pending, sent, skipped.
QueueItemReason
transfer_seen goes with sent, not_sent_in_time with skipped;
null while the item is pending.
Type: string.
One of: transfer_seen, not_sent_in_time.
QueueItemInput
| Field | Type | Required | Description |
|---|---|---|---|
to | TronAddress | required | The recipient of the USDT transfer |
amount_usdt | USDTAmount | required | The amount you are going to send. It is what the session checks the wallet's USDT balance against before buying energy for this item, and what matches your transfer to the item when several items name the same recipient. |
QueueSessionCreate
| Field | Type | Required | Description |
|---|---|---|---|
from | TronAddress | required | The sender wallet. Must be activated, must not be a contract and must not be on the USDT blacklist. One live session per wallet. |
target_units | integer | optional | The level of free energy to keep on the wallet, in energy units.
A floor, not a purchase size: the session never holds more
energy than the next transfers in the queue need. Not below
65 000 — what one transfer to an address that already holds USDT
costs: a target under that is a level no transfer can leave from,
and it is refused rather than rounded up. The default and the
ceiling are the service's settings ( Default: |
items | array of QueueItemInput | optional | The first transfers of the queue, in sending order. May be empty.
Not together with Maximum items: |
expected_transfers | integer or null | optional | A session without a list: how many transfers are coming, and
nothing about them. Every outgoing USDT transfer of the wallet
after Start counts as one; the level is sized by what a transfer
of this wallet has been costing (its recent history — a transfer
to an empty address until there is any); the USDT-balance pause
does not apply, and items cannot be appended — create another
session for more. One of Minimum: |
QueueItemsAppend
| Field | Type | Required | Description |
|---|---|---|---|
items | array of QueueItemInput | required | Minimum items: |
QueueItemsAppended
| Field | Type | Required | Description |
|---|---|---|---|
added | integer | required | How many items this request appended |
items_total | integer | required | Items in the session after the append |
items_pending | integer | required | Items still waiting to be sent — the remaining-payments counter |
QueueNextItem
| Field | Type | Required | Description |
|---|---|---|---|
seq | integer | required | |
to | TronAddress | required | |
amount_usdt | USDTAmount | required | |
kind | TransferKind or null | required | The transfer kind of the recipient as last checked; |
need_units | integer or null | required | Energy the transfer needs by its |
QueueCounters
The session's counters. items_pending is the remaining-payments
counter; packets_confirmed counts every packet whose delivery was
seen on-chain, including those whose lease has since ended;
units_delivered and charged_trx sum those packets.
| Field | Type | Required | Description |
|---|---|---|---|
items_total | integer | required | |
items_pending | integer | required | |
items_sent | integer | required | |
items_skipped | integer | required | |
packets_bought | integer | required | |
packets_confirmed | integer | required | |
units_delivered | integer | required | |
charged_trx | TRX | required |
QueueSession
Every field of QueueCounters, and the fields below.
| Field | Type | Required | Description |
|---|---|---|---|
id | string | required | |
from | TronAddress | required | |
target_units | integer | required | |
expected_transfers | integer or null | required | The count a session without a list was created with; |
status | QueueSessionStatus | required | |
reason | QueueSessionReason or null | required | The reason of the last status transition; |
hold_trx | TRX | required | What is currently reserved on your balance for this session —
the remainder of its hold. |
free_energy_units | integer or null | required | Free energy on the wallet at the last uncached reading; |
free_energy_at | string (date-time) or null | required | |
usdt_balance | USDTAmount or null | required | The wallet's USDT balance at the last reading; |
usdt_balance_at | string (date-time) or null | required | |
next_item | QueueNextItem or null | required | The head of the queue — the next transfer we expect; |
created_at | string (date-time) | required | |
started_at | string (date-time) or null | required | |
stopped_at | string (date-time) or null | required | When buying ended — set on |
updated_at | string (date-time) | required |
QueueItem
| Field | Type | Required | Description |
|---|---|---|---|
seq | integer | required | 1-based position in the queue, in append order |
to | TronAddress | required | |
amount_usdt | USDTAmount | required | |
kind | TransferKind or null | required | The recipient's transfer kind as last checked — re-read while the
item is within the sizing window, because a recipient's USDT
balance can change between append and send; |
status | QueueItemStatus | required | |
reason | QueueItemReason or null | required | |
sent_txid | string or null | required | The transfer we matched to this item; |
sent_at | string (date-time) or null | required |
QueueStartedData
| Field | Type | Required | Description |
|---|---|---|---|
session_id | string | required | |
from | TronAddress | required | |
target_units | integer | required | |
hold_trx | TRX | required | |
counters | QueueCounters | required |
QueuePacketDeliveredData
One packet, confirmed on-chain and charged. units is what was
bought, price_sun the price per unit the packet was sold at (an
integer, like current_price_sun in GET /tariff), charged_trx
their product — this packet's charge; the session's running totals
are in counters.
price_sun is the five-minute tariff price of the moment of
purchase, or above it when the vendor that sold the packet cost
more than the tariff leaves our minimum margin under — then the
lowest whole-sun price that covers that cost with the margin (see
POST /queue-sessions). Read the charge from here, not from
GET /tariff.
| Field | Type | Required | Description |
|---|---|---|---|
session_id | string | required | |
packet_id | string | required | |
units | integer | required | |
price_sun | integer | required | |
charged_trx | TRX | required | |
hold_trx | TRX | required | The hold's remainder after this charge |
counters | QueueCounters | required |
QueuePausedData
| Field | Type | Required | Description |
|---|---|---|---|
session_id | string | required | |
reason | QueueSessionReason | required |
|
counters | QueueCounters | required |
QueueResumedData
| Field | Type | Required | Description |
|---|---|---|---|
session_id | string | required | |
reason | QueueSessionReason | required |
|
counters | QueueCounters | required |
QueueCompletedData
| Field | Type | Required | Description |
|---|---|---|---|
session_id | string | required | |
reason | QueueSessionReason | required |
|
hold_trx | TRX | required |
|
counters | QueueCounters | required | Final — nothing is bought or charged after this event |
QueueStoppedData
| Field | Type | Required | Description |
|---|---|---|---|
session_id | string | required | |
reason | QueueSessionReason | required |
|
hold_trx | TRX | required | The hold's remainder at the moment of the stop. Not necessarily
zero: packets bought just before the stop are still settled, each
with its own |
counters | QueueCounters | required | As of the stop; packets settled afterwards add to them |
WebhookEvent
topup.* and maintenance.topup are close in name and are not the
same thing. maintenance.topup is energy delivered to a wallet
under an auto-refill rule (§10); topup.requested / topup.fulfilled
/ topup.expired are about TRX we asked you to send to your
deposit address. Money actually credited stays deposit.credited.
deposit.credited is sent for a deposit of 1 TRX or more. A
smaller one — a wallet probing the address, change, the tail of a
test — is credited without it: the balance moves and the deposit
row is in GET /ledger, but no deposit.credited is sent, to a
webhook or anywhere else. Exactly 1 TRX is announced. The events
about the request and the balance are not muted: if such a deposit
completes an open top-up request, topup.fulfilled still arrives,
carrying its txid, and balance.low still fires if the balance stays
under your threshold. An integration that keeps its own books to the
last sun reconciles against GET /balance and
GET /ledger?type=deposit, not against the events.
queue.* is the life of a queue session (api-spec.md §12.10, the
queueLifecycle entry under webhooks:), in the order a session
goes through them.
order.repriced is an order's price raised to the market at
fulfillment, or a volume raise taken back (the orderRepriced entry
under webhooks:, and "Order price" in the introduction). It is not
a closing event: the order goes on.
Type: string.
One of: order.ready, order.item.sent, order.item.expired, order.completed, order.partially_completed, order.failed, order.repriced, deposit.credited, balance.low, topup.requested, topup.fulfilled, topup.expired, maintenance.topup, maintenance.budget_exhausted, maintenance.paused, queue.started, queue.packet_delivered, queue.paused, queue.resumed, queue.completed, queue.stopped.
DeliveredWebhookEvent
What can stand in a delivery-log row: every subscribable event plus
webhook.test, the probe from POST /webhooks/{id}/test. The probe
is deliberately absent from WebhookEvent — it cannot be subscribed
to — but it is delivered through the same queue and shows up in the
same log.
Type: string.
One of: order.ready, order.item.sent, order.item.expired, order.completed, order.partially_completed, order.failed, order.repriced, deposit.credited, balance.low, topup.requested, topup.fulfilled, topup.expired, maintenance.topup, maintenance.budget_exhausted, maintenance.paused, queue.started, queue.packet_delivered, queue.paused, queue.resumed, queue.completed, queue.stopped, webhook.test.
WebhookEndpoint
| Field | Type | Required | Description |
|---|---|---|---|
id | string | required | |
url | string (uri) | required | |
events | array of WebhookEvent | required | |
status | string | required |
One of: |
disabled_at | string (date-time) or null | required | When we stopped delivering here. |
disabled_reason | string or null | required | Why we stopped, |
created_at | string (date-time) | required |
WebhookDelivery
| Field | Type | Required | Description |
|---|---|---|---|
id | string | required | |
event | DeliveredWebhookEvent | required | |
event_id | string (uuid) | required | The same value the receiver saw in the body and header |
status | string | required | One of: |
attempts | integer | required | Attempts made so far. A replay resets it to zero, so the row can
read |
response_status | integer or null | required | What the receiver answered with. |
last_error | string or null | required | |
last_attempt_at | string (date-time) or null | required | |
failed_attempts | integer or null | required | How many attempts this delivery lost, over its whole life. The four
fields above describe the last attempt only, so on a delivery
that finally went through they describe the attempt that worked —
this is what says whether it went through first time or after three
refusals. It is not |
last_failure_at | string (date-time) or null | required | When the most recent failed attempt was. |
last_failure_status | integer or null | required | What the receiver answered on that attempt. |
last_failure_error | string or null | required | What that failure was — |
next_retry_at | string (date-time) or null | required | When the next attempt is due. |
created_at | string (date-time) | required | When the event was queued, not when it was last tried |
WebhookTestResult
| Field | Type | Required | Description |
|---|---|---|---|
delivery_id | string | required | The row this probe left in the delivery log |
event_id | string (uuid) | required | |
event | string | required | Always |
delivered | boolean | required | Whether the receiver answered 2xx |
response_status | integer or null | required | |
error | string or null | required | What got in the way. |
WebhookPayload
| Field | Type | Required | Description |
|---|---|---|---|
event | DeliveredWebhookEvent | optional | |
event_id | string (uuid) | optional | Deduplication key, stable across every retry of this event —
automatic ones and replays requested through
It is inside the signed body on purpose, and mirrored in the
|
sent_at | string (date-time) | optional | |
data | object | optional | Fields beyond these are allowed. |
Error
| Field | Type | Required | Description |
|---|---|---|---|
error | object | optional | |
error.code | string | optional |
This is the field to branch on. One of: |
error.message | string | optional | Human-readable explanation, in English. Not for parsing —
everything a program needs is in Example: |
error.details | object | optional | Machine-readable specifics, shaped by Fields beyond these are allowed. |
error.details.errors | array of FieldError | optional | Which fields failed validation, and why. Present on
|
FieldError
One failed field inside details.errors.
| Field | Type | Required | Description |
|---|---|---|---|
field | string | required | Where the value came from and what it is called, joined by dots:
the first segment is the part of the request ( Example: |
message | string | required | What is wrong with this value, in English. Example: |
type | string | required | The validation rule that rejected it — Pydantic's error type,
passed through unchanged. Stable enough to branch on for the
common cases ( Example: |