Перейти к содержимому

Current user

These routes get and change the account that made the request, a user object. Every route except Get current user needs a user session and doesn’t accept bot or OAuth2 tokens. Changing credentials and the account lifecycle routes need sudo mode.

The guild an account joined or is visiting after signing up with an invite.

FieldTypeDescription
guild_idsnowflakeThe guild the account entered
modestringmember when the account joined, visit when it is visiting without joining
FieldTypeDescription
useruser objectThe updated account
entry?guild entry objectThe guild to open next, or null
FieldTypeDescription
code_expires_atISO8601 timestampWhen the emailed code stops working, 10 minutes after sending
resend_available_atISO8601 timestampWhen another code can be requested, 30 seconds after sending
FieldTypeDescription
next_stepstringconfirm_email when the emailed code still has to be entered, otherwise none
useruser objectThe updated account
code_expires_at?1ISO8601 timestampWhen the emailed code stops working
resend_available_at?1ISO8601 timestampWhen another code can be requested

1 Present only when next_step is confirm_email

GET /v1/users/@me
Принимает токен бота. OAuth2: identify.

Returns the current user object. An OAuth2 bearer needs the identify scope and gets email only with the email scope.

StatusBodyCondition
200user objectThe account was returned
403error responseMISSING_OAUTH_SCOPE when a bearer lacks the identify scope

The rate limit is 40 requests per 10 seconds, on the user:settings:get bucket, shared with Get current user settings.

PATCH /v1/users/@me

Changes the account and returns the updated user object. A different username or discriminator, new_password and email_token need sudo verification for a claimed account.

FieldTypeDescription
username?1stringUsername (1-32 ASCII letters, digits or underscores)
discriminator?2string | integerDiscriminator (1-4 decimal digits)
global_name??stringDisplay name (1-32 characters), or null to clear
email?3stringAlways rejected, use email_token
new_password?4stringNew password (8-256 characters)
password?stringCurrent password (8-256 characters)
avatar?5?stringBase64-encoded avatar image, or null to clear
banner?5 6?stringBase64-encoded banner image, or null to clear
bio?7?stringBiography (1 character up to the max_bio_length limit, 320 by default), or null to clear
pronouns??stringPronouns (1-40 characters), or null to clear
accent_color??integerPacked 24-bit RGB colour (0-16777215), or null to clear
timezone?8?stringIANA timezone identifier (1-128 characters), or null to clear
timezone_privacy_flags?integerProfile field privacy flags for the timezone
hidden_profile_badges?12array[string]The full list of badge keys to hide from other people, at most 1008
premium_badge_hidden?13booleanDeprecated. Use the hidden badge list
premium_badge_masked?booleanWhether to show a lifetime badge as an ordinary subscription badge
premium_badge_timestamp_hidden?booleanWhether to hide the premium activation time
premium_badge_sequence_hidden?13booleanDeprecated. Use the hidden badge list
premium_enabled_override?9booleanWhether a staff override grants premium entitlements
has_dismissed_premium_onboarding?10booleanWhether the premium onboarding flow was dismissed
has_unread_gift_inventory?11booleanWhether the gift inventory has unread items
mention_flags?integerReply mention preference, one of 0, 1 or 2
email_token?stringEmail token (1-256 characters) from verify new email
mfa_method?stringSudo mode method, one of totp, webauthn or email_code
mfa_code?stringAuthenticator or backup code (1-32 characters)
webauthn_response?WebAuthn assertion objectWebAuthn assertion
webauthn_challenge?stringWebAuthn challenge (1-256 characters)
email_code_ticket?stringThe ticket from send a sudo email code (1-128 characters)
email_code?stringThe 6-digit code from that email

1 Can’t be everyone or here and can’t contain fluxer or system message. On an instance with the none tag style, a name another account has in any letter case returns USERNAME_ALREADY_TAKEN

