Queue
Queue sessions — a wallet kept at a level of energy for a run of transfers, paid per delivered packet
GET /queue-sessions
List queue sessions
Authentication: Required — an API key in Authorization: Bearer … (authentication).
Your queue sessions, newest first. status and from narrow the
list; pagination is cursor-based like GET /orders.
Answers 404 not_found — like every /queue-sessions path — while
queue mode is switched off for your account. It is on for every
account by default; contact support if it has been switched off for
yours.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
status | query | optional | QueueSessionStatus | |
from | query | optional | TronAddress | Only sessions on this sender wallet |
cursor | query | optional | string | |
limit | query | optional | integer | Default: |
Responses
200
OK
Content type application/json.
| Field | Type | Required | Description |
|---|---|---|---|
data | array of QueueSession | required | |
next_cursor | string or null | required |
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. |
POST /queue-sessions
Create a queue session
Authentication: Required — an API key in Authorization: Bearer … (authentication).
A queue session on one sender wallet: a target level of free energy
and either an ordered list of the USDT transfers you are about to
send from it (items) or just how many are coming
(expected_transfers). Nothing is bought and nothing is reserved
yet — the session is created; POST /queue-sessions/{session_id}/start
places the hold and starts buying (api-spec.md §12).
From Start, the session keeps the wallet at target_units of free
energy by buying the cheapest five-minute energy packet by packet:
a packet your transfer consumed is replaced on the next pass, a
packet about to expire is replaced before it expires, and towards
the end of the list the level shrinks to what is left to send —
nothing is bought for an empty list. It pauses by itself when the
wallet's USDT balance no longer covers the next transfer and resumes
by itself when it does; it completes when the queue is exhausted.
You are charged only for packets whose delivery is seen
on-chain, at the packet's price, and each charge arrives as a
queue.packet_delivered event — energy delivered to your wallet is
paid whether or not you spent it, so press Stop when you stop
sending. A packet's price is the five-minute tariff price of the
moment of purchase, or more when the vendor selling that packet
costs more than the tariff leaves our minimum margin under: then the
lowest whole-sun price that covers that cost with the margin. A
vendor whose packet would cost above a fixed multiple of the tariff
is not bought from. The packet is bought only when the session's
hold, topped up from your available balance, covers it at that
price; otherwise the session pauses hold_exhausted.
items may be empty: append with POST /queue-sessions/{session_id}/items
at any time before the session completes or is stopped. Transfers
are matched to items in queue order by recipient; an item at the
head of the queue that is not seen sent within the skip window is
skipped and never blocks the ones behind it.
With expected_transfers there is no list: every outgoing USDT
transfer of the wallet after Start counts as one of them, 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. items and expected_transfers
together are 400 invalid_request with
details.reason = items_or_expected_transfers; a count outside
1… the per-session ceiling is 400 invalid_request with
details.reason = expected_transfers_out_of_range.
Checks, in this order: the body (target_units within bounds,
amount_usdt a positive decimal with at most six places, at most
500 items) → 400 invalid_request; every address well-formed →
400 invalid_address with details.index of the first bad one;
then, before anything is asked of the chain, the available balance
covering one transfer's energy at the five-minute price
→ 402 insufficient_balance (nothing is reserved here — the
reserve is Start's, and Start's own 402 is still the one that
asks for it — this only refuses an account that could not pay for a
single transfer) and room in the account's node budget for the
sender and every item → 429 rate_limited (see "Rate limits"); the
sender usable — activated, not a contract, not on the USDT
blacklist → 422 invalid_address with details.reason =
inactive_wallet / contract_wallet / blacklisted_wallet; no
recipient on the USDT blacklist → 422 blacklisted_recipient with
details.index; fewer live sessions than your account allows →
422 invalid_request with details.reason = sessions_limit_reached;
the wallet not kept by a session of another account →
409 wallet_busy; no live (created, running or paused) session
of yours on this wallet already → 409 queue_session_active.
One account at a time keeps a wallet in queue mode: deliveries are
matched to the session that reads the wallet, and two accounts on one
wallet could not be told apart. A session that is running or
paused, or stopped but still settling its last packets, keeps the
wallet until it is settled. wallet_busy tells you only that some
other queue session uses the wallet — never whose, nor in what
state. A created session keeps nothing — Start is where the
wallet is taken. If several of your accounts stand behind one
treasury wallet, run queue sessions on it from one account at a
time; orders from a shared wallet are accepted as before.
Idempotency-Key is required and behaves exactly as on
POST /orders: a byte-identical retry returns the original session
with the same 201, the same key with a different body is
409 idempotency_conflict, and a request refused by validation does
not consume the key.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
Idempotency-Key | header | required | string | A unique request string (e.g., a UUID). A retry returns the original order. Body equality is checked by hashing the raw bytes of the
request, not the parsed JSON: a retry must be byte-identical.
Changed key order, whitespace or number formatting yields
The key is bound only to a created order. A request rejected by
validation ( Minimum length: |
Request body
Required.
Content type application/json.
Schema: 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: |
Example: A wallet, the default target and the first three payments
{
"from": "TQ5NMqJjW8sBGqcpvUcXhbXm3jGnyDCmwK",
"items": [
{
"to": "TN3W4H6rK2ce4vX9YnFQHwKENnHjoxb3m9",
"amount_usdt": "120.50"
},
{
"to": "TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7",
"amount_usdt": "1000"
},
{
"to": "TN3W4H6rK2ce4vX9YnFQHwKENnHjoxb3m9",
"amount_usdt": "35.000000"
}
]
}
Example: A session to append to later, with a higher target
{
"from": "TQ5NMqJjW8sBGqcpvUcXhbXm3jGnyDCmwK",
"target_units": 2000000
}
Responses
201
Session created; nothing reserved until Start
Content type application/json.
Schema: QueueSession.
402
insufficient_balance — the available balance does not cover one
transfer's energy at the five-minute price, so the
session could not pay for anything. Checked before the
chain is asked about the addresses; required_trx is that one
transfer's price, available_trx what you have. Nothing is
reserved and the Idempotency-Key is not consumed.
Content type application/json.
Schema: Error.
409
queue_session_active — a created, running or paused
session of yours already exists on this wallet; stop it or reuse
it. wallet_busy — a session of another account keeps this
wallet; details names only the wallet (from). Try again once
it ends, or use another wallet. idempotency_conflict — the same
Idempotency-Key with a different body.
Content type application/json.
Schema: Error.
422
The sender is well-formed but cannot be served, a recipient is
on the USDT blacklist, or the account is at its session limit.
details.reason says which: inactive_wallet,
contract_wallet, blacklisted_wallet (the sender), or
sessions_limit_reached (with limit); blacklisted_recipient
is its own code, with details.index of the item.
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 /queue-sessions/{session_id}
Get a queue session
Authentication: Required — an API key in Authorization: Bearer … (authentication).
The session with its counters, the head of the queue (next_item)
and the last uncached readings of the wallet — free energy and USDT
balance, each with the time it was taken. A session belonging to
another account is 404, the same as a session that does not exist.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
session_id | path | required | string |
Responses
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 /queue-sessions/{session_id}/items
List the session's items
Authentication: Required — an API key in Authorization: Bearer … (authentication).
The queue in sending order (seq ascending), cursor-paginated;
status narrows it to pending, sent or skipped items.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
session_id | path | required | string | |
status | query | optional | QueueItemStatus | |
cursor | query | optional | string | |
limit | query | optional | integer | Default: |
Responses
200
OK
Content type application/json.
| Field | Type | Required | Description |
|---|---|---|---|
data | array of QueueItem | required | |
next_cursor | string or null | required |
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. |
POST /queue-sessions/{session_id}/items
Append items to the queue
Authentication: Required — an API key in Authorization: Bearer … (authentication).
Appends 1 to 500 transfers to the end of the queue, in the order of
the body; they get the next seq numbers. Allowed while the session
is created, running or paused; a completed or stopped
session answers 409 queue_session_closed. A session created with
expected_transfers has no list to append to and answers
422 invalid_request with details.reason = session_without_items
— create another session for more transfers.
Recipients are checked the same way as at creation: well-formed →
else 400 invalid_address with details.index; then, before the
chain is asked, the balance gate of creation while the session is
still created (402 insufficient_balance — a started session
holds its reserve and is not asked for spare money) and room in the
node budget for every item (429 rate_limited); not on the USDT
blacklist → else 422 blacklisted_recipient with details.index.
The queue has a ceiling per session; past it the append is
422 invalid_request with details.reason = items_limit_reached.
Idempotency-Key is required, with the POST /orders semantics: a
byte-identical retry returns the original result — added as it
was, the counters as they are now — and does not append again.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
session_id | path | required | string | |
Idempotency-Key | header | required | string | A unique request string (e.g., a UUID). A retry returns the original order. Body equality is checked by hashing the raw bytes of the
request, not the parsed JSON: a retry must be byte-identical.
Changed key order, whitespace or number formatting yields
The key is bound only to a created order. A request rejected by
validation ( Minimum length: |
Request body
Required.
Content type application/json.
Schema: QueueItemsAppend.
| Field | Type | Required | Description |
|---|---|---|---|
items | array of QueueItemInput | required | Minimum items: |
Example: two_more
{
"items": [
{
"to": "TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7",
"amount_usdt": "250"
},
{
"to": "TN3W4H6rK2ce4vX9YnFQHwKENnHjoxb3m9",
"amount_usdt": "12.75"
}
]
}
Responses
402
insufficient_balance — the session is still created (nothing
reserved) and the available balance does not cover one transfer's
energy at the five-minute price. Checked before the
chain is asked about the recipients. A started session is never
refused this way: its reserve is already in place.
Content type application/json.
Schema: Error.
409
queue_session_closed — the session is completed or
stopped; open a new one. idempotency_conflict — the same
Idempotency-Key with a different body.
Content type application/json.
Schema: Error.
422
A recipient is on the USDT blacklist (blacklisted_recipient,
details.index), or the session is at its item ceiling
(invalid_request, details.reason = items_limit_reached).
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. |
POST /queue-sessions/{session_id}/start
Start the session
Authentication: Required — an API key in Authorization: Bearer … (authentication).
created → running. Places the session's hold — the target's worth
of five-minute energy at today's price, times a safety multiplier,
reserved from your available balance like an order hold — and starts
buying. hold_trx in the response is what was reserved; it is
topped up from your balance as packets are charged against it and
the unused remainder is released when the session ends.
Idempotent on a session that is already running or paused: 200
with the session unchanged. A completed or stopped session cannot
be restarted — 409 queue_session_closed; create a new one. The
wallet kept by a session of another account — 409 wallet_busy,
checked before the hold: nothing is reserved, the session stays
created, and Start can be repeated once the wallet is free. Not
enough available balance for the hold — 402 insufficient_balance
with required_trx and available_trx; the session stays
created, and Start can be repeated after a deposit.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
session_id | path | required | string |
Responses
409
queue_session_closed — the session is completed or stopped.
wallet_busy — a session of another account keeps this wallet
(running, paused, or stopped and still settling); nothing
was reserved, and details names only the wallet (from).
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. |
POST /queue-sessions/{session_id}/stop
Stop the session
Authentication: Required — an API key in Authorization: Bearer … (authentication).
created | running | paused → stopped: buying stops with this call.
Energy already delivered stays on the wallet until its lease ends
and is not refunded — it was delivered — and packets bought a moment
ago are still settled: each one confirmed on-chain is charged and
reported by queue.packet_delivered after the stop, and the unused
part of the hold is released once the last of them is settled.
Idempotent on a stopped session: 200 unchanged. A completed
session answers 409 queue_session_closed — there is nothing left
to stop.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
session_id | path | required | string |
Responses
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. |