Channels Resource

Channel Object

Represents a guild or DM channel within Discord.

Channel Structure
FieldTypeDescription
idsnowflakethe id of this channel
typeintegerthe type of channel
guild_id?snowflakethe id of the guild (may be missing for some channel objects received over gateway guild dispatches)
position?integersorting position of the channel
permission_overwrites?array of overwrite objectsexplicit permission overwrites for members and roles
name?stringthe name of the channel (1-100 characters)
topic??stringthe channel topic (0-1024 characters)
nsfw?booleanwhether the channel is nsfw
last_message_id??snowflakethe id of the last message sent in this channel (may not point to an existing or valid message)
bitrate?integerthe bitrate (in bits) of the voice channel
user_limit?integerthe user limit of the voice channel
rate_limit_per_user?*integeramount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages or manage_channel, are unaffected
recipients?array of user objectsthe recipients of the DM
icon??stringicon hash
owner_id?snowflakeid of the creator of the group DM or thread
application_id?snowflakeapplication id of the group DM creator if it is bot-created
parent_id??snowflakefor guild channels: id of the parent category for a channel (each parent category can contain up to 50 channels), for threads: id of the text channel this thread was created
last_pin_timestamp??ISO8601 timestampwhen the last pinned message was pinned. This may be null in events such as GUILD_CREATE when a message is not pinned.
rtc_region??stringvoice region id for the voice channel, automatic when set to null
video_quality_mode?integerthe camera video quality mode of the voice channel, 1 when not present
message_count?integeran approximate count of messages in a thread, stops counting at 50
member_count?integeran approximate count of users in a thread, stops counting at 50
thread_metadata?a thread metadata objectthread-specific fields not needed by other channels
member?a thread member objectthread member object for the current user, if they have joined the thread, only included on certain API endpoints
default_auto_archive_duration?integerdefault duration for newly created threads, in minutes, to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080
permissions?stringcomputed permissions for the invoking user in the channel, including overwrites, only included when part of the resolved data received on a slash command interaction

* rate_limit_per_user also applies to thread creation. Users can send one message and create one thread during each rate_limit_per_user interval.

Channel Types
TypeIDDescription
GUILD_TEXT0a text channel within a server
DM1a direct message between users
GUILD_VOICE2a voice channel within a server
GROUP_DM3a direct message between multiple users
GUILD_CATEGORY4an organizational category that contains up to 50 channels
GUILD_NEWS5a channel that users can follow and crosspost into their own server
GUILD_STORE6a channel in which game developers can sell their game on Discord
GUILD_NEWS_THREAD10a temporary sub-channel within a GUILD_NEWS channel
GUILD_PUBLIC_THREAD11a temporary sub-channel within a GUILD_TEXT channel
GUILD_PRIVATE_THREAD12a temporary sub-channel within a GUILD_TEXT channel that is only viewable by those invited and those with the MANAGE_THREADS permission
GUILD_STAGE_VOICE13a voice channel for hosting events with an audience
Video Quality Modes
ModeValueDescription
AUTO1Discord chooses the quality for optimal performance
FULL2720p
Example Guild Text Channel
json
{
"id": "41771983423143937",
"guild_id": "41771983423143937",
"name": "general",
"type": 0,
"position": 6,
"permission_overwrites": [],
"rate_limit_per_user": 2,
"nsfw": true,
"topic": "24/7 chat about how to gank Mike #2",
"last_message_id": "155117677105512449",
"parent_id": "399942396007890945",
"default_auto_archive_duration": 60
}
Example Guild News Channel

Bots can post or publish messages in this type of channel if they have the proper permissions. These are called "Announcement Channels" in the client.

