> ## Documentation Index
> Fetch the complete documentation index at: https://developer.rocket.chat/llms.txt
> Use this file to discover all available pages before exploring further.
# Create Channel
> Create a public channel. Optionally, include specified users. The channel creator is included as a member by default. Permission required: `create-c`.
Channel naming has restraints following the regex filter `[0-9a-zA-Z-_.]+` by default. See UTF8 Settings to modify regex filter for channel names. Channel names must not allow for any whitespaces.
### Changelog
| Version | Description |
| ------- | ------------------------- |
| 6.4.1 | Added `excludeSelf` param |
| 0.13.0 | Added |
## OpenAPI
````json POST /api/v1/channels.create
{
"openapi": "3.0.0",
"info": {
"version": "1.0.0",
"title": "Rooms"
},
"servers": [
{
"url": "https://apiexplorer.support.rocket.chat"
}
],
"tags": [
{
"name": "Channels"
},
{
"name": "Directory"
},
{
"name": "Groups"
},
{
"name": "Rooms"
},
{
"name": "Teams"
},
{
"name": "Room Invites"
},
{
"name": "Subscriptions"
},
{
"name": "ABAC"
}
],
"paths": {
"/api/v1/channels.create": {
"post": {
"tags": [
"Channels"
],
"summary": "Create Channel",
"description": "Create a public channel. Optionally, include specified users. The channel creator is included as a member by default. Permission required: `create-c`.\nChannel naming has restraints following the regex filter `[0-9a-zA-Z-_.]+` by default. See UTF8 Settings to modify regex filter for channel names. Channel names must not allow for any whitespaces.\n\n### Changelog\n\n| Version | Description |\n| ------- | ------------------------- |\n| 6.4.1 | Added `excludeSelf` param |\n| 0.13.0 | Added |",
"operationId": "post-api-v1-channels.create",
"parameters": [
{
"$ref": "#/components/parameters/Auth-Token"
},
{
"$ref": "#/components/parameters/UserId"
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the channel."
},
"members": {
"type": "array",
"description": "An array of the users to be added to the channel when it is created.",
"items": {
"type": "string"
}
},
"readOnly": {
"type": "boolean",
"description": "Set if the channel is read only or not. It is `false` by default."
},
"excludeSelf": {
"type": "boolean",
"description": "If set to true, the user calling the endpoint is not automatically added as a member of the channel. The default `value` is false."
},
"customFields": {
"type": "object",
"description": "If you have defined custom fields for your workspace, you can provide them in this object parameter. For details, see the Custom Fields document."
},
"extraData": {
"type": "object",
"description": "Additional channel settings applied at creation.\nFor more information, see Channels.",
"additionalProperties": false,
"properties": {
"broadcast": {
"type": "boolean",
"description": "Whether the channel should be a broadcast room."
},
"encrypted": {
"type": "boolean",
"description": "Whether the channel should be encrypted."
},
"teamId": {
"type": "string",
"description": "An existing team ID to associate with this channel. Requires the `create-team-channel` permission."
},
"topic": {
"type": "string",
"description": "The topic of the channel."
},
"federated": {
"type": "boolean",
"description": "Whether the channel should be federated (Matrix federation)."
}
}
}
},
"required": [
"name"
]
},
"examples": {
"Example": {
"value": {
"name": "channelname",
"members": [
"rocket.cat"
],
"readOnly": true,
"excludeSelf": true,
"customFields": {
"type": "default"
},
"extraData": {
"broadcast": true,
"encrypted": false,
"teamId": "658441562dd9f928ad9951aa"
}
}
}
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"channel": {
"type": "object",
"properties": {
"_id": {
"type": "string"
},
"fname": {
"type": "string"
},
"_updatedAt": {
"type": "string"
},
"customFields": {
"type": "object"
},
"name": {
"type": "string"
},
"t": {
"type": "string"
},
"msgs": {
"type": "integer"
},
"usersCount": {
"type": "integer"
},
"u": {
"type": "object",
"properties": {
"_id": {
"type": "string"
},
"username": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"ts": {
"type": "string"
},
"ro": {
"type": "boolean"
},
"default": {
"type": "boolean"
},
"sysMes": {
"type": "boolean"
}
}
},
"success": {
"type": "boolean"
}
}
},
"examples": {
"Example": {
"value": {
"channel": {
"_id": "ByehQjC44FwMeiLbX",
"name": "channelname",
"t": "c",
"usernames": [
"example"
],
"msgs": 0,
"u": {
"_id": "aobEdbYhXfu5hkeqG",
"username": "example"
},
"ts": "2016-05-30T13:42:25.304Z"
},
"success": true
}
}
}
}
}
},
"401": {
"$ref": "#/components/responses/authorizationError"
}
}
}
}
},
"components": {
"parameters": {
"Auth-Token": {
"name": "X-Auth-Token",
"in": "header",
"description": "The `authToken` of the authenticated user.",
"required": true,
"schema": {
"type": "string"
},
"example": "RScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f"
},
"UserId": {
"name": "X-User-Id",
"in": "header",
"description": "The `userId` of the authenticated user.",
"required": true,
"schema": {
"type": "string"
},
"example": "rbAXPnMktTFbNpwtJ"
}
},
"responses": {
"authorizationError": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean"
},
"error": {
"type": "string"
}
}
},
"examples": {
"Authorization Error": {
"value": {
"success": false,
"error": "You must be logged in to do this."
}
}
}
}
}
}
}
}
}
````