> ## Documentation Index
> Fetch the complete documentation index at: https://www.bitnob.dev/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Bitnob API requests authenticate with an `X-Auth-Client` API key header against https://api.bitnob.com.
> Always use the sandbox environment for testing. Never put live API keys in sample code.
> Money amounts are integers in the smallest unit of the currency (satoshis for BTC, cents for fiat). Never use floats.
> Every state-changing request takes a client-supplied `reference` and must be treated as idempotent on retry.
> Quotes expire. Re-quote rather than reusing a stale quote id.

# Set up a gas station for your Enterprise wallets

> Create and fund a gas station on Tron, turn on auto-refill from a treasury wallet, send a sponsored USDT transfer, and alert on low balance.

By the end of this guide, transfers out of your Tron wallets can be sponsored: a wallet that holds only USDT can send it, and the TRX for the fee comes from a gas station that keeps itself funded.

## 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`.

[Create wallet](https://www.bitnob.dev/api-reference/platform/wallets/create-wallet.md) and the [quickstart](https://www.bitnob.dev/docs/platform/quickstart.md) cover creating wallets. A sandbox key works on Tron's Nile testnet.

**1. Create the gas station**

[Create gas station](https://www.bitnob.dev/api-reference/platform/gasstations/create-gas-station.md) needs a `name`, a `chain`, and a `threshold`. Turn on auto-refill at the same time, so the station tops itself up from the treasury wallet.

```bash theme={null}
curl https://api.platform.bitnob.com/v1/gasstations \
  -H "X-API-Key: $PLATFORM_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: gas-station-tron-1" \
  -d '{
    "name": "Tron gas station",
    "chain": "tron",
    "threshold": "200",
    "auto_refill_enabled": true,
    "refill_amount": "1000",
    "refill_from_wallet_id": "'"$TREASURY_WALLET_ID"'"
  }'
```

```json theme={null}
{
  "object": "gas_station",
  "id": "9b2e7a1c-3d4f-4a8b-9c0d-1e2f3a4b5c6d",
  "name": "Tron gas station",
  "chain": "tron",
  "network": "nile",
  "asset": "TRX",
  "asset_decimals": 6,
  "address": "TBXSw8fM4jpQkGc6zZjsVABFpVN7UvXPdV",
  "balance": "0",
  "threshold": "200",
  "threshold_raw": "200000000",
  "auto_refill_enabled": true,
  "refill_amount": "1000",
  "refill_amount_raw": "1000000000",
  "refill_from_wallet_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
  "health_status": "low",
  "status": "active"
}
```

Save the `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](https://www.bitnob.dev/api-reference/platform/gasstations/refill-gas-station.md), from the treasury wallet.

```bash theme={null}
curl https://api.platform.bitnob.com/v1/gasstations/$GAS_STATION_ID/refill \
  -H "X-API-Key: $PLATFORM_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: gas-station-tron-1-refill-1" \
  -d '{
    "source_wallet_id": "'"$TREASURY_WALLET_ID"'",
    "amount": "1000"
  }'
```

The response is the funding transaction. Once it completes, [Get gas station](https://www.bitnob.dev/api-reference/platform/gasstations/get-gas-station.md) shows `health_status` as `healthy`.

**3. Estimate a sponsored transfer**

[Estimate transaction fee](https://www.bitnob.dev/api-reference/platform/transactions/estimate-transaction-fee.md) with `sponsor: true` shows what the gas station will pay.

```bash theme={null}
curl https://api.platform.bitnob.com/v1/transactions/estimate-fee \
  -H "X-API-Key: $PLATFORM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "wallet_id": "'"$WALLET_ID"'",
    "to_address": "TD5gsCwxykWsLN9aPrq2TAfNjByuZKYp4E",
    "asset": "USDT_TRX",
    "amount": "25",
    "sponsor": true
  }'
```

**4. Send it**

Send the same body to [Create transaction](https://www.bitnob.dev/api-reference/platform/transactions/create-transaction.md), with an `Idempotency-Key`.

```bash theme={null}
curl https://api.platform.bitnob.com/v1/transactions \
  -H "X-API-Key: $PLATFORM_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: withdrawal-0001" \
  -d '{
    "wallet_id": "'"$WALLET_ID"'",
    "to_address": "TD5gsCwxykWsLN9aPrq2TAfNjByuZKYp4E",
    "asset": "USDT_TRX",
    "amount": "25",
    "sponsor": true
  }'
```

The transaction passes through `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](https://www.bitnob.dev/docs/platform/policies/handle-held-and-rejected-transactions.md).

**5. Alert before it runs dry**

Subscribe to the gas station events with [Create webhook](https://www.bitnob.dev/api-reference/platform/webhooks/create-webhook.md):

* `gas_station.low_balance` and `gas_station.critical_balance`: page whoever funds the treasury wallet.
* `gas_station.auto_refilled`: log it, and watch how often it fires.

Auto-refill keeps the station topped up only while the treasury wallet has TRX. Alert on the treasury wallet's balance too.

## 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.

Review both after the first week, using the fees on your sponsored transactions and the number of `auto_refilled` events.

## Change the configuration

[Update gas station](https://www.bitnob.dev/api-reference/platform/gasstations/update-gas-station.md) changes `name`, `threshold`, `refill_amount`, and `auto_refill_enabled`. Fields you leave out stay unchanged.

```bash theme={null}
curl -X PATCH https://api.platform.bitnob.com/v1/gasstations/$GAS_STATION_ID \
  -H "X-API-Key: $PLATFORM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "threshold": "500", "refill_amount": "2500" }'
```

## One per chain

Create a gas station for each chain you send sponsored transfers on. [List gas stations](https://www.bitnob.dev/api-reference/platform/gasstations/list-gas-stations.md) with `chain=tron` shows the stations you have on a chain. The [exchange integration guide](https://www.bitnob.dev/docs/platform/exchange-integration-guide.md#step-4-set-up-gas-stations) shows a multi-chain setup.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.