> 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/check-capacity.md).

# Check capacity

GET /v1/capacity: energy available now and the current wait.

Use this endpoint to see how `POST /v1/rentals` will respond before you create a rental.

## At a glance

| Item            | Detail                                                                                                                                    |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| Method and path | `GET /v1/capacity`                                                                                                                        |
| Authentication  | Signed request. See [Authentication and signing](https://docs.luganodes.com/tron-energy/energy-rental-api/making-requests.md)             |
| Retry-safe      | Yes. The request only reads data                                                                                                          |
| Rate limit      | Per API key. See [Conventions and limits](https://docs.luganodes.com/tron-energy/energy-rental-api/conventions-and-limits.md#rate-limits) |

This endpoint takes no path, query or body parameters.

## Sample request

Sample values are illustrative.

{% tabs %}
{% tab title="cURL" %}
{% code title="check-capacity.sh" %}

```bash
TIMESTAMP=$(date +%s)
REQUEST_PATH="/v1/capacity"
BODY=""
SIGNATURE=$(printf '%s\n%s\n%s\n%s' "GET" "$REQUEST_PATH" "$TIMESTAMP" "$BODY" | openssl dgst -sha256 -hmac "$API_SECRET" | sed 's/^.* //')
curl -X GET "$BASE_URL$REQUEST_PATH" \
  -H "X-API-Key: $API_KEY" \
  -H "X-Timestamp: $TIMESTAMP" \
  -H "X-Signature: $SIGNATURE"
```

{% 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="check-capacity.mjs" %}

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

const { status, data } = await signedRequest("GET", "/v1/capacity");
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="check\_capacity.py" %}

```python
from tron_energy import signed_request

status, data = signed_request("GET", "/v1/capacity")
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

{% code title="200 OK" %}

```json
{
  "status": "busy",
  "energy_available_now": 0,
  "max_single_rental": 140000,
  "daily_remaining": 41000000,
  "queue_length": 2,
  "estimated_wait_seconds": 31
}
```

{% endcode %}

## Response fields

| Field                    | Type    | Description                                                     |
| ------------------------ | ------- | --------------------------------------------------------------- |
| `status`                 | string  | Current capacity. See [Capacity statuses](#capacity-statuses)   |
| `energy_available_now`   | integer | Energy ready to delegate now                                    |
| `max_single_rental`      | integer | Largest energy amount for one rental                            |
| `daily_remaining`        | integer | Energy left for today                                           |
| `queue_length`           | integer | Rentals waiting in the queue                                    |
| `estimated_wait_seconds` | integer | Expected wait for a typical USDT transfer joining the queue now |

## Capacity statuses

| Status        | Meaning                                              | `POST /v1/rentals` returns                                               |
| ------------- | ---------------------------------------------------- | ------------------------------------------------------------------------ |
| `ok`          | Energy is available now                              | `201`                                                                    |
| `busy`        | All energy is in use and frees up in seconds         | `202` if the wait fits `max_wait_seconds`, else `503 CAPACITY_EXHAUSTED` |
| `daily_limit` | Today's energy is used up and recovers over 24 hours | `202` if the wait fits `max_wait_seconds`, else `503 CAPACITY_EXHAUSTED` |
| `no_capacity` | Energy is unavailable with none freeing up           | `503 CAPACITY_EXHAUSTED`                                                 |

## Errors

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

| HTTP | Code                  | When                                    | Action                                  | Retry?                   |
| ---- | --------------------- | --------------------------------------- | --------------------------------------- | ------------------------ |
| 401  | `UNAUTHORIZED`        | Invalid API key, signature or timestamp | Check your credentials and server clock | After a fix              |
| 429  | `RATE_LIMITED`        | Too many requests                       | Retry after `Retry-After`               | Yes, after `Retry-After` |
| 503  | `SERVICE_UNAVAILABLE` | Planned maintenance or an outage        | Retry after `Retry-After`               | Yes, after `Retry-After` |

## Related

* [Create a rental](https://docs.luganodes.com/tron-energy/energy-rental-api/create-a-rental.md): how `POST /v1/rentals` responds for each capacity status.
* [Rental lifecycle](https://docs.luganodes.com/tron-energy/energy-rental-api/rental-lifecycle.md): the 10-second window, queued requests and statuses.