json
{
"id": "41771983423143937",
"guild_id": "41771983423143937",
"name": "important-news",
"type": 5,
"position": 6,
"permission_overwrites": [],
"nsfw": true,
"topic": "Rumors about Half Life 3",
"last_message_id": "155117677105512449",
"parent_id": "399942396007890945",
"default_auto_archive_duration": 60
}
Example Guild Voice Channel
json
{
"id": "155101607195836416",
"guild_id": "41771983423143937",
"name": "ROCKET CHEESE",
"type": 2,
"nsfw": false,
"position": 5,
"permission_overwrites": [],
"bitrate": 64000,
"user_limit": 0,
"parent_id": null,
"rtc_region": null
}
Example DM Channel
json
{
"last_message_id": "3343820033257021450",
"type": 1,
"id": "319674150115610528",
"recipients": [
{
"username": "test",
"discriminator": "9999",
"id": "82198898841029460",
"avatar": "33ecab261d4681afa4d85a04691c4a01"
}
]
}
Example Group DM Channel
json
{
"name": "Some test channel",
"icon": null,
"recipients": [
{
"username": "test",
"discriminator": "9999",
"id": "82198898841029460",
"avatar": "33ecab261d4681afa4d85a04691c4a01"
},
{
"username": "test2",
"discriminator": "9999",
"id": "82198810841029460",
"avatar": "33ecab261d4681afa4d85a10691c4a01"
}
],
"last_message_id": "3343820033257021450",
"type": 3,
"id": "319674150115710528",
"owner_id": "82198810841029460"
}
Example Channel Category
json
{
"permission_overwrites": [],
"name": "Test",
"parent_id": null,
"nsfw": false,
"position": 0,
"guild_id": "290926798629997250",
"type": 4,
"id": "399942396007890945"
}
Example Store Channel

Bots can neither send or read messages from this channel type (as it is a store page).

json
{
"id": "41771983423143937",
"guild_id": "41771983423143937",
"name": "buy dota-2",
"type": 6,
"position": 0,
"permission_overwrites": [],
"nsfw": false,
"parent_id": null
}
Example Thread Channel

Threads can be either archived or active. Archived threads are generally immutable. To send a message or add a reaction, a thread must first be unarchived. The API will helpfully automatically unarchive a thread when sending a message in that thread.

Unlike with channels, the API will only sync updates to users about threads the current user can view. When receiving a guild create payload, the API will only include active threads the current user can view. Threads inside of private channels are completely private to the members of that private channel. As such, when gaining access to a channel the API sends a thread list sync, which includes all active threads in that channel.

Threads also track membership. Users must be added to a thread before sending messages in them. The API will helpfully automatically add users to a thread when sending a message in that thread.

Guilds have limits on the number of active threads and members per thread. Once these are reached additional threads cannot be created or unarchived, and users cannot be added. Threads do not count against the per-guild channel limit.

The threads topic has some more information.

json
{
"id": "41771983423143937",
"guild_id": "41771983423143937",
"parent_id": "41771983423143937",
"owner_id": "41771983423143937",
"name": "don't buy dota-2",
"type": 11,
"last_message_id": "155117677105512449",
"message_count": 1,
"member_count": 5,
"rate_limit_per_user": 2,
"thread_metadata": {
"archived": false,
"auto_archive_duration": 1440,
"archive_timestamp": "2021-04-12T23:40:39.855793+00:00",
"locked": false
}
}

Overwrite Object

See permissions for more information about the allow and deny fields.

Overwrite Structure
FieldTypeDescription
idsnowflakerole or user id
typeinteither 0 (role) or 1 (member)
allowstringpermission bit set
denystringpermission bit set

Thread Metadata Object

The thread metadata object contains a number of thread-specific channel fields that are not needed by other channel types.

Thread Metadata Structure
FieldTypeDescription
archivedbooleanwhether the thread is archived
auto_archive_durationintegerduration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080
archive_timestampISO8601 timestamptimestamp when the thread's archive status was last changed, used for calculating recent activity
lockedbooleanwhether the thread is locked; when a thread is locked, only users with MANAGE_THREADS can unarchive it
invitable?booleanwhether non-moderators can add other non-moderators to a thread; only available on private threads

Thread Member Object

A thread member is used to indicate whether a user has joined a thread or not.