2 Without a username, needs the custom discriminator entitlement or returns CHANGING_DISCRIMINATOR_REQUIRES_PREMIUM. A taken pair returns TAG_ALREADY_TAKEN. On an instance with the none tag style the discriminator is always 0000 and any other value returns DISCRIMINATOR_NOT_SUPPORTED_ON_INSTANCE

3 Returns EMAIL_MUST_BE_CHANGED_VIA_TOKEN, and INVALID_EMAIL_FORMAT when the value is not an address

4 A claimed account that already has a password also sends the current password or gets PASSWORD_NOT_SET. A breached password returns PASSWORD_IS_TOO_COMMON when the instance checks for them

5 Can start with a data:...;base64, prefix

6 Any non-null value needs the animated banner entitlement or returns BANNERS_REQUIRE_PREMIUM

7 The max_bio_length instance limit also applies, and a longer bio returns CONTENT_EXCEEDS_MAX_LENGTH as the error

8 An unknown identifier returns INVALID_TIMEZONE_IDENTIFIER. A first timezone sent without timezone_privacy_flags is visible to everyone, as with EVERYONE

9 Needs the STAFF flag or returns 403 MISSING_ACCESS

10 Only true has an effect

11 Only false has an effect

12 Replaces the saved list. A key that is neither a built-in badge kind nor custom:{id} returns INVALID_FORM_BODY, and keys of custom badges that no longer exist are dropped

13 true adds the field’s badge keys to hidden_profile_badges and false removes them. Ignored when the request also sends hidden_profile_badges

FieldBadge keys it hides
premium_badge_hiddenplutonium, visionary and premium
premium_badge_sequence_hiddenvisionary_number
operator_pass_badge_hiddenoperator_pass

These checks depend on the account tier and the instance.

ConditionResult
An unverified account changes the username, discriminator, display name, avatar, banner, biography, pronouns, accent colour, timezone, timezone privacy or a premium badge field while interaction_tier is legacy403 PROFILE_EMAIL_VERIFICATION_REQUIRED
An unclaimed account sends a field other than new_password, has_dismissed_premium_onboarding, has_unread_gift_inventory, email_token and the sudo fields while interaction_tier is legacyUNCLAIMED_ACCOUNTS_CAN_ONLY_SET_EMAIL_VIA_TOKEN
An unclaimed account on an email instance sends new_password without email_token while interaction_tier is enforced400 USE_CLAIM_ROUTE
A limited account changes a profile field403 ACCOUNT_LIMITED
An account linked to the provider sends new_password or email_token while the instance enforces single sign-on403 SSO_REQUIRED

On an instance where people sign in with a username, new_password can come with username to claim the account in one request.

ConditionError
An avatar or banner in a format other than PNG, JPEG, WebP, GIF, APNG, AVIF, HEIC, HEIF, JPEG XL or SVGINVALID_IMAGE_FORMAT
An avatar or banner larger than the avatar_max_size limit, 10485760 bytes by defaultIMAGE_SIZE_EXCEEDS_LIMIT
An animated avatar without the animated avatar entitlementANIMATED_AVATARS_REQUIRE_PREMIUM
A username, display name, biography or pronouns that matches the instance blocklist403 CONTENT_BLOCKED

STAFF accounts skip the profile blocklist but not the phrase and URL blocklists.

A denied change returns 400 INVALID_FORM_BODY with the validation code.

ChangeAllowanceValidation code
Username or discriminator5 per 3 hoursUSERNAME_CHANGED_TOO_MANY_TIMES
Biography25 per 30 minutesBIO_CHANGED_TOO_MANY_TIMES
Pronouns25 per 30 minutesPRONOUNS_CHANGED_TOO_MANY_TIMES
Accent colour25 per 30 minutesACCENT_COLOR_CHANGED_TOO_MANY_TIMES
Avatar25 per 30 minutesAVATAR_CHANGED_TOO_MANY_TIMES
Banner25 per 30 minutesBANNER_CHANGED_TOO_MANY_TIMES
StatusBodyCondition
200user objectThe account was updated
200user object with the password change completion fieldsA password change replaced the session
400error responseThe body, image, tag, password, entitlement, change limit or sudo proof is invalid
403error responseEmail verification, sudo verification or STAFF is needed, or content is blocked

