Roles and permissions
How permissions are calculated
- The server owner can do everything.
- Otherwise start from the server's default permissions (
@everyone). - Add the permissions of every role the member has (
allow), then remove what roles deny, from the lowest to the highest ranked role. - In a channel, apply the channel's default override, then the role overrides, the same way.
- A member in timeout keeps only View Channel and Read Message History.
Permissions are a 64-bit number; each permission is one bit. Use BigInt in JavaScript: a plain number cannot hold every bit exactly.
const SEND_MESSAGE = 1n << 22n;
const canSend =
(BigInt(interaction.user_permissions_string) & SEND_MESSAGE) === SEND_MESSAGE;Every interaction tells you the permissions of the person who used it (user_permissions_string) and of your bot (app_permissions_string) in that channel, so you rarely need to compute them yourself.
Permission strings
Endpoints in this reference name permissions such as Timeout Members. In an error the same permission is written TimeoutMembers, the first column of the table below. Add values to send several: Kick Members (64) and Ban Members (128) are 192.
Threads and forums
CreateThreads, SendMessageInThreads and CreateForumPosts are on for @everyone by default. Deny them on a role, or on a channel, and those people can only read. They are read on the parent channel, on top of Send Messages.
Ranking
Roles have a rank; a lower number ranks higher. A bot can only edit, give, take, kick, ban or time out members and roles that rank below its own highest role. Otherwise the server answers NotElevated. Ask server admins to move your bot's role up if your bot moderates.
Permission bits
| Permission | Bit | Value | |
|---|---|---|---|
ManageChannel | 0 | 1 | Manage the channel or channels on the server |
ManageServer | 1 | 2 | Manage the server |
ManagePermissions | 2 | 4 | Manage permissions on servers or channels |
ManageRole | 3 | 8 | Manage roles on server |
ManageCustomisation | 4 | 16 | Manage server customisation (includes emoji) |
KickMembers | 6 | 64 | Kick other members below their ranking |
BanMembers | 7 | 128 | Ban other members below their ranking |
TimeoutMembers | 8 | 256 | Timeout other members below their ranking |
AssignRoles | 9 | 512 | Assign roles to members below their ranking |
ChangeNickname | 10 | 1024 | Change own nickname |
ManageNicknames | 11 | 2048 | Change or remove other's nicknames below their ranking |
ChangeAvatar | 12 | 4096 | Change own avatar |
RemoveAvatars | 13 | 8192 | Remove other's avatars below their ranking |
ViewChannel | 20 | 1048576 | View a channel |
ReadMessageHistory | 21 | 2097152 | Read a channel's past message history |
SendMessage | 22 | 4194304 | Send a message in a channel |
ManageMessages | 23 | 8388608 | Delete messages in a channel |
ManageWebhooks | 24 | 16777216 | Manage webhook entries on a channel |
InviteOthers | 25 | 33554432 | Create invites to this channel |
SendEmbeds | 26 | 67108864 | Send embedded content in this channel |
UploadFiles | 27 | 134217728 | Send attachments and media in this channel |
Masquerade | 28 | 268435456 | Masquerade messages using custom nickname and avatar |
React | 29 | 536870912 | React to messages with emojis |
Connect | 30 | 1073741824 | Connect to a voice channel |
Speak | 31 | 2147483648 | Speak in a voice call |
Video | 32 | 4294967296 | Share video in a voice call |
MuteMembers | 33 | 8589934592 | Mute other members with lower ranking in a voice call |
DeafenMembers | 34 | 17179869184 | Deafen other members with lower ranking in a voice call |
MoveMembers | 35 | 34359738368 | Move members between voice channels |
Listen | 36 | 68719476736 | Listen to other users |
MentionEveryone | 37 | 137438953472 | Mention everyone and online members |
MentionRoles | 38 | 274877906944 | Mention roles |
BypassSlowmode | 39 | 549755813888 | Bypass slowmode |
ViewAuditLogs | 40 | 1099511627776 | Access server audit logs |
UseExternalEmojis | 41 | 2199023255552 | Allow external emoji usage |
ManageJoinRequests | 42 | 4398046511104 | (never in the default permissions; the owner grants it to roles) |
CreateThreads | 43 | 8796093022208 | Start a thread in a text channel |
SendMessageInThreads | 44 | 17592186044416 | Write in threads and in forum posts (a forum post is a thread) |
CreateForumPosts | 45 | 35184372088832 | Start a post in a forum |
Administrator | 46 | 70368744177664 | Every right in every channel of the server, whatever its overrides say |
UseSoundboard | 47 | 140737488355328 | Play the server's soundboard sounds in a voice call |
ManageSoundboard | 48 | 281474976710656 | Add, change and remove the server's soundboard sounds |
Reference
PUT /channels/{target}/permissions/{role_id}
Set Role Permission. Sets permissions for the specified role in this channel.
Channel must be a TextChannel.
Permissions: Channel:ManagePermissions · Rate limit: channels, 15 / 10 s
PUT /channels/{target}/permissions/default
Set Default Permission. Sets permissions for the default role in this channel.
Channel must be a Group or TextChannel. A channel synced with its category stops following it: it keeps a copy of the category's permissions and the change applies on top.
Permissions: Channel:ManagePermissions · Rate limit: channels, 15 / 10 s
PUT /channels/{target}/permissions/members/{user_id}
Set Member Permission. Sets one member's permissions in this channel, applied after every role (for example a ticket only its author and the staff can see). An empty override (allow 0, deny 0) removes it.
Channel must be a TextChannel. Needs Manage Permissions in the channel, a higher rank than the member, and only the permissions you hold yourself.
Permissions: Channel:ManagePermissions · Rate limit: channels, 15 / 10 s
POST /channels/{target}/permissions/sync
Sync Permissions With Category. The channel follows its category's permissions again; its own default and role overrides are cleared. Per-member overrides stay.
Permissions: Channel:ManagePermissions · Rate limit: channels, 15 / 10 s
PUT /servers/{target}/categories/{category_id}/permissions/{role_id}
Set Category Role Permission. Sets a role's permissions for a category. Channels synced with the category use them instead of their own. An empty override removes it.
Rate limit: servers, 5 / 10 s
PUT /servers/{target}/categories/{category_id}/permissions/default
Set Category Default Permission. Sets the default permissions for a category. Channels synced with the category use them instead of their own.
Rate limit: servers, 5 / 10 s
PUT /servers/{target}/permissions/{role_id}
Set Role Permission. Sets permissions for the specified role in the server.
Permissions: Channel:ManagePermissions · Rate limit: servers, 5 / 10 s
PUT /servers/{target}/permissions/default
Set Default Permission. Sets permissions for the default role in this server.
Permissions: Channel:ManagePermissions · Rate limit: servers, 5 / 10 s
POST /servers/{target}/roles
Create Role. Creates a new server role.
Permissions: Channel:ManageRole · Rate limit: servers, 5 / 10 s
DELETE /servers/{target}/roles/{role_id}
Delete Role. Delete a server role by its id.
Permissions: Channel:ManageRole · Rate limit: servers, 5 / 10 s
GET /servers/{target}/roles/{role_id}
Fetch Role. Fetch a role by its id.
Rate limit: servers, 5 / 10 s
PATCH /servers/{target}/roles/{role_id}
Edit Role. Edit a role by its id.
Permissions: Channel:ManageRole · Rate limit: servers, 5 / 10 s
PATCH /servers/{target}/roles/ranks
Edits server roles ranks. Edit's server role's ranks.
Permissions: Channel:ManageRole · Rate limit: servers, 5 / 10 s