Get Channel List

Get
/api/v1/channels.list

Lists all the channels on the workspace. Any of the following permissions are required:

  • view-c-room
  • view-joined-room

Changelog

Version Description
0.49.0 Count and offset query parameters supported.
0.48.0 Added
Header parameters
X-Auth-Token
stringRequired

The authToken of the authenticated user.

ExampleRScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f
X-User-Id
stringRequired

The userId of the authenticated user.

ExamplerbAXPnMktTFbNpwtJ
Query parameters
offset
integer

Number of items to "skip" in the query, i.e. requests return count items, skipping the first offset items. Refer to the official documentation to learn more.

Example50
count
integer

The number of items to return. Refer to the official documentation to learn more.

Example50
sort

List of fields to order by, and in which direction. This is a JSON object, with properties listed in desired order, with values of 1 for ascending, or -1 for descending. For example, {"value": -1, "_id": 1}. Refer to the official documentation to learn more.

query

This parameter allows you to use MongoDB query operators to search for specific data. For example, to query users with a name that contains the letter "g": query={ "name": { "$regex": "g" } }. Refer to the official documentation to learn more.

fields
string

This parameter accepts a JSON object with properties that have a value of 1 or 0 to include or exclude them in the response. For example, to only retrieve the usernames of users: fields={ "username": 1 }. Refer to the official documentation to learn more.

Responses
200

OK

Success
{
  "channels": [
    {
      "_id": "GENERAL",
      "ts": "2024-02-14T14:34:49.365Z",
      "t": "c",
      "name": "general",
      "usernames": [],
      "msgs": 6,
      "usersCount": 6,
      "_updatedAt": "2024-03-26T17:40:18.321Z",
      "u": {
        "_id": "rocket.cat",
        "username": "rocket.cat",
        "name": "Rocket.Cat"
      },
      "default": true
    },
    {
      "_id": "65fd8a6bf581e473b56471ba",
      "fname": "test-channel",
      "_updatedAt": "2024-03-22T13:40:59.620Z",
      "customFields": {},
      "topic": "",
      "broadcast": false,
      "encrypted": false,
      "name": "test-channel",
      "t": "c",
      "msgs": 0,
      "usersCount": 1,
      "u": {
        "_id": "GdEsNbLxzoBgG8XoQ",
        "username": "apiadmin",
        "name": "apiadmin"
      },
      "ts": "2024-03-22T13:40:59.577Z",
      "ro": false,
      "default": false,
      "sysMes": true
    }
  ],
  "count": 2,
  "offset": 0,
  "total": 3,
  "success": true
}
Expand All
object
channels
Array of object
object
_id
string
fname
string
customFields
object
topic
string
broadcast
boolean
encrypted
boolean
name
string
t
string
msgs
integer
usersCount
integer
u
object
_id
string
username
string
ts
string
ro
boolean
default
boolean
sysMes
boolean
_updatedAt
string
lastMessage
object
_id
string
rid
string
msg
string
ts
string
u
object
_id
string
username
string
name
string
_updatedAt
string
urls
Array of object
object
mentions
Array of object
object
channels
Array of object
object
md
Array of object
object
type
string
value
Array of object
object
type
string
value
string
groupable
boolean
blocks
Array of object
object
type
string
text
object
type
string
text
string
blockId
string
appId
string
elements
Array of object
object
type
string
text
string
emoji
boolean
editedAt
string
editedBy
object
_id
string
username
string
lm
string
description
string
federated
boolean
count
integer
offset
integer
total
integer
success
boolean
401

Unauthorized

Authorization Error
{
  "status": "error",
  "message": "You must be logged in to do this."
}
object
status
string
message
string