Squad sends User Update to the account.

The rate limit is 20 requests per minute, on the user:update bucket.

PUT /v1/users/@me/date-of-birth

Sets the date of birth of an account that has none and returns a date of birth result object. A date of birth can’t be changed once set.

FieldTypeDescription
date_of_birth1stringThe date of birth as YYYY-MM-DD

1 A date that doesn’t exist, is today or later, or is more than 120 years ago returns the field code INVALID_DATE_OF_BIRTH_FORMAT

The minimum age follows the region of the client IP address, as in register an account. A person below it gets 403 ACCOUNT_BELOW_MINIMUM_AGE, and the account is closed and deleted after 72 hours.

StatusBodyCondition
200date of birth result objectThe date of birth was set
400error responseThe date is invalid
403error responseThe person is below the minimum age
404error responseThe instance doesn’t collect date of birth
409error responseThe account already has a date of birth

Squad sends User Update, and User Settings Update when settings still on their defaults change to match the age.

The rate limit is 5 requests per hour, on the user:date_of_birth bucket.

POST /v1/users/@me/claim

Adds an email address, and optionally a password, to an unclaimed account so it can sign in from another device. Returns a claim result object.

FieldTypeDescription
email?1stringThe email address to add
password?2stringThe password to set (8-256 characters)

1 Needed on an email instance or the field code EMAIL_IS_REQUIRED is returned. Ignored on a username instance. An address already on another account returns EMAIL_ALREADY_IN_USE as the field code

2 Needed when the instance uses usernames to sign in, sends no email or has verification_basis set to local_credential, unless the account has a passkey. Without it the route returns 400 PASSWORD_REQUIRED_TO_CLAIM. A breached password returns PASSWORD_IS_TOO_COMMON

On an instance that sends email, the address waits for confirm the email address. Otherwise it is confirmed at once and next_step is none.

StatusBodyCondition
200claim result objectThe account was claimed or the address waits for its code
400error responseThe input is invalid, or ACCOUNT_ALREADY_CLAIMED

Squad sends User Update, and emails the code when next_step is confirm_email.

The rate limit is 5 requests per hour, on the user:claim bucket.

POST /v1/users/@me/email-verification/send

Emails a 6-digit code to the unconfirmed address of the account and returns an email code delivery object.

StatusBodyCondition
200email code delivery objectThe code was sent
400error responseUSE_CLAIM_ROUTE for an unclaimed account or one without an address
400error responseACCOUNT_ALREADY_CLAIMED for a confirmed address
400error responseEMAIL_CODES_UNAVAILABLE when no code can be sent

The rate limit is 3 requests per 15 minutes, on the user:email_verification bucket.

POST /v1/users/@me/email-verification/confirm

Confirms the address with the emailed code and returns the updated user object.

FieldTypeDescription
codestringThe 6-digit code from the email
StatusBodyCondition
200user objectThe address was confirmed
400error responseINVALID_SIGN_IN_CODE for a wrong code, SIGN_IN_CODE_EXPIRED after 5 wrong tries, 10 minutes or an address change

Squad sends User Update.

The rate limit is 10 requests per minute, on the user:email_verification:confirm bucket.

DELETE /v1/users/@me/authorized-ips
Требуется подтверждение MFA.

Deletes every authorised IP record, and the next sign-in from any address needs fresh authorisation. Needs sudo verification.

The sudo verification object, which can be empty when you send a sudo token.

StatusBodyCondition
204emptyThe records were deleted
403error responseSUDO_MODE_REQUIRED

