> For the complete documentation index, see [llms.txt](https://relationlabs.gitbook.io/relation-one-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://relationlabs.gitbook.io/relation-one-api/api-zh/api/chats/list.md).

# 列表

## <mark style="color:blue;">GET</mark> api/v1/userChannels/list

* 说明：查看群组列表。
* Header

| Field         | Type   | Remarks                                                            |
| ------------- | ------ | ------------------------------------------------------------------ |
| ApiKey        | String | 从管理员获取的[ApiKey](/relation-one-api/api-zh/guide/glossary.md#apikey) |
| Authorization | String | Bearer ${unifiedAuthToken} ,其中unifiedAuthToken来自/api/v1/auth接口的返回  |

* Request Parameters

| Field   | Type   | Remarks                         |
| ------- | ------ | ------------------------------- |
| keyword | String | 群组名称,支持模糊查询                     |
| limit   | int    | 每页返回数量                          |
| cursor  | String | 上一页返回的 cursor数据，cursor为空表示查询第一页 |

* Request Example

```shell
curl POST 'https://api.relationlabs.ai/api/v1/userChannels/list?keyword=test&limit=10&cursor=110f37661b2c4fcc9a5186954b3b3da6' \
--header 'ApiKey: <ApiKey>' \
--header 'Authorization: bearer ey1JhbGciOiJFUzI1NiJ9.eyJqdGkiOiI0MzdiN2EzZDEwMGY0ODVkOWVhMW1UzZmZlOWE1NmEyZSIsImlzcyI6InJlbGF0aW9ubGFicy5haSIsImlhdCI6MTY2NTIxNTUzNSwic3ViIjoiZGhreXEtc3FhYWEtYWFhYWotc2d6M3EtY2FpIiwiZXhwIjoxNjY1ODIwMzM1fQ.rj7KKuIcgmvaIwZ63YHnXQ4jvvI-eR2Wo7k3YEyz1Muxo8j5ezCowKDpcW0u9zIuHPFqwD0-1XPWdPLR1d1HLFw'
```

* Response Parameters

| Field | Type                | Remarks |
| ----- | ------------------- | ------- |
| code  | String              | 返回码     |
| desc  | String              | 返回信息    |
| data  | UserChannelResponse | 数据      |

The UserChannelResponse field consists of the following subfields:

| Field  | Type                | Remarks    |
| ------ | ------------------- | ---------- |
| cursor | String              | 用于查询下一页的数据 |
| list   | Array\[ChannelInfo] | 群组的列表      |

The ChannelInfo field consists of the following subfields:

| Field              | Type    | Remarks                            |
| ------------------ | ------- | ---------------------------------- |
| status             | String  | 群组状态，0-正常状态；1-已离开；2-被管理员移除；3-群组已解散 |
| channelUuid        | String  | 群组uuid                             |
| displayName        | String  | 群组名称                               |
| channelIcon        | String  | 群组的icon                            |
| channelType        | String  | 群组类型                               |
| unreadMessageCount | String  | 未读消息数                              |
| mentionsCount      | String  | 被艾特的次数                             |
| lastMessageType    | String  | 最后一条消息的类型： TEXT\SYS\CARD           |
| lastMessageContent | String  | 最后一条消息的内容                          |
| lastPostAt         | long    | 最后一条消息的时间戳                         |
| mute               | boolean | 是否开启免打扰，true-开启；false-未开启          |
| pin                | boolean | 是否置顶，true-置顶；false-未置顶             |

* Response Body

```json
{
  "code": "0",
  "desc": "success",
  "data": {
    "cursor": "bbaac023563e4c399228eb6763034965",
    "list": [
      {
        "status": 0,
        "channelUuid": "e54d938caa09498fa1a09f7cfe4e21f4",
        "displayName": "test-group",
        "channelIcon": "",
        "channelType": "G",
        "unreadMessageCount": 0,
        "mentionsCount": 0,
        "lastMessageType": "SYS",
        "lastMessageContent": "0x1e56 created Group test-group",
        "lastPostAt": "1665219499000",
        "mute": true,
        "pin": true
      },
      ...
    ]
  }
}
```

* Return Code

| code  | desc             | Remarks  |
| ----- | ---------------- | -------- |
| 0     | success          | 接口调用成功   |
| 13101 | group type error | 群组类型无法识别 |
