> 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/api-reference.md).

# API Reference

The CST+ public API lets you manage channels, lines, and settings programmatically — from your own scripts, dashboards, or integrations.

***

### Base URL

```
http://YOUR_SERVER_IP:8080/api
```

All endpoints are on port `8080` (the stream edge), not the admin panel port. If you have a domain and SSL configured, use `https://` instead.

***

### Authentication

All API requests require a Bearer token in the `Authorization` header.

```bash
curl -H "Authorization: Bearer YOUR_API_KEY" \
  http://YOUR_SERVER_IP:8080/api/channels
```

To create an API key, go to **Settings > API Keys** in the panel and click **New key**. Choose a name and the scopes you need.

{% hint style="danger" %}
Treat API keys like passwords. Do not commit them to version control or expose them in client-side code. If a key is compromised, delete it immediately from Settings > API Keys and create a new one.
{% endhint %}

***

### Scopes

Each API key has one or more scopes that control what it can do.

| Scope            | What it allows                               |
| ---------------- | -------------------------------------------- |
| `channels:read`  | List and get channels                        |
| `channels:write` | Create, update, render, start, stop channels |
| `lines:read`     | List and get lines                           |
| `lines:write`    | Create, update, delete lines                 |
| `analytics:read` | Read analytics and ad metrics                |
| `eas:trigger`    | Trigger and cancel EAS                       |
| `system:read`    | Read system stats                            |

***

### Errors

All errors return a JSON body with an `error` field.

| Status | Code                | Meaning                                                          |
| ------ | ------------------- | ---------------------------------------------------------------- |
| `400`  | `validation_failed` | Request body is missing required fields or has invalid values    |
| `401`  | `unauthorized`      | API key is missing, invalid, or does not have the required scope |
| `403`  | `license_required`  | License is expired or invalid                                    |
| `404`  | `not_found`         | The requested resource does not exist                            |
| `429`  | `rate_limited`      | Too many requests                                                |
| `500`  | `internal_error`    | Something went wrong on the server                               |

Example error response:

```json
{
  "error": "not_found",
  "message": "Channel 'sport-2' does not exist"
}
```

***


---

# 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/api-reference.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.
