K
Docs
API ReferencePiecesAdd Role
🎖️

Add Role

base.role.addBase SetUser

Hands out a Discord role to a user. Perfect for level-up rewards, verifications, unlock systems, or any time someone earns access to something. The bot needs Manage Roles permission for this to work.

When to use this
  • Get a Role ID by right-clicking a role in Server Settings → Copy ID
  • Hook up the Error port — the bot can't add roles higher than its own in the hierarchy

On the canvas

This is what Add Role looks like when you place it on your flow. Each field below is something you configure in the inspector panel.

🎖️
Add Role
base.role.add
User
userIdrequired
{{user.id}}
roleIdrequired
123456789012345
output
error

Config fields

FieldTypeReqWhat it does
userId
{{user.id}}
textyesWho to give it to 👤
roleId
123456789012345
textyesWhich role (ID) 🎖️

Output ports

outputRole added, moving on
errorCouldn't add the role — wrong ID, bot lacks permission, etc.
📐

In TypeScript, this would be…

Not something you need to write — just a look at what Kitcord does for you.

TypeScript
try {
  const member = await guild.members.fetch(userId);
  await member.roles.add(roleId);
} catch {
  // Error port — hierarchy or invalid role
}