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.

Avatar Data

Avatar data is a Data URI scheme that supports JPG, GIF, and PNG formats. An example Data URI format is:
data:image/jpeg;base64,BASE64_ENCODED_JPEG_IMAGE_DATA
Ensure you use the proper header type (image/jpeg, image/png, image/gif) that matches the image data being provided.

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. Names must be between 2 and 32 characters long.
  3. Names cannot contain the following substrings: '@', '#', ':', '```'.
  4. Names cannot be: 'discordtag', 'everyone', 'here'.
  5. Names are sanitized and trimmed of leading, trailing, and exessive internal whitespace.
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
avatarstringthe user's avatar hashidentify
bot?boolwhether the user belongs to an OAuth2 applicationidentify
mfa_enabled?boolwhether the user has two factor enabled on their accountidentify
verified?boolwhether the email on this account has been verifiedemail
email?stringthe user's emailemail
Example User
{
    "id": "80351110224678912",
    "username": "Nelly",
    "discriminator": "1337",
    "avatar": "8342729096ea3675442027381ff50dfe",
    "verified": true,
    "email": "[email protected]"
}

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)
revokedboolwhether the connection is revoked
integrationsarrayan array of partial server integrations

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
usernamestringusers username, if changed may cause the users discriminator to be randomized.
avataravatar 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
{
    "id": "80351110224678912",
    "name": "1337 Krew",
    "icon": "8342729096ea3675442027381ff50dfe",
    "owner": true,
    "permissions": 36953089
}
This endpoint returns 100 guilds by default, which is the maximum number of guilds a non-bot user can join. Therefore, pagination is not needed for integrations that need to get a list of users' guilds.
Query String Params
FieldTypeDescriptionRequiredDefault
beforesnowflakeget guilds before this guild IDfalseabsent
aftersnowflakeget guilds after this guild IDfalseabsent
limitintegermax number of guilds to return (1-100)false100

Leave Guild

DELETE/users/@me/guilds/{guild.id}
Leave a guild. Returns a 204 empty response on success.

Get User DMs

GET/users/@me/channels
Returns a list of DM channel objects.

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.
By default this endpoint is limited to 10 active group DMs. These limits are raised for whitelisted GameBridge applications.
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.