---
title: "Enable a line"
description: "Flip a line's enabled flag to true. Reseller keys in users billing mode re-check slot capacity before the flip."
---

# Enable a line

Turn a line back on by setting its `enabled` flag to `true`. The endpoint returns the full line object with the new state.

For reseller keys in `users` billing mode with a non-trial line, this endpoint re-checks slot capacity before enabling. That closes the loophole where a reseller could disable an old line and enable a new one to sneak past the user cap.

The endpoint does not touch `admin_enabled`. If the admin has explicitly disabled the line via [update](/docs/?page=xai-ref-lines-update), calling enable does not lift that block. Use [update](/docs/?page=xai-ref-lines-update) with `admin_enabled: true` for that.

## Endpoint

`POST https://<your-panel-domain>/panel-api/v1/lines/{id}/enable`

## Authentication

Bearer token in the `Authorization` header. See [Panel API authentication](/docs/?page=panel-api-authentication).

## Required scope

`lines:write`.

## Idempotency

Required. Send an `Idempotency-Key` header on every call. Retrying the same key returns the cached response; a missing header returns `400 missing_idempotency_key`.

## Path parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| `id` | int | The line id to enable. |

## Request body

Empty. Send an empty JSON body `{}` (or no body at all, since the endpoint accepts both).

## Response

`200 OK` with the full line object. `enabled` will be `true`.

```json
{
  "id": 172504293,
  "username": "u_a1b2c3d4",
  "password": "53fa969a",
  "member_id": 100,
  "exp_date": 1788885053,
  "max_connections": 1,
  "is_trial": false,
  "is_restreamer": false,
  "enabled": true,
  "admin_enabled": true,
  "bouquets": [],
  "created_at": 1786206653
}
```

## Examples

### cURL

```bash
curl -X POST https://<your-panel-domain>/panel-api/v1/lines/172504293/enable \
  -H "Authorization: Bearer <your-api-key>" \
  -H "Idempotency-Key: line-172504293-enable-2026-08-08"
```

### PHP SDK

```php
require __DIR__ . '/api-panel-php-sdk-1.0.0/autoload.php';
use XtreamAI\PanelApi\PanelApiClient;

$client = new PanelApiClient(baseUrl: 'https://<your-panel-domain>', token: '<your-api-key>');
$line = $client->lines->enable(172504293, idempotencyKey: 'line-172504293-enable-2026-08-08');
echo $line->enabled ? 'enabled' : 'still disabled', PHP_EOL;
```

### Python SDK

```python
from xtream_ai_panel_api import PanelApiClient

client = PanelApiClient(base_url="https://<your-panel-domain>", token="<your-api-key>")
line = client.lines.enable(172504293, idempotency_key="line-172504293-enable-2026-08-08")
print(line.enabled)
```

## Errors

| HTTP | Error slug | When it happens | How to fix |
| ---- | ---------- | --------------- | ---------- |
| 400 | `missing_idempotency_key` | The `Idempotency-Key` header was not sent. | Send a per-intent key on every write. |
| 401 | `invalid_key` | Token is unknown, expired, disabled, or deleted. | Check the token or issue a new one. |
| 402 | `slot_limit_exceeded` | Reseller (users mode, non-trial line) would exceed its own user cap. | Delete or disable another line first. |
| 402 | `ancestor_cap_reached` | A parent reseller's cap would be exceeded. | Raise the parent cap. |
| 403 | `insufficient_scope` | Token lacks `lines:write`. | Issue a key with the scope. |
| 404 | `not_found` | The line id does not exist, or a reseller key targeted a line it does not own. | Verify the id and ownership. |
| 409 | `idempotency_conflict` | Same key was reused with a different body. | Use a fresh key. |
| 409 | `idempotency_in_flight` | Same key is still processing. | Retry after a moment. |
| 429 | `rate_limited` | The key hit its per-minute cap. | Back off and retry after `Retry-After` seconds. |

## See also

- [Disable a line](/docs/?page=xai-ref-lines-disable)
- [Update a line](/docs/?page=xai-ref-lines-update) (to move `admin_enabled`)
- [Panel API lines overview](/docs/?page=xai-ref-lines-list)
