Edit a Discord guild role
Updates a role's name, color, hoist, mentionable flag, or permission bitfield. At least one field must be supplied. Omitted fields are left unchanged.
Requires the bot to hold Manage Roles, and the target role must sit below the bot's highest role. See the create-role operation for the re-invite requirement.
API key authentication - use your Zernio API key as a Bearer token
In: header
Path Parameters
Discord guild snowflake ID
Discord role snowflake ID
Query Parameters
SocialAccount _id of the Discord account bound to this guild
1 <= length <= 1000 <= value <= 16777215Permissions bitfield as a stringified integer
Response Body
application/json
application/json
import Zernio from '@zernio/node';const zernio = new Zernio({ apiKey: process.env.ZERNIO_API_KEY });const { data } = await zernio.discord.editDiscordGuildRole({ path: { guildId: 'guild_abc123', roleId: 'role_abc123', }, query: { accountId: 'account_abc123', }, body: { name: 'Example', color: 0, hoist: false, },});console.log(data);{
"data": {
"id": "string",
"name": "string",
"color": 0,
"position": 0,
"permissions": "string",
"managed": true,
"mentionable": true,
"hoist": true
}
}{
"error": "Unauthorized"
}Create a Discord guild role POST
Creates a new role in the guild. Requires the bot to hold the Manage Roles permission. Guilds that added the Zernio bot before role management shipped must re-invite it, because Discord applies the permission set at invite time. Discord's role hierarchy applies: the bot cannot create a role positioned at or above its own highest role, and cannot grant permissions it does not itself hold. Either attempt returns a 403 carrying Discord's own error.
Delete a Discord guild role DELETE
Permanently deletes a role from the guild and removes it from every member. This cannot be undone. Requires the bot to hold Manage Roles, and the target role must sit below the bot's highest role.