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

Assign a role to a guild member

Assign one role to one member. Idempotent on Discord's side: re-running on a member who already has the role is a 204 no-op.

Path shape mirrors Discord's own API (PUT /guilds/{guild}/members/{user}/roles/{role}) for zero-translation mental mapping.

Bot needs MANAGE_ROLES permission in the guild AND its highest role must be above the target role (Discord hierarchy rule). The @everyone role (where roleId == guildId) cannot be assigned.


PUT
/v1/discord/guilds/{guildId}/members/{userId}/roles/{roleId}

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
userId*string

Discord user snowflake to assign the role to.

roleId*string

Query Parameters

accountId*string

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.addDiscordMemberRole({  path: {    guildId: 'guild_abc123',    userId: 'user_abc123',    roleId: 'role_abc123',  },  query: {    accountId: 'account_abc123',  },});console.log(data);
{  "success": true,  "operation": "role_assigned",  "guildId": "string",  "userId": "string",  "roleId": "string"}
Was this page helpful?

Get a Discord guild member

Fetch a single guild member by Discord user id. Cheaper than paginating the full member listing when you already know who you are looking for.

Remove a role from a guild member

Remove one role from one member. Idempotent: removing a role the member doesn't have returns 204 no-op. Same permission + hierarchy constraints as the PUT counterpart.