Skip to content
TEBHOS API

Roles and permissions

A permission lets a member do one thing in a guild, such as send a message or ban another member. Each role grants a set of permissions as a 64-bit mask, and a permission overwrite on a channel changes that set for one channel.

ValueNameDescription
1 << 0CREATE_INSTANT_INVITECreate an invite to a guild channel
1 << 1KICK_MEMBERSRemove a member from the guild
1 << 2BAN_MEMBERSBan and unban members
1 << 3ADMINISTRATORGrants every permission and ignores every channel overwrite
1 << 4MANAGE_CHANNELSCreate, modify, reorder and delete guild channels
1 << 5MANAGE_GUILDModify guild settings, invites, the vanity URL and discovery
1 << 6ADD_REACTIONSAdd a reaction to a message
1 << 7VIEW_AUDIT_LOGRead the guild audit log
1 << 8PRIORITY_SPEAKERUse priority speaker in a voice channel, enforced by the client
1 << 9STREAMShare your screen or camera in a voice channel
1 << 10VIEW_CHANNELView a channel
1 << 11SEND_MESSAGESSend messages, create forum posts and publish your own announcements
1 << 12SEND_TTS_MESSAGESSend a text-to-speech message
1 << 13MANAGE_MESSAGESDelete other members’ messages and reactions, bulk delete messages and edit other members’ message flags and attachments
1 << 14EMBED_LINKSHave links in your messages expanded into embeds
1 << 15ATTACH_FILESAttach files to a message
1 << 16READ_MESSAGE_HISTORYRead messages older than the guild’s message_history_cutoff, or any message when the guild has no cutoff
1 << 17MENTION_EVERYONEUse the everyone and here mentions
1 << 18USE_EXTERNAL_EMOJISUse emojis from other guilds
1 << 20CONNECTConnect to a voice channel
1 << 21SPEAKTalk in a voice channel
1 << 22MUTE_MEMBERSMute other members in a voice channel
1 << 23DEAFEN_MEMBERSDeafen other members in a voice channel
1 << 24MOVE_MEMBERSMove members between voice channels or disconnect them
1 << 25USE_VADUse voice activity detection, enforced by the client
1 << 26CHANGE_NICKNAMEChange your own nickname
1 << 27MANAGE_NICKNAMESChange other members’ nicknames
1 << 28MANAGE_ROLESManage roles below your highest role, assign them and set channel overwrites
1 << 29MANAGE_WEBHOOKSCreate, modify and delete webhooks and follow announcement channels
1 << 30MANAGE_EXPRESSIONSModify and delete emojis and stickers that other members created
1 << 34MANAGE_THREADS1Archive, lock, rename and delete threads and see every private thread
1 << 35CREATE_PUBLIC_THREADS1Start public and announcement threads
1 << 36CREATE_PRIVATE_THREADS1Start private threads
1 << 37USE_EXTERNAL_STICKERSUse stickers from other guilds
1 << 38SEND_MESSAGES_IN_THREADS1Send messages in threads and add members to them
1 << 40MODERATE_MEMBERSTime out members
1 << 43CREATE_EXPRESSIONSCreate emojis and stickers and edit or delete your own
1 << 51PIN_MESSAGESPin and unpin messages
1 << 52BYPASS_SLOWMODEIgnore the channel slowmode
1 << 53UPDATE_RTC_REGIONChange the voice region of a voice channel
1 << 54VIEW_CHANNEL_MEMBERS1View the member list of a channel
1 << 62MANAGE_ROOM_STAGERun the 3D room stage of a voice channel: a TV board or video, a host character, and effects

1 The bit is feature-gated. Thread permissions explains how the thread bits apply.

Responses send a permission mask as a decimal string. Requests accept a decimal string up to 9223372036854775807, or a JSON number that is a safe integer. Parse masks as unsigned 64-bit integers. TEBHOS drops any bit it doesn’t define.

You can only write a gated bit when your request declares the feature it needs, in the X-TEBHOS-Features header as a comma-separated list.

BitsWho can write them
VIEW_CHANNEL_MEMBERSA request that declares view_channel_members_permission
The four thread bitsA bot, or a user session that declares the channel_threads feature

