Users Resource

Users in Discord are generally considered the base entity. Users can spawn across the entire platform, be members of guilds, participate in text and voice chat, and much more. Users are separated by a distinction of "bot" vs "normal." Although they are similar, bot users are automated users that are "owned" by another user. Unlike normal users, bot users do not have a limitation on the number of Guilds they can be a part of.

Usernames and Nicknames

Discord enforces the following restrictions for usernames and nicknames:

  1. Names can contain most valid unicode characters. We limit some zero-width and non-rendering characters.
  2. Usernames must be between 2 and 32 characters long.
  3. Nicknames must be between 1 and 32 characters long.
  4. Names are sanitized and trimmed of leading, trailing, and excessive internal whitespace.

The following restrictions are additionally enforced for usernames:

  1. Names cannot contain the following substrings: '@', '#', ':', '```'.
  2. Names cannot be: 'discordtag', 'everyone', 'here'.

There are other rules and restrictions not shared here for the sake of spam and abuse mitigation, but the majority of users won't encounter them. It's important to properly handle all error messages returned by Discord when editing or updating names.

User Object

User Structure
FieldTypeDescriptionRequired OAuth2 Scope
idsnowflakethe user's ididentify
usernamestringthe user's username, not unique across the platformidentify
discriminatorstringthe user's 4-digit discord-tagidentify
avatar?stringthe user's avatar hashidentify
bot?booleanwhether the user belongs to an OAuth2 applicationidentify
system?booleanwhether the user is an Official Discord System user (part of the urgent message system)identify
mfa_enabled?booleanwhether the user has two factor enabled on their accountidentify
banner??stringthe user's banner hashidentify
accent_color??integerthe user's banner color encoded as an integer representation of hexadecimal color codeidentify
locale?stringthe user's chosen language optionidentify
verified?booleanwhether the email on this account has been verifiedemail
email??stringthe user's emailemail
flags?integerthe flags on a user's accountidentify
premium_type?integerthe type of Nitro subscription on a user's accountidentify
public_flags?integerthe public flags on a user's accountidentify
Example User
json
{
"id": "80351110224678912",
"username": "Nelly",
"discriminator": "1337",
"avatar": "8342729096ea3675442027381ff50dfe",
"verified": true,
"email": "nelly@discord.com",
"flags": 64,
"banner": "06c16474723fe537c283b8efa61a30c8",
"accent_color": 16711680,
"premium_type": 1,
"public_flags": 64
}
User Flags
ValueDescription
0None
1 << 0Discord Employee
1 << 1Partnered Server Owner
1 << 2HypeSquad Events
1 << 3Bug Hunter Level 1
1 << 6House Bravery
1 << 7House Brilliance
1 << 8House Balance
1 << 9Early Supporter
1 << 10Team User
1 << 14Bug Hunter Level 2
1 << 16Verified Bot
1 << 17Early Verified Bot Developer
1 << 18Discord Certified Moderator
Premium Types

Premium types denote the level of premium a user has. Visit the Nitro page to learn more about the premium plans we currently offer.

ValueName
0None
1Nitro Classic
2Nitro

Connection Object

The connection object that the user has attached.

Connection Structure
FieldTypeDescription
idstringid of the connection account
namestringthe username of the connection account
typestringthe service of the connection (twitch, youtube)
revoked?booleanwhether the connection is revoked
integrations?arrayan array of partial server integrations
verifiedbooleanwhether the connection is verified
friend_syncbooleanwhether friend sync is enabled for this connection
show_activitybooleanwhether activities related to this connection will be shown in presence updates
visibilityintegervisibility of this connection
Visibility Types
ValueNameDescription
0Noneinvisible to everyone except the user themselves
1Everyonevisible to everyone

Endpoints

Get Current User

GET/users/@me

Returns the user object of the requester's account. For OAuth2, this requires the identify scope, which will return the object without an email, and optionally the email scope, which returns the object with an email.

Get User

GET/users/{user.id}

Returns a user object for a given user ID.

Modify Current User

PATCH/users/@me

Modify the requester's user account settings. Returns a user object on success.

JSON Params
FieldTypeDescription
usernamestringuser's username, if changed may cause the user's discriminator to be randomized.
avatar?image dataif passed, modifies the user's avatar

Get Current User Guilds

GET/users/@me/guilds

Returns a list of partial guild objects the current user is a member of. Requires the guilds OAuth2 scope.

Example Partial Guild
json
{
"id": "80351110224678912",
"name": "1337 Krew",
"icon": "8342729096ea3675442027381ff50dfe",
"owner": true,
"permissions": "36953089",
"features": ["COMMUNITY", "NEWS"]
}
Query String Params
FieldTypeDescriptionRequiredDefault
beforesnowflakeget guilds before this guild IDfalseabsent
aftersnowflakeget guilds after this guild IDfalseabsent
limitintegermax number of guilds to return (1-200)false200

Leave Guild

DELETE/users/@me/guilds/{guild.id}

Leave a guild. Returns a 204 empty response on success.

Create DM

POST/users/@me/channels

Create a new DM channel with a user. Returns a DM channel object.

JSON Params
FieldTypeDescription
recipient_idsnowflakethe recipient to open a DM channel with

Create Group DM

POST/users/@me/channels

Create a new group DM channel with multiple users. Returns a DM channel object. This endpoint was intended to be used with the now-deprecated GameBridge SDK. DMs created with this endpoint will not be shown in the Discord client

JSON Params
FieldTypeDescription
access_tokensarray of stringsaccess tokens of users that have granted your app the gdm.join scope
nicksdicta dictionary of user ids to their respective nicknames

Get User Connections

GET/users/@me/connections

Returns a list of connection objects. Requires the connections OAuth2 scope.