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.
API key authentication - use your Zernio API key as a Bearer token
In: header
Path Parameters
Discord user snowflake to assign the role to.
Query Parameters
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"
}{
"error": "Unauthorized"
}List Discord guild members GET
Cursor-paginated list of guild members. Returns Discord's raw member objects so callers can build community-ops automation (e.g. "add role to all members joined in the last 7 days") on the actual platform shape. **Important:** this endpoint requires the privileged "Server Members Intent" enabled on the Discord app (Developer Portal → Bot tab → toggle "Server Members Intent" ON, then Save). Without it, Discord returns an empty array with no error. Verify the intent is enabled before relying on this endpoint. Pagination: pass `after` = the last `user.id` from the previous page. Omit on the first call. Response includes a `nextCursor` and `hasMore` flag so callers don't need to know Discord's pagination shape.
Remove a role from a guild member DELETE
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.