When you can’t write a gated bit, TEBHOS keeps that bit at its stored value and writes the rest of the mask. A new role created with permissions starts with the bit cleared. One created without permissions copies the everyone role’s mask, gated bits included. Callers that can’t write the thread bits also don’t see them in role masks, overwrite masks or permissions values.

KICK_MEMBERS, BAN_MEMBERS, ADMINISTRATOR, MANAGE_CHANNELS, MANAGE_GUILD, MANAGE_MESSAGES, MANAGE_ROLES, MANAGE_WEBHOOKS, MODERATE_MEMBERS and MANAGE_THREADS are elevated. In a guild with the elevated MFA level, a member other than the owner needs two-factor authentication to use them, and gets 400 TWO_FACTOR_REQUIRED without it. Computed permissions values still include these bits.

The guild owner has every permission, and a user who isn’t a member has none. For anyone else, TEBHOS starts with the everyone role, whose ID is the guild ID, and adds every role the member has. If the result has ADMINISTRATOR, the member has every permission and no overwrite applies.

In a channel, TEBHOS then applies the channel’s overwrites in this order, removing denied bits before adding allowed bits at each step.

  1. The everyone role overwrite.
  2. The overwrites for the member’s roles, combined, where an allow on one role beats a deny on another.
  3. The member’s own overwrite.

A category is visible when you can view at least one channel in it. A thread has no overwrites of its own, and Thread permissions explains how its permissions work.

In a guild channel, a member whose communication_disabled_until is in the future keeps their permissions, but gets 403 COMMUNICATION_DISABLED when they try any of these.

  • Send, edit or publish their own message
  • Add a reaction or request an attachment upload
  • Start typing
  • Change their own nickname
  • Start, change or delete a thread, or add or remove its members
  • Pin or unpin a message in a thread
  • Set a voice room stage or show one of its effects

Check communication_disabled_until as well as the mask before you show these actions.

Roles rank by position, and your rank is the rank of your highest role. You can manage a role only when you rank above it, even with MANAGE_ROLES, and the guild owner can manage every role.

A role or overwrite write that grants a permission you don’t have fails with MISSING_PERMISSIONS, unless you’re the guild owner.

A role is a permission mask that a guild assigns to its members.

FieldTypeDescription
idsnowflakeThe ID of the role
namestringThe name of the role (1-100 characters)
colorintegerThe color of the role as an RGB integer (0-16777215)
color_secondary?1?integerThe second RGB color of a static gradient (0-16777215)
icon_emoji_id?1?snowflakeThe ID of the role icon, an emoji owned by this guild
positionintegerThe rank of the role, where a larger value ranks higher
hoist_position?integerThe position of the role’s group in the member list, or null to follow position
permissionsdecimal stringThe permission mask the role grants
hoistbooleanWhether the role’s members show as their own group in the member list
mentionablebooleanWhether members without MENTION_EVERYONE can mention the role
unicode_emoji?1?stringThe Unicode emoji shown beside the role name as its icon

1 Setting an icon needs the guild’s feature_role_icons limit, and setting a second color needs feature_role_gradient. A role keeps these values when the guild loses the limit, and you can still send them unchanged or clear them. A role can’t have both unicode_emoji and icon_emoji_id

The everyone role has the guild’s ID, is called @everyone and is always at position 0. You can change its color and permissions, but you can’t delete it, move it or give it a hoist position.

{
"id": "1489002177550843904",
"name": "Moderator",
"color": 3447003,
"position": 4,
"hoist_position": 1,
"permissions": "1099511637006",
"hoist": true,
"mentionable": false
}

One entry in a Modify guild role positions request.

FieldTypeDescription
idsnowflakeThe ID of the role
position?integerThe rank you want for the role, where a larger value ranks higher

One entry in a Modify role hoist positions request.

FieldTypeDescription
idsnowflakeThe ID of the role
hoist_positionintegerThe member list position to give the role
GET/v1/guilds/{guild_id}/rolesBotguilds

Returns every guild role object in the guild, highest position first. You need to be a member of the guild, and an OAuth2 token needs the guilds scope.

StatusBodyCondition
200array[guild role object]The roles were returned

The rate limit is 60 requests per 10 seconds, on the guild:role:list::guild_id bucket.

POST/v1/guilds/{guild_id}/rolesBotAudit reason

Creates a role at position 1 and returns its guild role object. You need MANAGE_ROLES. TEBHOS sends a Guild Role Create event.