Thread Member Structure
FieldTypeDescription
id? *snowflakethe id of the thread
user_id? *snowflakethe id of the user
join_timestampISO8601 timestampthe time the current user last joined the thread
flagsintegerany user-thread settings, currently only used for notifications

* These fields are ommitted on the member sent within each thread in the GUILD_CREATE event

Endpoints

Get Channel

GET/channels/{channel.id}

Get a channel by ID. Returns a channel object. If the channel is a thread, a thread member object is included in the returned result.

Modify Channel

PATCH/channels/{channel.id}

Update a channel's settings. Returns a channel on success, and a 400 BAD REQUEST on invalid parameters. All JSON parameters are optional.

JSON Params (Group DM)

Fires a Channel Update Gateway event.

FieldTypeDescription
namestring1-100 character channel name
iconbinarybase64 encoded icon
JSON Params (Guild channel)

Requires the MANAGE_CHANNELS permission for the guild. Fires a Channel Update Gateway event. If modifying a category, individual Channel Update events will fire for each child channel that also changes. If modifying permission overwrites, the MANAGE_ROLES permission is required. Only permissions your bot has in the guild or channel can be allowed/denied (unless your bot has a MANAGE_ROLES overwrite in the channel).

FieldTypeDescriptionChannel Type
namestring1-100 character channel nameAll
typeintegerthe type of channel; only conversion between text and news is supported and only in guilds with the "NEWS" featureText, News
position?integerthe position of the channel in the left-hand listingAll
topic?string0-1024 character channel topicText, News
nsfw?booleanwhether the channel is nsfwText, News, Store
rate_limit_per_user?integeramount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages or manage_channel, are unaffectedText
bitrate?integerthe bitrate (in bits) of the voice channel; 8000 to 96000 (128000 for VIP servers)Voice
user_limit?integerthe user limit of the voice channel; 0 refers to no limit, 1 to 99 refers to a user limitVoice
permission_overwrites?array of overwrite objectschannel or category-specific permissionsAll
parent_id?snowflakeid of the new parent category for a channelText, News, Store, Voice
rtc_region?stringchannel voice region id, automatic when set to nullVoice
video_quality_mode?integerthe camera video quality mode of the voice channelVoice
default_auto_archive_duration?integerthe default duration for newly created threads in the channel, in minutes, to automatically archive the thread after recent activityText, News
JSON Params (Thread)

When setting archived to false, when locked is also false, only the SEND_MESSAGES permission is required.

Otherwise, requires the MANAGE_THREADS permission. Fires a Thread Update Gateway event. Requires the thread to have archived set to false or be set to false in the request.

FieldTypeDescription
namestring1-100 character channel name
archivedbooleanwhether the thread is archived
auto_archive_duration*integerduration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080
lockedbooleanwhether the thread is locked; when a thread is locked, only users with MANAGE_THREADS can unarchive it
invitablebooleanwhether non-moderators can add other non-moderators to a thread; only available on private threads
rate_limit_per_user?integeramount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages, manage_thread, or manage_channel, are unaffected

* The 3 day and 7 day archive durations require the server to be boosted. The guild features will indicate if a server is able to use those settings.

Delete/Close Channel

DELETE/channels/{channel.id}

Delete a channel, or close a private message. Requires the MANAGE_CHANNELS permission for the guild, or MANAGE_THREADS if the channel is a thread. Deleting a category does not delete its child channels; they will have their parent_id removed and a Channel Update Gateway event will fire for each of them. Returns a channel object on success. Fires a Channel Delete Gateway event (or Thread Delete if the channel was a thread).

Edit Channel Permissions

PUT/channels/{channel.id}/permissions/{overwrite.id}

Edit the channel permission overwrites for a user or role in a channel. Only usable for guild channels. Requires the MANAGE_ROLES permission. Only permissions your bot has in the guild or channel can be allowed/denied (unless your bot has a MANAGE_ROLES overwrite in the channel). Returns a 204 empty response on success. For more information about permissions, see permissions.

