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

# Activate an address

POST /v1/accounts/activate: put a new address on chain so it can receive energy.

An address that has only received USDT is not yet on chain and cannot send transfers until it is activated. The address is screened against sanctions lists before activation.

## At a glance

| Item            | Detail                                                                                                                                                                                                                                  |
| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method and path | `POST /v1/accounts/activate`                                                                                                                                                                                                            |
| Authentication  | Signed request. See [Authentication and signing](https://docs.luganodes.com/tron-energy/energy-rental-api/making-requests.md)                                                                                                           |
| Retry-safe      | Yes. See [Retry behaviour](#retry-behaviour)                                                                                                                                                                                            |
| Cost on TRON    | About 1.1 TRX: the 1 TRX account creation fee, plus 0.1 TRX when the sender's staked bandwidth does not cover the activation. See [How TRON fees work](https://docs.luganodes.com/tron-energy/how-tron-fees-work.md#address-activation) |
| Rate limit      | Per API key. See [Conventions and limits](https://docs.luganodes.com/tron-energy/energy-rental-api/conventions-and-limits.md#rate-limits)                                                                                               |

## Request body

| Name      | Type   | Required | Default | Description         |
| --------- | ------ | -------- | ------- | ------------------- |
| `address` | string | Yes      | None    | Address to activate |

## Sample request

Sample IDs, addresses and hashes are illustrative.

{% tabs %}
{% tab title="cURL" %}
{% code title="activate-an-address.sh" %}

```bash
TIMESTAMP=$(date +%s)
REQUEST_PATH="/v1/accounts/activate"
BODY='{
  "address": "TU5DL2WJDCECWdZHQVkYQ7j85mxuuzfQKJ"
}'
SIGNATURE=$(printf '%s\n%s\n%s\n%s' "POST" "$REQUEST_PATH" "$TIMESTAMP" "$BODY" | openssl dgst -sha256 -hmac "$API_SECRET" | sed 's/^.* //')
curl -X POST "$BASE_URL$REQUEST_PATH" \
  -H "X-API-Key: $API_KEY" \
  -H "X-Timestamp: $TIMESTAMP" \
  -H "X-Signature: $SIGNATURE" \
  -H "Content-Type: application/json" \
  -d "$BODY"
```

{% endcode %}

The request is signed inline. It needs `BASE_URL`, `API_KEY` and `API_SECRET` in your environment.
{% endtab %}

{% tab title="Node.js" %}
{% code title="activate-an-address.mjs" %}

```javascript
import { signedRequest } from "./tron_energy.mjs";

const { status, data } = await signedRequest("POST", "/v1/accounts/activate", {
  address: "TU5DL2WJDCECWdZHQVkYQ7j85mxuuzfQKJ",
});
console.log(status, data);
```

{% endcode %}

`signedRequest` is the helper from [Authentication and signing](https://docs.luganodes.com/tron-energy/energy-rental-api/making-requests.md), saved as `tron_energy.mjs`.
{% endtab %}

{% tab title="Python" %}
{% code title="activate\_an\_address.py" %}

```python
from tron_energy import signed_request

status, data = signed_request("POST", "/v1/accounts/activate", {
    "address": "TU5DL2WJDCECWdZHQVkYQ7j85mxuuzfQKJ",
})
print(status, data)
```

{% endcode %}

`signed_request` is the helper from [Authentication and signing](https://docs.luganodes.com/tron-energy/energy-rental-api/making-requests.md), saved as `tron_energy.py`.
{% endtab %}
{% endtabs %}

## Responses

{% tabs %}
{% tab title="200 OK" %}
The address is activated and the activation transaction is in a block.

```json
{
  "activation_id": "act_01J9Y2...",
  "address": "TU5DL2WJDCECWdZHQVkYQ7j85mxuuzfQKJ",
  "activated": true,
  "already_active": false,
  "activation_tx": "c47e..."
}
```

{% endtab %}

{% tab title="200 OK (already active)" %}
The address already exists on chain, so no activation takes place.

```json
{
  "activation_id": null,
  "address": "TU5DL2WJDCECWdZHQVkYQ7j85mxuuzfQKJ",
  "activated": true,
  "already_active": true,
  "activation_tx": null
}
```

{% endtab %}

{% tab title="202 Accepted" %}
The activation is sent and awaiting confirmation. Poll `GET /v1/accounts/{address}` until `activated` is `true`.

```json
{
  "activation_id": "act_01J9Y2...",
  "address": "TU5DL2WJDCECWdZHQVkYQ7j85mxuuzfQKJ",
  "activated": false,
  "status": "pending"
}
```

{% endtab %}
{% endtabs %}

## Response fields

| Field            | Type           | Description                                                     |
| ---------------- | -------------- | --------------------------------------------------------------- |
| `activation_id`  | string or null | Activation ID. `null` when the address was already active       |
| `address`        | string         | Address                                                         |
| `activated`      | boolean        | Whether the address is activated on chain                       |
| `already_active` | boolean        | `true` when the address existed before this request             |
| `activation_tx`  | string or null | Hash of the activation transaction. `null` when none was needed |
| `status`         | string         | `pending` on a `202` response                                   |

## Retry behaviour

| Situation                                        | What the API does                                                                  | What to do                                                    |
| ------------------------------------------------ | ---------------------------------------------------------------------------------- | ------------------------------------------------------------- |
| The address is already active                    | Returns `200` with `already_active: true`. No activation takes place               | Nothing. The address is ready                                 |
| The activation is sent and awaiting confirmation | Returns `202` with `status: "pending"`                                             | Poll `GET /v1/accounts/{address}` until `activated` is `true` |
| The activation fails on chain                    | Returns `502 CHAIN_ERROR` with `details.activation_id` and `details.chain_message` | Read `details.chain_message`, then call again                 |
| Too many requests, or maintenance                | Returns `429 RATE_LIMITED` or `503 SERVICE_UNAVAILABLE` with `Retry-After`         | Wait for `Retry-After`, then call again                       |

## Activating as part of a rental

Set `activate_if_needed: true` on [`POST /v1/rentals`](https://docs.luganodes.com/tron-energy/energy-rental-api/create-a-rental.md) to activate a new receiver in the same call. The receiver is the address that sends the transaction and receives the energy. We activate it first, then delegate the energy. Without it, a rental for a new address returns `422 RECEIVER_NOT_ACTIVATED`.

## Errors

The full list is in [Errors](https://docs.luganodes.com/tron-energy/energy-rental-api/errors.md).

| HTTP | Code                  | When                                                                                            | Action                                             | Retry?                   |
| ---- | --------------------- | ----------------------------------------------------------------------------------------------- | -------------------------------------------------- | ------------------------ |
| 400  | `INVALID_REQUEST`     | Malformed JSON, missing field or wrong type                                                     | Fix the request                                    | No                       |
| 400  | `INVALID_ADDRESS`     | `address` has an invalid format or checksum                                                     | Fix the address                                    | No                       |
| 401  | `UNAUTHORIZED`        | Invalid API key, signature or timestamp                                                         | Check your credentials and server clock            | After a fix              |
| 403  | `ADDRESS_BLOCKED`     | The address matched a sanctions list                                                            | Stop. Contact us if you believe the match is wrong | No                       |
| 429  | `RATE_LIMITED`        | Too many requests                                                                               | Retry after `Retry-After`                          | Yes, after `Retry-After` |
| 502  | `CHAIN_ERROR`         | The activation failed on chain. `details.activation_id` and `details.chain_message` identify it | Read `details.chain_message`, then call again      | Yes, after checking      |
| 503  | `SERVICE_UNAVAILABLE` | Planned maintenance or an outage                                                                | Retry after `Retry-After`                          | Yes, after `Retry-After` |
