Skip to content

Users

Endpoints for retrieving Discord user profile information.

Get User Profile

Retrieve a user’s profile information.

GET /api/users/:userId

Parameters

ParameterTypeDescription
userIdstringDiscord user ID

Response

{
"id": "user123",
"username": "developer_dave",
"globalName": "Dave the Developer",
"avatar": "abc123def456",
"banner": "banner789",
"accentColor": 5814783,
"isBot": false,
"badges": ["verified_developer", "early_supporter"],
"premiumType": "Nitro"
}

Response Fields

FieldTypeDescription
idstringDiscord user ID
usernamestringUsername (without discriminator)
globalNamestring | nullDisplay name
avatarstring | nullAvatar hash
bannerstring | nullBanner hash (Nitro users)
accentColornumber | nullProfile accent color
isBotbooleanWhether user is a bot
badgesstring[]Profile badges
premiumTypestring | nullNitro subscription type

Badge Values

BadgeDescription
staffDiscord Employee
partnerDiscord Partner
hypesquadHypeSquad Events member
bug_hunter_level_1Bug Hunter Level 1
bug_hunter_level_2Bug Hunter Level 2
hypesquad_braveryHypeSquad Bravery
hypesquad_brillianceHypeSquad Brilliance
hypesquad_balanceHypeSquad Balance
early_supporterEarly Nitro Supporter
verified_developerVerified Bot Developer
active_developerActive Developer
certified_moderatorDiscord Certified Moderator

Premium Types

ValueDescription
nullNo Nitro
Nitro ClassicNitro Classic
NitroFull Nitro
Nitro BasicNitro Basic

Example

Terminal window
curl http://localhost:3000/api/users/123456789012345678

Errors

StatusCodeDescription
404NOT_FOUNDUser not found (never synced)

Avatar URLs

Construct avatar URLs using the avatar hash:

Default Avatar

function getDefaultAvatar(userId) {
// Discord uses (userId >> 22) % 6 for default avatar index
const index = (BigInt(userId) >> 22n) % 6n;
return `https://cdn.discordapp.com/embed/avatars/${index}.png`;
}

Custom Avatar

function getAvatarUrl(user, size = 128) {
if (!user.avatar) {
return getDefaultAvatar(user.id);
}
const ext = user.avatar.startsWith('a_') ? 'gif' : 'png';
return `https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}.${ext}?size=${size}`;
}

Available Sizes

Valid size values: 16, 32, 64, 128, 256, 512, 1024, 2048, 4096


For users with Nitro who have set a banner:

function getBannerUrl(user, size = 600) {
if (!user.banner) return null;
const ext = user.banner.startsWith('a_') ? 'gif' : 'png';
return `https://cdn.discordapp.com/banners/${user.id}/${user.banner}.${ext}?size=${size}`;
}

Accent Color

The accent color is stored as a decimal integer. Convert to hex:

function getAccentColorHex(user) {
if (!user.accentColor) return null;
return '#' + user.accentColor.toString(16).padStart(6, '0');
}
// Example: 5814783 -> "#58a6ff"

Common Patterns

User Profile Card

function UserProfile({ user }) {
const avatarUrl = getAvatarUrl(user, 256);
const bannerUrl = getBannerUrl(user);
const accentColor = getAccentColorHex(user);
return (
<div className="profile-card">
{bannerUrl ? (
<img className="banner" src={bannerUrl} alt="" />
) : accentColor ? (
<div className="banner" style={{ background: accentColor }} />
) : null}
<img className="avatar" src={avatarUrl} alt={user.username} />
<div className="info">
<h2>{user.globalName || user.username}</h2>
<span className="username">@{user.username}</span>
{user.badges.length > 0 && (
<div className="badges">
{user.badges.map(badge => (
<BadgeIcon key={badge} badge={badge} />
))}
</div>
)}
</div>
</div>
);
}

Badge Icons

const BADGE_ICONS = {
staff: '/badges/staff.svg',
partner: '/badges/partner.svg',
hypesquad: '/badges/hypesquad.svg',
bug_hunter_level_1: '/badges/bug_hunter.svg',
bug_hunter_level_2: '/badges/bug_hunter_gold.svg',
hypesquad_bravery: '/badges/bravery.svg',
hypesquad_brilliance: '/badges/brilliance.svg',
hypesquad_balance: '/badges/balance.svg',
early_supporter: '/badges/early_supporter.svg',
verified_developer: '/badges/verified_developer.svg',
active_developer: '/badges/active_developer.svg',
certified_moderator: '/badges/certified_moderator.svg',
};
function BadgeIcon({ badge }) {
const icon = BADGE_ICONS[badge];
if (!icon) return null;
return (
<img
className="badge"
src={icon}
alt={badge.replace(/_/g, ' ')}
title={badge.replace(/_/g, ' ')}
/>
);
}

Mini User Display

function UserMini({ user }) {
return (
<div className="user-mini">
<img src={getAvatarUrl(user, 32)} alt="" />
<span>{user.globalName || user.username}</span>
{user.isBot && <span className="bot-tag">BOT</span>}
</div>
);
}

CSS Example

.profile-card {
width: 300px;
background: #292b2f;
border-radius: 8px;
overflow: hidden;
}
.profile-card .banner {
width: 100%;
height: 100px;
object-fit: cover;
}
.profile-card .avatar {
width: 80px;
height: 80px;
border-radius: 50%;
border: 6px solid #292b2f;
margin: -40px auto 0;
display: block;
}
.profile-card .info {
padding: 16px;
text-align: center;
}
.profile-card h2 {
color: white;
margin: 0;
}
.profile-card .username {
color: #b9bbbe;
}
.profile-card .badges {
display: flex;
gap: 4px;
justify-content: center;
margin-top: 8px;
}
.profile-card .badge {
width: 24px;
height: 24px;
}
.bot-tag {
background: #5865f2;
color: white;
font-size: 10px;
padding: 2px 4px;
border-radius: 3px;
font-weight: 600;
}