# Get active channels

The API endpoint `/message/channels` will return all current active channels.

A channel is considered active if there is at least one client connected to it.

## API: Return active channels

<mark style="color:green;">`POST`</mark> `https://portal.yourdomain.com/message/channels`

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| content-type | string | application/json |
| accept       | string | application/json |

#### Request Body

| Name   | Type   | Description                   |
| ------ | ------ | ----------------------------- |
| apiKey | string | the API key for your Klai app |

{% tabs %}
{% tab title="201 Returns an object with two keys authenticated and anonymous. Each will have an array of current active channels." %}

```
{
    "authenticated": [
        "channelOne",
        "channelTwo"
    ],
    "anonymous": [
        "testRoom1",
        "testRoom2"
    ]
}
```

{% endtab %}
{% endtabs %}

## Notes

* Results are scoped to the current domain host.
* The response groups active channel names under `authenticated` and `anonymous`.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.klai.studio/reference/apis-and-services/messaging/get-active-channels.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
