Reset a line password
Rotate a line's password. Send an explicit password in the body, or omit it and the API generates a random 8-hex-character password on your behalf.
The response is a compact shape, not the full line object: just {id, password}. If you need the full line back afterwards, call GET /lines/{id}.
Reseller keys whose member group has allow_change_pass=0 cannot use this endpoint. They receive 403 password_change_not_allowed.
Endpoint
POST https://<your-panel-domain>/panel-api/v1/lines/{id}/reset-password
Authentication
Bearer token in the Authorization header. See 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 (the same password the first call produced); a missing header returns 400 missing_idempotency_key.
Path parameters
| Name | Type | Description |
|---|---|---|
id |
int | The line id whose password to rotate. |
Request body
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
password |
string | no | random 8-hex-char string | Explicit new password. If omitted, one is generated for you. |
{
"password": "brandNewPass99"
}
Response
200 OK with the compact shape:
{
"id": 172504296,
"password": "dd6771eb"
}
Examples
cURL
Generate a random password:
curl -X POST https://<your-panel-domain>/panel-api/v1/lines/172504296/reset-password \
-H "Authorization: Bearer <your-api-key>" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: line-172504296-rotate-2026-08-08" \
-d '{}'
Set an explicit password:
curl -X POST https://<your-panel-domain>/panel-api/v1/lines/172504296/reset-password \
-H "Authorization: Bearer <your-api-key>" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: line-172504296-explicit-2026-08-08" \
-d '{"password": "brandNewPass99"}'
PHP SDK
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>');
// resetPassword returns the new password as a string, not a Line.
$newPassword = $client->lines->resetPassword(
id: 172504296,
idempotencyKey: 'line-172504296-rotate-2026-08-08',
);
echo $newPassword, PHP_EOL;
// Or pick your own:
$explicit = $client->lines->resetPassword(
id: 172504296,
password: 'brandNewPass99',
idempotencyKey: 'line-172504296-explicit-2026-08-08',
);
echo $explicit, PHP_EOL;
Python SDK
from xtream_ai_panel_api import PanelApiClient
client = PanelApiClient(base_url="https://<your-panel-domain>", token="<your-api-key>")
# reset_password returns the new password as a str, not a Line.
new_password = client.lines.reset_password(
id=172504296,
idempotency_key="line-172504296-rotate-2026-08-08",
)
print(new_password)
# Or pick your own:
explicit = client.lines.reset_password(
id=172504296,
password="brandNewPass99",
idempotency_key="line-172504296-explicit-2026-08-08",
)
print(explicit)
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. |
| 403 | password_change_not_allowed |
Reseller group has allow_change_pass=0. |
Change the setting on the member group, or call from an admin key. |
| 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
- Update a line (to set a password without generating one)
- Panel API lines overview