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

# Comprar energia

> Comprar energia para una direccion TRON

## Comprar energia

Delega energia a la direccion TRON especificada. El costo se deduce del saldo de tu cuenta.

### Cuerpo de la solicitud

<ParamField body="target_address" type="string" required>
  Direccion TRON de destino (formato T..., 34 caracteres)
</ParamField>

<ParamField body="volume" type="number" required>
  Cantidad de energia a delegar (min 32,000, max 5,000,000)
</ParamField>

<ParamField body="duration" type="string" required>
  Duración del alquiler: `"1h"` (solo 1 hora)
</ParamField>

### Respuesta

<ResponseField name="id" type="number">
  Unique order identifier
</ResponseField>

<ResponseField name="status" type="string">
  Order status: `pending`, `filled`, `failed`
</ResponseField>

<ResponseField name="txid" type="string | null">
  On-chain transaction id once the delegation is broadcast (null while `pending`)
</ResponseField>

<ResponseField name="price_trx" type="string">
  Total cost charged from your balance, in TRX
</ResponseField>

<ResponseField name="reclaim_at" type="string | null">
  ISO 8601 timestamp when the bandwidth rental is reclaimed (energy is reclaimed automatically by the provider)
</ResponseField>

<ResponseField name="activation_cost_trx" type="string">
  Address activation cost in TRX (`"0"` if the recipient is already activated)
</ResponseField>

### Ejemplo

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.tronrental.com/v1/energy/buy \
    -H "X-API-Key: your_api_key" \
    -H "Content-Type: application/json" \
    -d '{
      "target_address": "TYourRecipientAddress1234567890abc",
      "volume": 65000,
      "duration": "1h"
    }'
  ```

  ```python Python theme={null}
  import requests

  resp = requests.post(
      "https://api.tronrental.com/v1/energy/buy",
      headers={"X-API-Key": "your_api_key"},
      json={
          "target_address": "TYourRecipientAddress1234567890abc",
          "volume": 65000,
          "duration": "1h",
      },
  )
  print(resp.json())
  ```

  ```javascript JavaScript theme={null}
  const resp = await fetch("https://api.tronrental.com/v1/energy/buy", {
    method: "POST",
    headers: {
      "X-API-Key": "your_api_key",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      target_address: "TYourRecipientAddress1234567890abc",
      volume: 65000,
      duration: "1h",
    }),
  });
  console.log(await resp.json());
  ```
</CodeGroup>

```json Response theme={null}
{
  "id": 12345,
  "price_trx": "2.75",
  "status": "pending"
}
```

<Tip>
  **65,000 de energia** cubre una transferencia USDT a una direccion que ya posee USDT.
  Usa **131,000** para destinatarios que reciben USDT por primera vez (creacion de nuevo slot de almacenamiento).
</Tip>
