Zernio
Zernio
API Reference

Discord

Settings

Get Discord account settingsGETUpdate Discord settingsPATCHList Discord guild channelsGET

Messaging

Send a Discord Direct MessagePOSTList pinned messagesGETPin a Discord messagePUTUnpin a Discord messageDELETECreate a Discord public threadPOSTCrosspost Discord messagePOSTDelete a Discord channel messageDELETE

Roles & Members

List Discord guild rolesGETCreate a Discord guild rolePOSTEdit a Discord guild rolePATCHDelete a Discord guild roleDELETEList Discord guild membersGETSearch Discord guild membersGETGet a Discord guild memberGETAssign a role to a guild memberPUTRemove a role from a guild memberDELETE

Scheduled Events

List Discord scheduled eventsGETCreate a Discord scheduled eventPOSTGet a Discord scheduled eventGETUpdate a Discord scheduled eventPATCHDelete a Discord scheduled eventDELETE
Dashboard
llms.txtOpenAPI
OverviewPlatformsAPI ReferenceResources
Discord

Create a Discord guild role

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.


POST
/v1/discord/guilds/{guildId}/roles

Authorization

bearerAuth
AuthorizationBearer <token>

API key authentication: send your Zernio API key in the Authorization header, prefixed with Bearer.

In: header

Path Parameters

guildId*string

Discord guild snowflake ID

Query Parameters

accountId*string

SocialAccount _id of the Discord account bound to this guild

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

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.createDiscordGuildRole({  path: {    guildId: 'guild_abc123',  },  query: {    accountId: 'account_abc123',  },  body: {    name: 'Example',  },});console.log(data);
{  "data": {    "id": "string",    "name": "string",    "color": 0,    "position": 0,    "permissions": "string",    "managed": true,    "mentionable": true,    "hoist": true  }}
Was this page helpful?

List Discord guild roles

Returns all roles in a Discord guild. Useful for building role-mention pickers, role-permission UIs, or finding the role ID before calling the role-assign endpoint. Roles are returned unordered. Sort client-side by `position` if you need Discord's UI ordering. Caller must pass `accountId` of a Discord SocialAccount bound to this guild (route verifies team access + guild match).

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.

name*string
Length1 <= length <= 100
color?integer

Decimal color (0 = no color). 0xFF0000 red is 16711680.

Range0 <= value <= 16777215
hoist?boolean

Display members with this role separately in the member list

mentionable?boolean

Allow anyone to @mention this role

permissions?string

Permissions bitfield as a stringified integer