description:A group id to exclude channels that are associated with that group via GroupChannel records. This can also be left blank with `not_associated_to_group=`.
schema:
type:string
- name:page
in:query
description:The page to select.
schema:
type:integer
default:0
- name:per_page
in:query
description:The number of channels per page.
schema:
type:integer
default:0
- name:exclude_default_channels
in:query
description:Whether to exclude default channels (ex Town Square, Off-Topic) from the results.
schema:
type:boolean
default:false
- name:include_deleted
in:query
description:Include channels that have been archived. This correlates to the `DeleteAt` flag being set in the database.
schema:
type:boolean
default:false
- name:include_total_count
in:query
description:>-
Appends a total count of returned channels inside the response object - ex:`{ "channels": [], "total_count" : 0 }`.
schema:
type:boolean
default:false
- name:exclude_policy_constrained
in:query
schema:
type:boolean
default:false
description:>-
If set to true, channels which are part of a data retention policy will be excluded.
The `sysconsole_read_compliance` permission is required to use this parameter.
If creating a public channel, `create_public_channel` permission is required. If creating a private channel, `create_private_channel` permission is required.
operationId:CreateChannel
requestBody:
content:
application/json:
schema:
type:object
required:
- name
- display_name
- type
- team_id
properties:
team_id:
type:string
description:The team ID of the team to create the channel on
name:
type:string
description:The unique handle for the channel, will be present in the
channel URL
display_name:
type:string
description:The non-unique UI name for the channel
purpose:
type:string
description:A short description of the purpose of the channel
header:
type:string
description:Markdown-formatted text to display in the header of the
channel
type:
type:string
description:"'O' for a public channel, 'P' for a private channel"
description:Channel object to be created
required:true
responses:
"201":
description:Channel creation successful
content:
application/json:
schema:
$ref:"#/components/schemas/Channel"
"400":
$ref:"#/components/responses/BadRequest"
"401":
$ref:"#/components/responses/Unauthorized"
"403":
$ref:"#/components/responses/Forbidden"
/api/v4/channels/direct:
post:
tags:
- channels
summary:Create a direct message channel
description:>
Create a new direct message channel between two users.
##### Permissions
Must be one of the two users and have `create_direct_channel` permission. Having the `manage_system` permission voids the previous requirements.
operationId:CreateDirectChannel
requestBody:
content:
application/json:
schema:
type:array
items:
type:string
minItems:2
maxItems:2
description:The two user ids to be in the direct message
required:true
responses:
"201":
description:Direct channel creation successful
content:
application/json:
schema:
$ref:"#/components/schemas/Channel"
"400":
$ref:"#/components/responses/BadRequest"
"401":
$ref:"#/components/responses/Unauthorized"
"403":
$ref:"#/components/responses/Forbidden"
/api/v4/channels/group:
post:
tags:
- channels
summary:Create a group message channel
description:>
Create a new group message channel to group of users. If the logged in
user's id is not included in the list, it will be appended to the end.
Get a list of timezones for the users who are in this channel.
__Minimum server version__:5.6
##### Permissions
Must have the `read_channel` permission.
operationId:GetChannelMembersTimezones
parameters:
- name:channel_id
in:path
description:Channel GUID
required:true
schema:
type:string
responses:
"200":
description:Timezone retrieval successful
content:
application/json:
schema:
type:array
items:
type:string
"400":
$ref:"#/components/responses/BadRequest"
"401":
$ref:"#/components/responses/Unauthorized"
"403":
$ref:"#/components/responses/Forbidden"
"/api/v4/channels/{channel_id}":
get:
tags:
- channels
summary:Get a channel
description:|
Get channel from the provided channel id string.
##### Permissions
`read_channel` permission for the channel.
operationId:GetChannel
parameters:
- name:channel_id
in:path
description:Channel GUID
required:true
schema:
type:string
responses:
"200":
description:Channel retrieval successful
content:
application/json:
schema:
$ref:"#/components/schemas/Channel"
"401":
$ref:"#/components/responses/Unauthorized"
"403":
$ref:"#/components/responses/Forbidden"
"404":
$ref:"#/components/responses/NotFound"
put:
tags:
- channels
summary:Update a channel
description:>
Update a channel. The fields that can be updated are listed as
parameters. Omitted fields will be treated as blanks.
##### Permissions
If updating a public channel, `manage_public_channel_members` permission is required. If updating a private channel, `manage_private_channel_members` permission is required.
operationId:UpdateChannel
parameters:
- name:channel_id
in:path
description:Channel GUID
required:true
schema:
type:string
requestBody:
content:
application/json:
schema:
type:object
required:
- id
properties:
id:
type:string
description:The channel's id, not updatable
name:
type:string
description:The unique handle for the channel, will be present in the
channel URL
display_name:
type:string
description:The non-unique UI name for the channel
purpose:
type:string
description:A short description of the purpose of the channel
header:
type:string
description:Markdown-formatted text to display in the header of the
channel
description:Channel object to be updated
required:true
responses:
"200":
description:Channel update successful
content:
application/json:
schema:
$ref:"#/components/schemas/Channel"
"400":
$ref:"#/components/responses/BadRequest"
"401":
$ref:"#/components/responses/Unauthorized"
"403":
$ref:"#/components/responses/Forbidden"
"404":
$ref:"#/components/responses/NotFound"
delete:
tags:
- channels
summary:Delete a channel
description:>
Archives a channel. This will set the `deleteAt` to the current timestamp in the database. Soft deleted channels may not be accessible in the user
interface. They can be viewed and unarchived in the **System Console > User Management > Channels** based on your license. Direct and group message channels cannot be deleted.
As of server version 5.28, optionally use the `permanent=true` query parameter to permanently delete the channel for compliance reasons. To use this feature `ServiceSettings.EnableAPIChannelDeletion` must be set to `true` in the server's configuration.
If you permanently delete a channel this action is not recoverable outside of a database backup.
##### Permissions
`delete_public_channel` permission if the channel is public,
`delete_private_channel` permission if the channel is private,
or have `manage_system` permission.
operationId:DeleteChannel
parameters:
- name:channel_id
in:path
description:Channel GUID
required:true
schema:
type:string
responses:
"200":
description:Channel deletion successful
content:
application/json:
schema:
$ref:"#/components/schemas/StatusOK"
"400":
$ref:"#/components/responses/BadRequest"
"401":
$ref:"#/components/responses/Unauthorized"
"403":
$ref:"#/components/responses/Forbidden"
"/api/v4/channels/{channel_id}/patch":
put:
tags:
- channels
summary:Patch a channel
description:>
Partially update a channel by providing only the fields you want to
update. Omitted fields will not be updated. The fields that can be
updated are defined in the request body, all other provided fields will
be ignored.
##### Permissions
If updating a public channel, `manage_public_channel_members` permission is required. If updating a private channel, `manage_private_channel_members` permission is required.
operationId:PatchChannel
parameters:
- name:channel_id
in:path
description:Channel GUID
required:true
schema:
type:string
requestBody:
content:
application/json:
schema:
type:object
properties:
name:
type:string
description:The unique handle for the channel, will be present in the
channel URL
display_name:
type:string
description:The non-unique UI name for the channel
purpose:
type:string
description:A short description of the purpose of the channel
header:
type:string
description:Markdown-formatted text to display in the header of the
channel
description:Channel object to be updated
required:true
responses:
"200":
description:Channel patch successful
content:
application/json:
schema:
$ref:"#/components/schemas/Channel"
"400":
$ref:"#/components/responses/BadRequest"
"401":
$ref:"#/components/responses/Unauthorized"
"403":
$ref:"#/components/responses/Forbidden"
"404":
$ref:"#/components/responses/NotFound"
"/api/v4/channels/{channel_id}/privacy":
put:
tags:
- channels
summary:Update channel's privacy
description:>
Updates channel's privacy allowing changing a channel from Public to
Private and back.
__Minimum server version__:5.16
##### Permissions
`manage_team` permission for the channels team on version < 5.28.
`convert_public_channel_to_private` permission for the channel if updating privacy to 'P' on version >= 5.28.
`convert_private_channel_to_public` permission for the channel if updating privacy to 'O' on version >= 5.28.
operationId:UpdateChannelPrivacy
parameters:
- name:channel_id
in:path
description:Channel GUID
required:true
schema:
type:string
requestBody:
content:
application/json:
schema:
type:object
required:
- privacy
properties:
privacy:
type:string
description:"Channel privacy setting: 'O' for a public channel, 'P' for
a private channel"
required:true
responses:
"200":
description:Channel conversion successful
content:
application/json:
schema:
$ref:"#/components/schemas/Channel"
"400":
$ref:"#/components/responses/BadRequest"
"401":
$ref:"#/components/responses/Unauthorized"
"403":
$ref:"#/components/responses/Forbidden"
"404":
$ref:"#/components/responses/NotFound"
"/api/v4/channels/{channel_id}/restore":
post:
tags:
- channels
summary:Restore a channel
description:|
Restore channel from the provided channel id string.
__Minimum server version__:3.10
##### Permissions
`manage_team` permission for the team of the channel.
operationId:RestoreChannel
parameters:
- name:channel_id
in:path
description:Channel GUID
required:true
schema:
type:string
responses:
"200":
description:Channel restore successful
content:
application/json:
schema:
$ref:"#/components/schemas/Channel"
"401":
$ref:"#/components/responses/Unauthorized"
"403":
$ref:"#/components/responses/Forbidden"
"404":
$ref:"#/components/responses/NotFound"
"/api/v4/channels/{channel_id}/move":
post:
tags:
- channels
summary:Move a channel
description:|
Move a channel to another team.
__Minimum server version__:5.26
##### Permissions
Must have `manage_system` permission.
operationId:MoveChannel
parameters:
- name:channel_id
in:path
description:Channel GUID
required:true
schema:
type:string
requestBody:
content:
application/json:
schema:
type:object
required:
- team_id
properties:
team_id:
type:string
force:
description:"Remove members those are not member of target team before moving the channel."
Autocomplete your channels on a team based on the search term provided
in the request URL.
__Minimum server version__:5.4
##### Permissions
Must have the `list_team_channels` permission.
operationId:AutocompleteChannelsForTeamForSearch
parameters:
- name:team_id
in:path
description:Team GUID
required:true
schema:
type:string
- name:name
in:query
description:Name or display name
required:true
schema:
type:string
responses:
"200":
description:Channels autocomplete successful
content:
application/json:
schema:
type:array
items:
$ref:"#/components/schemas/Channel"
"400":
$ref:"#/components/responses/BadRequest"
"401":
$ref:"#/components/responses/Unauthorized"
"403":
$ref:"#/components/responses/Forbidden"
"404":
$ref:"#/components/responses/NotFound"
"/api/v4/teams/{team_id}/channels/search":
post:
tags:
- channels
summary:Search channels
description:>
Search public channels on a team based on the search term provided in
the request body.
##### Permissions
Must have the `list_team_channels` permission.
In server version 5.16 and later, a user without the `list_team_channels` permission will be able to use this endpoint, with the search results limited to the channels that the user is a member of.
operationId:SearchChannels
parameters:
- name:team_id
in:path
description:Team GUID
required:true
schema:
type:string
requestBody:
content:
application/json:
schema:
type:object
required:
- term
properties:
term:
description:The search term to match against the name or display name of
Search archived channels on a team based on the search term provided in
the request body.
__Minimum server version__:5.18
##### Permissions
Must have the `list_team_channels` permission.
In server version 5.18 and later, a user without the `list_team_channels` permission will be able to use this endpoint, with the search results limited to the channels that the user is a member of.
operationId:SearchArchivedChannels
parameters:
- name:team_id
in:path
description:Team GUID
required:true
schema:
type:string
requestBody:
content:
application/json:
schema:
type:object
required:
- term
properties:
term:
description:The search term to match against the name or display name of
Get the set of users who are members of the channel minus the set of
users who are members of the given groups.
Each user object contains an array of group objects representing the group memberships for that user.
Each user object contains the boolean fields `scheme_guest`, `scheme_user`, and `scheme_admin` representing the roles that user has for the given channel.
##### Permissions
Must have `manage_system` permission.
__Minimum server version__:5.14
operationId:ChannelMembersMinusGroupMembers
parameters:
- name:channel_id
in:path
description:Channel GUID
required:true
schema:
type:string
- name:group_ids
in:query
description:A comma-separated list of group ids.
required:true
schema:
type:string
default:""
- name:page
in:query
description:The page to select.
schema:
type:integer
default:0
- name:per_page
in:query
description:The number of users per page.
schema:
type:integer
default:0
responses:
"200":
description:Successfully returns users specified by the pagination, and the