JSON Params
FieldTypeDescription
allowstringthe bitwise value of all allowed permissions
denystringthe bitwise value of all disallowed permissions
typeinteger0 for a role or 1 for a member

Get Channel Invites

GET/channels/{channel.id}/invites

Returns a list of invite objects (with invite metadata) for the channel. Only usable for guild channels. Requires the MANAGE_CHANNELS permission.

Create Channel Invite

POST/channels/{channel.id}/invites

Create a new invite object for the channel. Only usable for guild channels. Requires the CREATE_INSTANT_INVITE permission. All JSON parameters for this route are optional, however the request body is not. If you are not sending any fields, you still have to send an empty JSON object ({}). Returns an invite object. Fires an Invite Create Gateway event.

JSON Params
FieldTypeDescriptionDefault
max_ageintegerduration of invite in seconds before expiry, or 0 for never. between 0 and 604800 (7 days)86400 (24 hours)
max_usesintegermax number of uses or 0 for unlimited. between 0 and 1000
temporarybooleanwhether this invite only grants temporary membershipfalse
uniquebooleanif true, don't try to reuse a similar invite (useful for creating many unique one time use invites)false
target_typeintegerthe type of target for this voice channel invite
target_user_idsnowflakethe id of the user whose stream to display for this invite, required if target_type is 1, the user must be streaming in the channel
target_application_idsnowflakethe id of the embedded application to open for this invite, required if target_type is 2, the application must have the EMBEDDED flag

Delete Channel Permission

DELETE/channels/{channel.id}/permissions/{overwrite.id}

Delete a channel permission overwrite for a user or role in a channel. Only usable for guild channels. Requires the MANAGE_ROLES permission. Returns a 204 empty response on success. For more information about permissions, see permissions

Follow News Channel

POST/channels/{channel.id}/followers

Follow a News Channel to send messages to a target channel. Requires the MANAGE_WEBHOOKS permission in the target channel. Returns a followed channel object.

JSON Params
FieldTypeDescription
webhook_channel_idsnowflakeid of target channel

Trigger Typing Indicator

POST/channels/{channel.id}/typing

Post a typing indicator for the specified channel. Generally bots should not implement this route. However, if a bot is responding to a command and expects the computation to take a few seconds, this endpoint may be called to let the user know that the bot is processing their message. Returns a 204 empty response on success. Fires a Typing Start Gateway event.

Group DM Add Recipient

PUT/channels/{channel.id}/recipients/{user.id}

Adds a recipient to a Group DM using their access token.

JSON Params
FieldTypeDescription
access_tokenstringaccess token of a user that has granted your app the gdm.join scope
nickstringnickname of the user being added

Group DM Remove Recipient

DELETE/channels/{channel.id}/recipients/{user.id}

Removes a recipient from a Group DM.

Start Thread with Message

POST/channels/{channel.id}/messages/{message.id}/threads

Creates a new thread from an existing message. Returns a channel on success, and a 400 BAD REQUEST on invalid parameters. Fires a Thread Create Gateway event.

When called on a GUILD_TEXT channel, creates a GUILD_PUBLIC_THREAD. When called on a GUILD_NEWS channel, creates a GUILD_NEWS_THREAD. The id of the created thread will be the same as the id of the message, and as such a message can only have a single thread created from it.

JSON Params
FieldTypeDescription
namestring1-100 character channel name
auto_archive_duration*integerduration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080

* The 3 day and 7 day archive durations require the server to be boosted. The guild features will indicate if a server is able to use those settings.

Start Thread without Message

POST/channels/{channel.id}/threads

Creates a new thread that is not connected to an existing message. The created thread defaults to a GUILD_PRIVATE_THREAD*. Returns a channel on success, and a 400 BAD REQUEST on invalid parameters. Fires a Thread Create Gateway event.

JSON Params
FieldTypeDescription
namestring1-100 character channel name
auto_archive_duration**integerduration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080
type?***integerthe type of thread to create
invitable?booleanwhether non-moderators can add other non-moderators to a thread; only available when creating a private thread

