> ## 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 > 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 | ## OpenAPI ````json POST /api/v1/channels.setJoinCode { "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.setJoinCode": { "post": { "tags": [ "Channels" ], "summary": "Set Channel Join Code", "description": "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`\n\n### Changelog\n| Version | Description |\n| ------- | ----------- |\n|0.49.0 | Added |", "operationId": "post-api-v1-channels.setJoinCode", "parameters": [ { "$ref": "#/components/parameters/Auth-Token" }, { "$ref": "#/components/parameters/UserId" } ], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "roomId": { "type": "string", "description": "The channel's ID." }, "joinCode": { "type": "string", "description": "The join code that will be required for any user to join this channel." } }, "required": [ "roomId", "joinCode" ] }, "examples": { "Example": { "value": { "roomId": "ByehQjC44FwMeiLbX", "joinCode": "87hsyi9" } } } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "channel": { "type": "object", "properties": { "_id": { "type": "string" }, "fname": { "type": "string" }, "customFields": { "type": "object", "properties": { "organization": { "type": "string" } } }, "topic": { "type": "string" }, "broadcast": { "type": "boolean" }, "encrypted": { "type": "boolean" }, "name": { "type": "string" }, "t": { "type": "string" }, "msgs": { "type": "integer" }, "usersCount": { "type": "integer" }, "u": { "type": "object", "properties": { "_id": { "type": "string" }, "username": { "type": "string" } } }, "ts": { "type": "string" }, "ro": { "type": "boolean" }, "default": { "type": "boolean" }, "sysMes": { "type": "boolean" }, "_updatedAt": { "type": "string" }, "lastMessage": { "type": "object", "properties": { "_id": { "type": "string" }, "rid": { "type": "string" }, "msg": { "type": "string" }, "ts": { "type": "string" }, "u": { "type": "object", "properties": { "_id": { "type": "string" }, "username": { "type": "string" }, "name": { "type": "string" } } }, "_updatedAt": { "type": "string" }, "urls": { "type": "array", "items": { "type": "object" } }, "mentions": { "type": "array", "items": { "type": "object" } }, "channels": { "type": "array", "items": { "type": "object" } }, "md": { "type": "array", "items": { "type": "object", "properties": { "type": { "type": "string" }, "value": { "type": "array", "items": { "type": "object", "properties": { "type": { "type": "string" }, "value": { "type": "string" } } } } } } } } }, "lm": { "type": "string" }, "announcement": { "type": "string" }, "description": { "type": "string" }, "joinCodeRequired": { "type": "boolean" } } }, "success": { "type": "boolean" } } }, "examples": { "Success": { "value": { "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 } } } } } }, "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": { "status": { "type": "string" }, "message": { "type": "string" } } }, "examples": { "Authorization Error": { "value": { "status": "error", "message": "You must be logged in to do this." } } } } } } } } } ````