> For the complete documentation index, see [llms.txt](https://docs.cstplus.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cstplus.org/api-reference/general/lines.md).

# Lines

## List all lines

<mark style="color:blue;">`GET`</mark> `http://YOUR_SERVER:8080/api/lines`

Returns all viewer access lines with their credentials and settings.

#### Headers

| Name                                            | Type   | Description                                   |
| ----------------------------------------------- | ------ | --------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer YOUR\_API\_KEY (requires `lines:read`) |

{% tabs %}
{% tab title="200: OK " %}

```json
[
  {
    "id": "line_xyz789",
    "name": "John Smith",
    "username": "john",
    "password": "s3cr3t",
    "maxConnections": 2,
    "allChannels": true,
    "channels": [],
    "blockedCountries": [],
    "enabled": true,
    "expiresAt": null,
    "contactEmail": "john@example.com",
    "urls": {
      "m3u": "http://YOUR_SERVER:8080/get.php?username=john&password=s3cr3t&type=m3u_plus",
      "xmltv": "http://YOUR_SERVER:8080/xmltv.php?username=john&password=s3cr3t"
    }
  }
]
```

{% endtab %}
{% endtabs %}

***

### Get line

## Get a single line

<mark style="color:blue;">`GET`</mark> `http://YOUR_SERVER:8080/api/lines/{id}`

Returns a single line by ID.

#### Path Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | string | Line ID     |

#### Headers

| Name                                            | Type   | Description                                   |
| ----------------------------------------------- | ------ | --------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer YOUR\_API\_KEY (requires `lines:read`) |

{% tabs %}
{% tab title="200: OK Line object" %}

```json
{
  "id": "line_xyz789",
  "name": "John Smith",
  "username": "john",
  "enabled": true,
  "expiresAt": "2026-12-31T23:59:59Z"
}
```

{% endtab %}

{% tab title="404: Not Found " %}

```json
{ "error": "not_found" }
```

{% endtab %}
{% endtabs %}

***

### Create line

## Create a line

<mark style="color:green;">`POST`</mark> `http://YOUR_SERVER:8080/api/lines`

Creates a new viewer access line. Username must be unique across all lines.

#### Headers

| Name                                            | Type   | Description                                    |
| ----------------------------------------------- | ------ | ---------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer YOUR\_API\_KEY (requires `lines:write`) |

#### Request Body

| Name                                       | Type    | Description                                                                           |
| ------------------------------------------ | ------- | ------------------------------------------------------------------------------------- |
| name<mark style="color:red;">\*</mark>     | string  | Internal display name                                                                 |
| username<mark style="color:red;">\*</mark> | string  | Viewer username (unique, URL-safe)                                                    |
| password<mark style="color:red;">\*</mark> | string  | Viewer password                                                                       |
| maxConnections                             | integer | Max simultaneous streams. Defaults to the server-wide default set in Settings.        |
| allChannels                                | boolean | Whether this line has access to all channels. Default: `true`.                        |
| channels                                   | array   | Array of channel slugs this line can access. Only used when `allChannels` is `false`. |
| expiresAt                                  | string  | ISO 8601 expiry timestamp. Omit for no expiry.                                        |
| contactEmail                               | string  | Contact email for your records                                                        |

{% tabs %}
{% tab title="201: Created Line created" %}

```json
{
  "id": "line_new123",
  "name": "Jane Doe",
  "username": "jane",
  "password": "pass123",
  "maxConnections": 1,
  "enabled": true,
  "expiresAt": null
}
```

{% endtab %}

{% tab title="400: Bad Request Username already taken or invalid fields" %}

```json
{ "error": "validation_failed", "message": "Username 'jane' is already in use" }
```

{% endtab %}
{% endtabs %}

***

### Update line

## Update a line

<mark style="color:orange;">`PUT`</mark> `http://YOUR_SERVER:8080/api/lines/{id}`

Updates an existing line. Only the fields you include are changed.

#### Path Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | string | Line ID     |

#### Headers

| Name                                            | Type   | Description                                    |
| ----------------------------------------------- | ------ | ---------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer YOUR\_API\_KEY (requires `lines:write`) |

#### Request Body

| Name           | Type    | Description                                                               |
| -------------- | ------- | ------------------------------------------------------------------------- |
| enabled        | boolean | Set to `false` to immediately cut off all active connections on this line |
| maxConnections | integer | New connection limit                                                      |
| expiresAt      | string  | New expiry date, or `null` to remove expiry                               |

{% tabs %}
{% tab title="200: OK Updated line object" %}

```json
{
  "id": "line_xyz789",
  "enabled": false
}
```

{% endtab %}
{% endtabs %}

***

### Delete line

## Delete a line

<mark style="color:red;">`DELETE`</mark> `http://YOUR_SERVER:8080/api/lines/{id}`

Permanently deletes a line and immediately terminates all active connections on it.

#### Path Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | string | Line ID     |

#### Headers

| Name                                            | Type   | Description                                    |
| ----------------------------------------------- | ------ | ---------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer YOUR\_API\_KEY (requires `lines:write`) |

{% tabs %}
{% tab title="204: No Content Line deleted" %}

```
(empty body)
```

{% endtab %}

{% tab title="404: Not Found " %}

```json
{ "error": "not_found" }
```

{% endtab %}
{% endtabs %}

{% hint style="danger" %}
Deleting a line is permanent and cannot be undone. All active viewer sessions on the line are terminated immediately.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.cstplus.org/api-reference/general/lines.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