* Creating a private thread requires the server to be boosted. The guild features will indicate if that is possible for the guild.

** The 3 day and 7 day archive durations require the server to be boosted. The guild features will indicate if that is possible for the guild.

*** In API v9, type defaults to PRIVATE_THREAD in order to match the behavior when thread documentation was first published. In API v10 this will be changed to be a required field, with no default.

Join Thread

PUT/channels/{channel.id}/thread-members/@me

Adds the current user to a thread. Also requires the thread is not archived. Returns a 204 empty response on success. Fires a Thread Members Update Gateway event.

Add Thread Member

PUT/channels/{channel.id}/thread-members/{user.id}

Adds another member to a thread. Requires the ability to send messages in the thread. Also requires the thread is not archived. Returns a 204 empty response on success. Fires a Thread Members Update Gateway event.

Leave Thread

DELETE/channels/{channel.id}/thread-members/@me

Removes the current user from a thread. Also requires the thread is not archived. Returns a 204 empty response on success. Fires a Thread Members Update Gateway event.

Remove Thread Member

DELETE/channels/{channel.id}/thread-members/{user.id}

Removes another member from a thread. Requires the MANAGE_THREADS permission, or the creator of the thread if it is a GUILD_PRIVATE_THREAD. Also requires the thread is not archived. Returns a 204 empty response on success. Fires a Thread Members Update Gateway event.

List Thread Members

GET/channels/{channel.id}/thread-members

Returns array of thread members objects that are members of the thread.

List Active Threads

GET/channels/{channel.id}/threads/active

Returns all active threads in the channel, including public and private threads. Threads are ordered by their id, in descending order.

Response Body
FieldTypeDescription
threadsarray of channel objectsthe active threads
membersarray of thread members objectsa thread member object for each returned thread the current user has joined
has_morebooleanwhether there are potentially additional threads that could be returned on a subsequent call

List Public Archived Threads

GET/channels/{channel.id}/threads/archived/public

Returns archived threads in the channel that are public. When called on a GUILD_TEXT channel, returns threads of type GUILD_PUBLIC_THREAD. When called on a GUILD_NEWS channel returns threads of type GUILD_NEWS_THREAD. Threads are ordered by archive_timestamp, in descending order. Requires the READ_MESSAGE_HISTORY permission.

Query String Params
FieldTypeDescription
before?ISO8601 timestampreturns threads before this timestamp
limit?integeroptional maximum number of threads to return
Response Body
FieldTypeDescription
threadsarray of channel objectsthe public, archived threads
membersarray of thread members objectsa thread member object for each returned thread the current user has joined
has_morebooleanwhether there are potentially additional threads that could be returned on a subsequent call

List Private Archived Threads

GET/channels/{channel.id}/threads/archived/private

Returns archived threads in the channel that are of type GUILD_PRIVATE_THREAD. Threads are ordered by archive_timestamp, in descending order. Requires both the READ_MESSAGE_HISTORY and MANAGE_THREADS permissions.

Query String Params
FieldTypeDescription
before?ISO8601 timestampreturns threads before this timestamp
limit?integeroptional maximum number of threads to return
Response Body
FieldTypeDescription
threadsarray of channel objectsthe private, archived threads
membersarray of thread members objectsa thread member object for each returned thread the current user has joined
has_morebooleanwhether there are potentially additional threads that could be returned on a subsequent call

List Joined Private Archived Threads

GET/channels/{channel.id}/users/@me/threads/archived/private

Returns archived threads in the channel that are of type GUILD_PRIVATE_THREAD, and the user has joined. Threads are ordered by their id, in descending order. Requires the READ_MESSAGE_HISTORY permission.

Query String Params
FieldTypeDescription
before?snowflakereturns threads before this id
limit?integeroptional maximum number of threads to return
Response Body
FieldTypeDescription
threadsarray of channel objectsthe private, archived threads the current user has joined
membersarray of thread members objectsa thread member object for each returned thread the current user has joined
has_morebooleanwhether there are potentially additional threads that could be returned on a subsequent call