---
title: "Set Channel Join Code"
slug: "set-channel-join-code"
updated: 2026-06-08T12:46:40Z
published: 2026-06-08T12:46:40Z
stale: true
---

> ## 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.

# Set Channel Join Code

Post/api/v1/channels.setJoinCode

Set the code required to join the channel. If it is set, users must use the join code to successfully join the channel. Permission required: `edit-room`

### Changelog

| Version | Description |
| --- | --- |
| 0.49.0 | Added |

Header parametersX-Auth-TokenstringRequired

The `authToken` of the authenticated user.

ExampleRScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f
X-User-IdstringRequired

The `userId` of the authenticated user.

ExamplerbAXPnMktTFbNpwtJ

Body parameters<select class='api-response-data' aria-label='Media type'><option value='d54ec21c-b676-4420-bc34-395c63b3277d'>application/json</option>
</select><select class='select-example' aria-label='Media type'><option value='d4187136-f131-4081-9de2-0aec8b9e3345'>Example</option>
</select>Example

```json
{
  "roomId": "ByehQjC44FwMeiLbX",
  "joinCode": "87hsyi9"
}
```

object  roomIdstring    Required

The channel's ID.

joinCodestring    Required

The join code that will be required for any user to join this channel.

Responses200

OK

<select class='api-response-data' aria-label='Media type'><option value='2537f081-c887-4330-b54c-ca3ef5ed8b8b'>application/json</option>
</select><select class='select-example' aria-label='Media type'><option value='f4b9b2e4-fb8c-49a4-8748-a931cbbf900d'>Success</option>
</select>Success

```json
{
  "channel": {
    "_id": "WDuJLFkjwk6L7LdFC",
    "fname": "new",
    "customFields": {
      "organization": "tra-la-la"
    },
    "topic": "",
    "broadcast": false,
    "encrypted": false,
    "name": "new",
    "t": "c",
    "msgs": 73,
    "usersCount": 45,
    "u": {
      "_id": "rbAXPnMktTFbNpwtJ",
      "username": "roxie"
    },
    "ts": "2023-04-05T22:34:38.936Z",
    "ro": false,
    "default": true,
    "sysMes": true,
    "_updatedAt": "2023-09-27T05:40:39.687Z",
    "lastMessage": {
      "_id": "mBfC3sbNhfwcL4AQu",
      "rid": "WDuJLFkjwk6L7LdFC",
      "msg": "It should be good",
      "ts": "2023-09-16T07:37:59.691Z",
      "u": {
        "_id": "rbAXPnMktTFbNpwtJ",
        "username": "test.test",
        "name": "test test"
      },
      "_updatedAt": "2023-09-16T07:37:59.815Z",
      "urls": [],
      "mentions": [],
      "channels": [],
      "md": [
        {
          "type": "PARAGRAPH",
          "value": [
            {
              "type": "PLAIN_TEXT",
              "value": "It should be good"
            }
          ]
        }
      ]
    },
    "lm": "2023-09-16T07:37:59.691Z",
    "announcement": "Test out everything",
    "description": "Testing the room",
    "joinCodeRequired": true
  },
  "success": true
}
```

Expand Allobject  channelobject  _idstring    
fnamestring    
customFieldsobject  organizationstring    

topicstring    
broadcastboolean    
encryptedboolean    
namestring    
tstring    
msgsinteger    
usersCountinteger    
uobject  _idstring    
usernamestring    

tsstring    
roboolean    
defaultboolean    
sysMesboolean    
_updatedAtstring    
lastMessageobject  _idstring    
ridstring    
msgstring    
tsstring    
uobject  _idstring    
usernamestring    
namestring    

_updatedAtstring    
urls Array of object   object  
mentions Array of object   object  
channels Array of object   object  
md Array of object   object  typestring    
value Array of object   object  typestring    
valuestring    

lmstring    
announcementstring    
descriptionstring    
joinCodeRequiredboolean    

successboolean    

401

Unauthorized

<select class='api-response-data' aria-label='Media type'><option value='297a17a2-39b1-4802-8417-54c572978d98'>application/json</option>
</select><select class='select-example' aria-label='Media type'><option value='26f33848-fe2c-4880-91a3-2fb7e0d9e8f8'>Authorization Error</option>
</select>Authorization Error

```json
{
  "status": "error",
  "message": "You must be logged in to do this."
}
```

object  statusstring    
messagestring
