Skip to content
Fluxer 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 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. Fluxer 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-Fluxer-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, Fluxer 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, Fluxer 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, Fluxer 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

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)
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
icon?stringThe hash of the role icon image, or null
unicode_emoji?stringThe Unicode emoji used as the role icon, or null

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, give it a hoist position or give it an icon.

A role has at most one of icon and unicode_emoji. Clients show the icon of a member's highest role that has one. An image icon is served by the Media Proxy at Get role icon.

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

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. Fluxer sends a Guild Role Create event.

FieldTypeDescription
X-Fluxer-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)
permissions?decimal string | integerThe permission mask, which defaults to the everyone role's mask
icon??base64 stringA PNG, JPEG, WebP or AVIF image for the role icon, or null to remove it
unicode_emoji??stringA single Unicode emoji for the role icon, or null to remove it
icon_source_role_id?snowflakeA role in this guild whose icon the new role copies

With icon_source_role_id, Fluxer stores a separate copy of an image icon. Deleting either role leaves the other's icon in place.

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
400error responseA role icon is not valid
400error responseROLE_ICON_SOURCE_AND_ICON_EXCLUSIVE when icon_source_role_id comes with icon or unicode_emoji
404error responseUNKNOWN_ROLE when icon_source_role_id is not a role in this guild
413error responseThe body is larger than a role icon allows

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. Fluxer sends a Guild Role Update event.

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

Fields you leave out keep their value. On the everyone role, Fluxer ignores every field except color, permissions, icon and unicode_emoji, and the last two can only be null.

FieldTypeDescription
name?stringThe name of the role (1-100 characters)
color?integerThe color of the role as an RGB integer (0-16777215)
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
icon??base64 stringA PNG, JPEG, WebP or AVIF image for the role icon, or null to remove it
unicode_emoji??stringA single Unicode emoji for the role icon, or null to remove it
StatusBodyCondition
200guild role objectThe role was modified
400error responseA role icon is not valid
413error responseThe body is larger than a role icon allows

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

Create guild role and Modify guild role take the same two icon fields.

BodyResult
field left outThe icon stays as it is
icon with an imageThe image is stored and unicode_emoji is cleared
unicode_emoji with an emojiThe emoji is stored and any image is cleared
icon set to nullThe image is cleared
unicode_emoji set to nullThe emoji is cleared
both non-null400 with ROLE_ICON_AND_EMOJI_EXCLUSIVE on icon
either non-null on the everyone role400 with CANNOT_SET_ICON_ON_EVERYONE_ROLE on that field

An image can't be animated, can be at most 256 KiB and each side must be between 32 and 1024 pixels. An image outside these limits returns 400 with IMAGE_SIZE_EXCEEDS_LIMIT, INVALID_IMAGE_FORMAT or IMAGE_DIMENSIONS_OUT_OF_RANGE, and an emoji that isn't a single Unicode emoji returns NOT_A_VALID_UNICODE_EMOJI. Role icons are free and need no guild feature. When an image is replaced or cleared, or the role is deleted, Fluxer deletes the old image later.

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. Fluxer sends a Guild Role Update Bulk event with the stored positions.

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