Before you start
- A sandbox API key exported as
PLATFORM_API_KEY. - A treasury wallet on Tron with some test TRX, to fund the gas station. Save its ID as
TREASURY_WALLET_ID. - A sending wallet on Tron with test USDT and no TRX. Save its ID as
WALLET_ID.
1
Create the gas station
Create gas station needs a Save the
name, a chain, and a threshold. Turn on auto-refill at the same time, so the station tops itself up from the treasury wallet.id as GAS_STATION_ID. The balance is zero, so health_status starts as low. threshold and refill_amount are in TRX. Don’t send network: it follows your API key.2
Fund it
Refill it once by hand with Refill gas station, from the treasury wallet.The response is the funding transaction. Once it completes, Get gas station shows
health_status as healthy.3
Estimate a sponsored transfer
Estimate transaction fee with
sponsor: true shows what the gas station will pay.4
Send it
Send the same body to Create transaction, with an The transaction passes through
Idempotency-Key.awaiting_sponsorship before broadcasting. When it completes, it has "sponsored": true and the gas_station_id that paid. The sending wallet’s TRX balance is still zero.If one of your policies holds the transaction, you get 202 instead. See Handle held and rejected transactions.5
Alert before it runs dry
Subscribe to the gas station events with Create webhook:
gas_station.low_balanceandgas_station.critical_balance: page whoever funds the treasury wallet.gas_station.auto_refilled: log it, and watch how often it fires.
Sizing the threshold and refill
Size both from your volume, not from a guess:threshold: enough for the transfers you send in the time it takes a refill to confirm, plus a margin. On a busy chain, a few hours of fees.refill_amount: enough for about a day of fees. Too small and you refill constantly, paying a fee each time. Too large and you hold idle native balance in a hot account.
auto_refilled events.
Change the configuration
Update gas station changesname, threshold, refill_amount, and auto_refill_enabled. Fields you leave out stay unchanged.
One per chain
Create a gas station for each chain you send sponsored transfers on. List gas stations withchain=tron shows the stations you have on a chain. The exchange integration guide shows a multi-chain setup.