API reference
Roles
Roles and their permissions.
Get Guild Roles
/guilds/{guild.id}/rolesPeople and botsAll roles, highest first. The @everyone role has the server's id.
Path parameters
guild.id- A snowflake id.
Response
200 a list of APIRole
[
{
"id": "107441200000000400",
"name": "Moderator",
"color": 3447003,
"colors": {
"primary_color": 3447003,
"secondary_color": null,
"tertiary_color": null
},
"icon": null,
"unicode_emoji": null,
"flags": 0,
"hoist": true,
"position": 2,
"permissions": "1099511627776",
"managed": false,
"mentionable": true
},
{
"id": "107441200000000301",
"name": "groove",
"color": 0,
"colors": {
"primary_color": 0,
"secondary_color": null,
"tertiary_color": null
},
"icon": null,
"unicode_emoji": null,
"flags": 0,
"hoist": false,
"position": 1,
"permissions": "3147776",
"managed": true,
"tags": {
"bot_id": "107441200000000300"
},
"mentionable": false
}
]
Errors
UNKNOWN_GUILD10004 · HTTP 404- The server does not exist, or you are not in it.
Discord
The same as Discord’s Get Guild Roles.
Create Guild Role
/guilds/{guild.id}/rolesPeople and botsMake a role. It starts at position 1, below all others.
You can only give a role permissions you hold yourself.
Permissions needed
MANAGE_ROLESbit 268435456- Manage roles
Path parameters
guild.id- A snowflake id.
Body
application/json
namestring · 1 to 100 characters · default "new role"permissionsstring- A decimal bitfield; none by default.
colorinteger · 0 to 16777215 · default 0- An RGB integer.
hoistboolean · default falsementionableboolean · default false
Example request
{
"name": "Moderator",
"color": 3447003,
"hoist": true
}
Response
201 APIRole
{
"id": "107441200000000400",
"name": "Moderator",
"color": 3447003,
"colors": {
"primary_color": 3447003,
"secondary_color": null,
"tertiary_color": null
},
"icon": null,
"unicode_emoji": null,
"flags": 0,
"hoist": true,
"position": 2,
"permissions": "1099511627776",
"managed": false,
"mentionable": true
}
Errors
UNKNOWN_GUILD10004 · HTTP 404- The server does not exist, or you are not in it.
MISSING_PERMISSIONS50013 · HTTP 403- You lack a permission the route needs.
INVALID_FORM_BODY50035 · HTTP 400- A field is missing, the wrong type or outside its limits.
MAX_ROLES30005 · HTTP 400- The server has 250 roles.
Gateway events it causes
Discord
Like Discord’s Create Guild Role, with differences.
One colour (color); no icon or unicode emoji.
Modify Guild Role Positions
/guilds/{guild.id}/rolesPeople and botsReorder roles. Answers every role.
Permissions needed
MANAGE_ROLESbit 268435456- Manage roles
Path parameters
guild.id- A snowflake id.
Body
application/json
{
"minItems": 1,
"maxItems": 250,
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"position": {
"type": "integer",
"minimum": 0,
"maximum": 250
}
},
"required": [
"id",
"position"
]
}
}
Example request
[
{
"id": "107441200000000400",
"position": 2
}
]
Response
200 a list of APIRole
[
{
"id": "107441200000000400",
"name": "Moderator",
"color": 3447003,
"colors": {
"primary_color": 3447003,
"secondary_color": null,
"tertiary_color": null
},
"icon": null,
"unicode_emoji": null,
"flags": 0,
"hoist": true,
"position": 2,
"permissions": "1099511627776",
"managed": false,
"mentionable": true
}
]
Errors
UNKNOWN_GUILD10004 · HTTP 404- The server does not exist, or you are not in it.
MISSING_PERMISSIONS50013 · HTTP 403- The role is above your highest role.
UNKNOWN_ROLE10011 · HTTP 404- There is no such role in the server.
Gateway events it causes
Discord
The same as Discord’s Modify Guild Role Positions.
Modify Guild Role
/guilds/{guild.id}/roles/{role.id}People and botsChange a role's name, colour, permissions or whether it is shown apart.
A bot's managed role can be edited and reordered like any role: editing it is how you change what the bot may do.
Permissions needed
MANAGE_ROLESbit 268435456- Manage roles
Path parameters
guild.id- A snowflake id.
role.id- A snowflake id.
Body
application/json
namestring · 1 to 100 characterspermissionsstringcolorinteger · 0 to 16777215hoistbooleanmentionableboolean
Example request
{
"name": "Mods"
}
Response
200 APIRole
{
"id": "107441200000000400",
"name": "Moderator",
"color": 3447003,
"colors": {
"primary_color": 3447003,
"secondary_color": null,
"tertiary_color": null
},
"icon": null,
"unicode_emoji": null,
"flags": 0,
"hoist": true,
"position": 2,
"permissions": "1099511627776",
"managed": false,
"mentionable": true
}
Errors
UNKNOWN_GUILD10004 · HTTP 404- The server does not exist, or you are not in it.
MISSING_PERMISSIONS50013 · HTTP 403- The role is not below your highest role, or you lack a permission you tried to give.
UNKNOWN_ROLE10011 · HTTP 404- There is no such role in the server.
INVALID_FORM_BODY50035 · HTTP 400- A field is missing, the wrong type or outside its limits.
Gateway events it causes
Discord
Like Discord’s Modify Guild Role, with differences.
One colour; no icon.
Delete Guild Role
/guilds/{guild.id}/roles/{role.id}People and botsDelete a role. A bot's managed role cannot be deleted while the bot is in the server.
Permissions needed
MANAGE_ROLESbit 268435456- Manage roles
Path parameters
guild.id- A snowflake id.
role.id- A snowflake id.
Response
204 no body
Errors
UNKNOWN_GUILD10004 · HTTP 404- The server does not exist, or you are not in it.
MISSING_PERMISSIONS50013 · HTTP 403- You lack a permission the route needs.
UNKNOWN_ROLE10011 · HTTP 404- There is no such role in the server.
INVALID_ROLE50028 · HTTP 400- The role is a bot's managed role and the bot is still in the server.
Gateway events it causes
Discord
The same as Discord’s Delete Guild Role.