> For the complete documentation index, see [llms.txt](https://tron-energy-doc.crypto-chief.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tron-energy-doc.crypto-chief.com/api-reference/activate.md).

# Activate an Address

## Activate an Address

Energy cannot be delegated to a TRON account the chain has never seen. This sends the address the small amount of TRX that brings it into existence.

Use it when a rental is refused with `ADDRESS_NOT_ACTIVATED`.

#### **Activate an Address**

<mark style="color:green;">`POST`</mark> `https://energy.crypto-chief.com/v1/activate`

**Headers**

| Name            | Value                                                     |
| --------------- | --------------------------------------------------------- |
| Content-Type    | `application/json`                                        |
| Merchant        | Your project UUID                                         |
| Signature       | [Signed request body](/getting-started/authentication.md) |
| Idempotency-Key | **Required.** Your own id for this piece of work          |

**Body**

| Name              | Type   | Required | Description                                                  |
| ----------------- | ------ | -------- | ------------------------------------------------------------ |
| `address`         | string | true     | The account to activate.                                     |
| `idempotency_key` | string | false    | Alternative to the header. The header wins if both are sent. |

```json
{
  "address": "TDijWGe2r6pTxAufDYGcQyx591Wuyvq4xp"
}
```

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "address": "TDijWGe2r6pTxAufDYGcQyx591Wuyvq4xp",
  "status": "delivered",
  "tx_hash": "9c4f2a1e8b3d7c5069a1f4e2b8d6c3a570e9f1b4d8c2a6753e0f9b1d4c7a2e85",
  "price_sun": 1430000,
  "price_trx": "1.430000",
  "price_usd": "0.43",
  "credits": 4290000,
  "settled": true,
  "needs_attention": false
}
```

{% endtab %}

{% tab title="200 — already active" %}

```json
{
  "address": "TDijWGe2r6pTxAufDYGcQyx591Wuyvq4xp",
  "status": "already_active",
  "already_active": true,
  "settled": true
}
```

{% endtab %}

{% tab title="409" %}

```json
{
  "address": "TDijWGe2r6pTxAufDYGcQyx591Wuyvq4xp",
  "status": "unresolved",
  "settled": false,
  "needs_attention": true,
  "error": "executor: outcome unknown"
}
```

{% endtab %}

{% tab title="402" %}

```json
{
  "ok": false,
  "error": "INSUFFICIENT_CREDITS",
  "msg": "your credit balance will not cover this order; nothing was bought and nothing was charged"
}
```

{% endtab %}
{% endtabs %}

**Fields**

| Field                   | Description                                           |
| ----------------------- | ----------------------------------------------------- |
| `tx_hash`               | The transfer that did it. Look it up on TronScan.     |
| `already_active`        | The address needed nothing. **You were not charged.** |
| `credits` / `price_usd` | What was taken from your balance.                     |
| `needs_attention`       | We do not know the outcome. **Do not retry.**         |

### It checks first

An address that is already activated comes back as `already_active` with nothing sent and nothing charged. You can call this without checking yourself.

### What it costs

Activation burns **1 TRX** on chain in the normal case, and 1.1 TRX when the sending wallet has no bandwidth left. You pay that plus the same margin a rental carries; the exact figure is on the response.

### Retrying

Same rules as an [order](/api-reference/create-order.md). Send the same `Idempotency-Key` and you get the original back, charged once. A `needs_attention` result means the transfer may already be on chain — do not send it again. See [Idempotency and Retries](/getting-started/idempotency.md).

### Example

`sign()`, `canonical()`, `BASE`, `MERCHANT` and `API_KEY` are from [Authentication](/getting-started/authentication.md).

{% tabs %}
{% tab title="JavaScript" %}

```javascript
const body = { address: "TDijWGe2r6pTxAufDYGcQyx591Wuyvq4xp" };

const res = await fetch(BASE + "/v1/activate", {
  method: "POST",
  body: canonical(body),
  headers: {
    "Content-Type": "application/json",
    Merchant: MERCHANT,
    Signature: sign(body, API_KEY),
    "Idempotency-Key": "activate-8814",
  },
});

const out = await res.json();
if (out.needs_attention) throw new Error("Unresolved - do not retry");
console.log(out.already_active ? "Already active" : `Activated: ${out.tx_hash}`);
```

{% endtab %}

{% tab title="PHP" %}

```php
$body = ['address' => 'TDijWGe2r6pTxAufDYGcQyx591Wuyvq4xp'];

$ch = curl_init(BASE . '/v1/activate');
curl_setopt_array($ch, [
    CURLOPT_POST           => true,
    CURLOPT_POSTFIELDS     => canonical($body),
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => [
        'Content-Type: application/json',
        'Merchant: ' . MERCHANT,
        'Signature: ' . sign($body, API_KEY),
        'Idempotency-Key: activate-8814',
    ],
]);

$out = json_decode(curl_exec($ch), true);
if (!empty($out['needs_attention'])) throw new RuntimeException('Unresolved - do not retry');
echo empty($out['already_active']) ? "Activated: {$out['tx_hash']}\n" : "Already active\n";
```

{% endtab %}

{% tab title="GO" %}

```go
body := map[string]any{"address": "TDijWGe2r6pTxAufDYGcQyx591Wuyvq4xp"}
raw, _ := json.Marshal(body)

req, _ := http.NewRequest("POST", base+"/v1/activate", bytes.NewReader(raw))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Merchant", merchant)
req.Header.Set("Signature", sign(raw, apiKey))
req.Header.Set("Idempotency-Key", "activate-8814")

res, err := http.DefaultClient.Do(req)
```

{% endtab %}

{% tab title="Python" %}

```python
body = {"address": "TDijWGe2r6pTxAufDYGcQyx591Wuyvq4xp"}

res = requests.post(
    BASE + "/v1/activate",
    data=canonical(body),
    headers={
        "Content-Type": "application/json",
        "Merchant": MERCHANT,
        "Signature": sign(body, API_KEY),
        "Idempotency-Key": "activate-8814",
    },
).json()

if res.get("needs_attention"):
    raise RuntimeError("Unresolved - do not retry")
print("Already active" if res.get("already_active") else f"Activated: {res['tx_hash']}")
```

{% endtab %}

{% tab title="curl" %}

```bash
BODY='{"address":"TDijWGe2r6pTxAufDYGcQyx591Wuyvq4xp"}'

curl "$BASE/v1/activate" \
  -H "Content-Type: application/json" \
  -H "Merchant: $MERCHANT" \
  -H "Signature: $(sign "$BODY")" \
  -H "Idempotency-Key: activate-8814" \
  -d "$BODY"
```

{% endtab %}
{% endtabs %}
