---
title: "Terminate a line, POST /ext/line/{uuid}/terminate"
description: "Delete a line permanently. Irreversible. Use disable for a temporary hold."
---

# Terminate a line, POST /ext/line/{uuid}/terminate

> [!NOTE]
> If you are starting a new integration instead of migrating, prefer the [native v1 API](/docs/?page=xai-ref-lines-delete) with the [official SDKs](/docs/?page=panel-api-sdks). The OneStream dialect exists to let existing OneStream code point at Xtream AI with only a base URL change.

Delete a line. This is the OneStream name for the operation that the native API calls `delete`. The row is removed from the users table. Credits already spent on the line are not refunded (a delete is a decision by the operator, not a rollback). After termination the line's UUID no longer resolves and any subsequent call against it returns `422 line_id not found or invalid`.

> [!WARNING]
> Termination is irreversible. If your intent is a temporary hold, use [POST /ext/line/{uuid}/disable](/docs/?page=os-ref-line-disable) and re-enable later. There is no undelete.

## Endpoint

`POST https://<your-panel-domain>/panel-api/onestream/ext/line/{uuid}/terminate`

## Authentication

`X-Api-Key`. `X-Auth-User` and `Authorization: Bearer` also accepted. See [Authentication](/docs/?page=panel-api-authentication).

## Required scope

`lines:write`.

## Idempotency

Optional but recommended. A retried `rid` returns the cached response instead of executing a second delete attempt. This matters even for delete: the second attempt would return `422 line_id not found or invalid` since the row is gone, and a naive retry loop would treat that as a real error.

## Path parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| `uuid` | string | The opaque line UUID. |

## Request body

Optional. If sent, only `rid` is meaningful.

| Field | Type | Required | Default | Description |
| ----- | ---- | -------- | ------- | ----------- |
| `rid` | string | no | | Idempotency key. |

```json
{
  "rid": "terminate-user-42-2026-08"
}
```

## Response

`200 OK` with the opaque `line_id` that was just deleted. This lets the caller confirm which UUID was terminated when several terminations are in flight.

```json
{
  "line_id": "b32c1a04-11ea-4c67-8fd1-0001000000f1"
}
```

## Examples

### cURL

```bash
curl -X POST "https://<your-panel-domain>/panel-api/onestream/ext/line/b32c1a04-11ea-4c67-8fd1-0001000000f1/terminate" \
  -H "X-Api-Key: <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{"rid": "terminate-user-42-2026-08"}'
```

### PHP raw

```php
$uuid = 'b32c1a04-11ea-4c67-8fd1-0001000000f1';
$ch = curl_init("https://<your-panel-domain>/panel-api/onestream/ext/line/{$uuid}/terminate");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => [
        'X-Api-Key: <your-api-key>',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS     => json_encode([
        'rid' => 'terminate-user-42-2026-08',
    ]),
]);
$body   = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
```

### Python raw

```python
import requests

uuid_ = "b32c1a04-11ea-4c67-8fd1-0001000000f1"
r = requests.post(
    f"https://<your-panel-domain>/panel-api/onestream/ext/line/{uuid_}/terminate",
    headers={"X-Api-Key": "<your-api-key>"},
    json={"rid": "terminate-user-42-2026-08"},
    timeout=30,
)
r.raise_for_status()
print(r.json())
```

## Errors

| HTTP | Error slug (or message) | When it happens | How to fix |
| ---- | ----------------------- | --------------- | ---------- |
| 401 | `Invalid API key` | Token is unknown, expired, disabled, or deleted. | Check the token or issue a new one. |
| 403 | `insufficient_scope` | Token lacks `lines:write`. | Issue a key with the scope. |
| 409 | `Transaction already processed` | Same `rid` was reused with a different body. | Use a fresh `rid`, or replay with the exact original body. |
| 422 | `line_id not found or invalid` | The UUID in the URL is malformed, was not issued by this panel, belongs to a different panel, or points to a line that was already terminated. Uniform on purpose. | Confirm the line still exists via `/ext/line/find` before retrying. |
| 429 | `Rate limit exceeded` | The key hit its per-minute cap. | Back off and retry after `Retry-After` seconds. |
| 501 | `not_implemented` | A `GET` request was sent to this URL. | Only `POST` is accepted. This blocks browser prefetch and misbehaving retry loops from destroying lines by walking URLs. |

## See also

- [Disable a line, POST /ext/line/{uuid}/disable](/docs/?page=os-ref-line-disable)
- [Create a line, POST /ext/line/create](/docs/?page=os-ref-lines-create)
- [OneStream compatibility overview](/docs/?page=panel-api-onestream-compatibility)
- [Native delete endpoint](/docs/?page=xai-ref-lines-delete)