The rate limit is 10 requests per minute, on the user:authorized_ips:forget bucket.

POST /v1/users/@me/disable
Требуется подтверждение MFA.

Disables the account and keeps its data. Needs sudo verification, and the response has no X-Fluxer-Sudo-Mode-JWT header.

The sudo verification object, which can be empty when you send a sudo token.

StatusBodyCondition
204emptyThe account was disabled
403error responseSUDO_MODE_REQUIRED

The rate limit is 5 requests per hour, on the user:account:disable bucket.

POST /v1/users/@me/delete
Требуется подтверждение MFA.

Schedules deletion of the account and deletes every session. Needs sudo verification.

The sudo verification object, which can be empty when you send a sudo token, together with these fields.

FieldTypeDescription
immediate?booleanDelete the account now instead of after the grace period
delete_messages?booleanDelete every message the account sent along with the account. Otherwise the messages stay, with the author removed
StatusBodyCondition
200object with pending_deletion_at, an ISO 8601 timestampThe deletion was scheduled for that time
400error responseThe account owns a guild, USER_OWNS_GUILDS
409error responseCONFLICT when erasure has started

Squad emails the account when it has an address, once when the deletion is scheduled for later and once when the deletion is done.

The rate limit is 5 requests per hour, on the user:account:delete bucket.

POST /v1/users/@me/terms-acceptance

Records acceptance of the current terms of service and that the privacy policy was shown, and returns the updated user object.

The body is an empty object.

StatusBodyCondition
200user objectThe acceptance was recorded
400error responseThe body is not a JSON object

Squad sends User Update.

The rate limit is 20 requests per minute, on the user:update bucket.

POST /v1/users/@me/profile-badges/preview

Returns the account’s profile badges as others would see them with the given settings, and every badge the account has with whether those settings hide it. Nothing is saved.

FieldTypeDescription
hidden_profile_badges?array[string]Preview with these badge keys hidden
premium_badge_masked?booleanPreview with the premium badge masked
premium_badge_timestamp_hidden?booleanPreview with the premium badge date hidden
operator_pass_badge_timestamp_hidden?booleanPreview with the date the Operator Pass was first held hidden
operator_pass_badge_count_hidden?booleanPreview with the number of Operator Passes hidden

A field you leave out keeps the saved value. The deprecated premium_badge_hidden, premium_badge_sequence_hidden and operator_pass_badge_hidden fields work as in Modify current user.

FieldTypeDescription
profile_badgesarray[profile badge object]The badges other people would see, in display order
own_badgesarray[own profile badge object]Every badge the account holds, in display order

A profile badge with a hidden field. A masked Visionary badge is listed as visionary here, because that is the key you hide.

FieldTypeDescription
keystringThe badge’s identity, and the value to put in hidden_profile_badges
kindstringThe badge type
labelstringThe badge description in your locale
asset?stringThe badge image hash, or null for a text badge, a custom badge or a built-in badge with a replaced image
asset_url?stringThe image URL of a custom badge or of a built-in badge with a replaced image
aspect_ratio?numberThe image width divided by its height
caption?stringThe short badge text, such as #42
href?stringThe URL a click opens
small_asset?stringThe image hash for 20 pixels and smaller
count??integerThe number of Operator Passes the badge stands for
accessible_label??stringThe label for screen readers
details??badge details objectThe tooltip content
hiddenbooleanWhether the badge key is in the previewed hidden_profile_badges
StatusBodyCondition
200response bodyThe badges were returned

The rate limit is 100 requests per 10 seconds, on the user:profile::target_id bucket.

POST /v1/users/@me/premium/reset

Clears every premium field on the account. You need the STAFF flag.

StatusBodyCondition
204emptyThe premium state was cleared
403error responseMISSING_ACCESS without the STAFF flag

Squad sends User Update.

The rate limit is 20 requests per minute, on the user:update bucket.