FieldTypeDescription
X-TEBHOS-Features?stringA comma-separated feature declaration
FieldTypeDescription
namestringThe name of the role (1-100 characters)
color?integerThe color of the role as an RGB integer (0-16777215, default 0)
color_secondary??integerThe second RGB color of a gradient (0-16777215), or null
icon_emoji_id??snowflakeThe ID of an emoji owned by this guild to use as the icon, or null
unicode_emoji??stringOne Unicode emoji to use as the icon, or null
permissions?decimal string | integerThe permission mask, which defaults to the everyone role’s mask
StatusBodyCondition
200guild role objectThe role was created
400error responseMAX_GUILD_ROLES when the guild is at its role limit, 250 by default, counting the everyone role

The rate limit is 10 requests per minute, on the guild:role:create::guild_id bucket.

PATCH/v1/guilds/{guild_id}/roles/{role_id}BotAudit reason

Modifies a role and returns its guild role object. You need MANAGE_ROLES and must outrank the role. TEBHOS sends a Guild Role Update event.

FieldTypeDescription
X-TEBHOS-Features?stringA comma-separated feature declaration

Fields you leave out keep their value. On the everyone role, TEBHOS ignores every field except color and permissions.

FieldTypeDescription
name?stringThe name of the role (1-100 characters)
color?integerThe color of the role as an RGB integer (0-16777215)
color_secondary??integerThe second RGB color of a gradient (0-16777215), or null to clear it
icon_emoji_id??snowflakeThe ID of an emoji owned by this guild to use as the icon, or null to clear it
unicode_emoji??stringOne Unicode emoji to use as the icon, or null to clear it
permissions?decimal string | integerThe new permission mask, which replaces the old one
hoist?booleanWhether the role’s members show as their own group in the member list
hoist_position??integerThe member list position to give the role, or null to clear it
mentionable?booleanWhether members without MENTION_EVERYONE can mention the role
StatusBodyCondition
200guild role objectThe role was modified

The rate limit is 20 requests per 10 seconds, on the guild:role:update::guild_id bucket.

PATCH/v1/guilds/{guild_id}/rolesBotAudit reason

Reorders roles and returns 204. You need MANAGE_ROLES and must outrank every role whose position you change. TEBHOS sends a Guild Role Update Bulk event with the stored positions.

TEBHOS sorts the roles you can manage by the positions you send and keeps roles you can’t manage at their rank. It then renumbers every role except the everyone role from 1, so the stored position can differ from the one you sent.

An array of role position objects. The everyone role can’t be in it.

StatusBodyCondition
204emptyThe positions were applied
400error responseAn entry is the everyone role or a role that doesn’t exist
423error responseAnother position change is still running

The rate limit is 20 requests per 10 seconds, on the guild:role:positions::guild_id bucket.

PATCH/v1/guilds/{guild_id}/roles/hoist-positionsBotAudit reason

Sets the member list position of one or more roles and returns 204. You need MANAGE_ROLES and must outrank every role you name. TEBHOS sends a Guild Role Update Bulk event.

An array of role hoist position objects. The everyone role can’t be in it.

StatusBodyCondition
204emptyThe hoist positions were applied
400error responseAn entry is the everyone role or a role that doesn’t exist
423error responseAnother hoist position change is still running

The rate limit is 20 requests per 10 seconds, on the guild:role:hoist_positions::guild_id bucket.

DELETE/v1/guilds/{guild_id}/roles/hoist-positionsBotAudit reason

Clears the member list position of every role in the guild, including roles you don’t outrank, and returns 204. You need MANAGE_ROLES. TEBHOS sends a Guild Role Update Bulk event.

StatusBodyCondition
204emptyThe hoist positions were cleared
423error responseAnother hoist position change is still running

The rate limit is 10 requests per minute, on the guild:role:hoist_positions_reset::guild_id bucket.

DELETE/v1/guilds/{guild_id}/roles/{role_id}BotAudit reason

Deletes a role, removes it from every member who has it and returns 204. You need MANAGE_ROLES and must outrank the role. You can’t delete the everyone role. TEBHOS sends a Guild Role Delete event.

StatusBodyCondition
204emptyThe role was deleted

The rate limit is 10 requests per minute, on the guild:role:delete::guild_id bucket.